Elsa 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 6쪽 중 2쪽

r-friendly experience. * Elsa's natural language processing (NLP) capabilities allow dApps to offer a natural language interface for their users. * This integration simplifies complex blockchain interactions and helps easy navigation for complicated user interfaces. * It significantly reduces the learning curve usually associated with traditional blockchain interactions. * Elsa SDK and widgets also provide support for user queries, offering real-time assistance and hence enhancing user engagement. # Widget Integration Guide The HeyElsa Chat Widget is a React component that provides AI-powered DeFi assistance with wallet interactions through MessagePort communication. 🚀 Installation Prerequisites This package requires an npm token for access. Add the following to your .npmrc file: ``` //registry.npmjs.org/:_authToken=your-npm-token-here ``` Install Package {% code title="Install" %} ```bash npm install @heyelsa/chat-widget ``` {% endcode %} 🔧 Integration Setup Basic Implementation {% code title="Basic React Integration (example)" %} ```tsx import { HeyElsaChatWidget, syncWalletState } from '@heyelsa/chat-widget'; import { createWalletAdapter } from "./adapter.ts"; function App() { const messagePort = createWalletAdapter(); return ( <div> <HeyElsaChatWidget keyId="your-unique-dapp-id" dappName="MyDApp" messagePort={messagePort} position="bottom-right" customStyles={{ primaryColor: "#6366f1" }} /> </div> ); } ``` {% endcode %} 📋 Configuration Props Props Interface ```ts interface HeyElsaChatWidgetProps { keyId: string; dappName: string; messagePort: MessagePort; position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'; onClose?: () => void; customStyles?: { primaryColor?: string; backgroundColor?: string; textColor?: string; borderRadius?: string; }; } ``` Props Reference | Prop | Type | Required | Default | Description | | ------------ | ----------- | -------- | -------------- | ------------------------------------------- | | keyId | string | Yes | - | Unique identifier from HeyElsa Dashboard | | dappName | string | Yes | - | Display name for your dApp | | messagePort | MessagePort | Yes | - | Communication channel for wallet operations | | position | string | No | "bottom-right" | Widget position on screen | | customStyles | object | No | - | Custom styling options | 🔐 Getting Your Key ID Steps to get your Key ID: {% stepper %} {% step %} ### Visit Dashboard Open the HeyElsa Dashboard at: <https://widget-dashboard.heyelsa.ai/widgets> {% endstep %} {% step %} ### Create Widget Instance Create a new widget instance for your dApp. {% endstep %} {% step %} ### Copy Key ID Copy the generated Key ID and use it as the `keyId` prop in your integration. {% endstep %} {% endstepper %} Note: Dashboard access is currently limited and coming soon for public use. 🌉 Adapter Implementation What is the Adapter? The adapter handles communication between the widget and your dApp's wallet functionality. You need to implement the `createWalletAdapter` function to handle wallet operations. Implementation Code {% code title="createWalletAdapter.ts" %} ```ts export function createWalletAdapter(): MessagePort { const channel = new MessageChannel(); channel.port1.onmessage = async (event) => { const request = event.data as WalletRequest; const response = { requestId: request.requestId, success: false, data: null, error: undefined }; try { const ethereum = (window as any).ethereum; let result; switch (request.action) { case "CONNECT_WALLET": result = await ethereum.request({ method: 'eth_requestAccounts' }); break; case "DISCONNECT_WALLET": // Handle wallet disconnection logic result = true; break; case "GET_ACCOUNTS": result = await ethereum.request({ method: 'eth_accounts' }); break; case "GET_CHAIN_ID": result = await ethereum.request({ method: 'eth_chainId' }); break; case "GET_BALANCE": result = await ethereum.request({ method: 'eth_getBalance', params: [request.params?.address, 'latest'] }); break; case "SIGN_MESSAGE": result = await ethereum.request({ method: 'personal_sign', params: [request.params?.message, request.params?.address] }); break; case "SIGN_TRANSACTION": result = await ethereum.request({ method: 'eth_signTransaction', params: [request.params?.transaction] }); break; case "BROADCAST_TRANSACTION": result = await ethereum.request({ method: 'eth_sendTransaction', params: [request.params?.transaction] }); break; case "SWITCH_NETWORK": result = await ethereum.request({ method: 'wallet_switchEthereumChain', params: [{ chainId: request.params?.chainId }] }); break; default: throw new Error(`Unsupported action: ${request.action}`); } response.success = true; response.data = result; } catch (error: any) { response.error = error?.message; } channel.port1.postMessage(response); }; return channel.port2; } ``` {% endcode %} Supported Wallet Actions | Action | Description | Parameters | | ------------------------ | ---------------------- | ------------------------------------ | | CONNECT\_WALLET | Connect user wallet | - | | DISCONNECT\_WALLET | Disconnect wallet | - | | GET\_ACCOUNTS | Get connected accounts | - | | GET\_CHAIN\_ID | Get current chain ID | - | | GET\_BALANCE | Get wallet balance | { address: string } | | SIGN\_MESSAGE | Sign a message | { message: string, address: string } | | SIGN\_TRANSACTION | Sign transaction | { transaction: object } | | BROADCAST\_TRANSACTION | Send transaction | { transaction: object } | | SWITCH\_NETWORK | Switch network | { chainId: string } | | NETWORK\_SWITCHED\_EVENT | Network switched | { chainId: string } | 🔄 Wallet State Synchronisation Purpose: Use these methods to send connected wallet status from your dApp to the widget. Connected State {% code title="Sync Connected State" %} ```ts import { syncWalletState } from '@heyelsa/chat-widget'; const handleWalletConnect = (address: string, chainId: string, balance: string) => { syncWalletState({ isConnected: true, address: address, chainId: chainId, chainName: 'Ethereum Mainnet', balance: balance, nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 } }); }; ``` {% endcode %} Disconnected State {% code title="Sync Disconnected State" %} ```ts const handleWalletDisconnect = () => { syncWalletState({ isConnected: false }); }; ``` {% endcode %} WalletState Interface ```ts interface WalletState { isConnected: boolean; address?: string; chainId?: string; chainName?: string; balance?: string; nativeCurrency?: { name: string; symbol: string; decimals: number; }; } ``` Custom Styles {% code title="Custom Styles Example" %} ```tsx <HeyElsaChatWidget keyId="advanced-dapp-v1" dappName="Advanced DeFi Platform" messagePort={messagePort} position="bottom-right" customStyles={{ primaryColor: '#FF0000', backgroundColor: '#ffffff', textColor: '#333333', borderRadius: '20px' }} /> ``` {% endcode %} 📚 Summary Key Points to Remember: * Install the package with: ```bash npm install @heyelsa/chat-widget ``` * Get your Key ID from the HeyElsa Dashboard. * Implement the `createWalletAdapter` function to handle wallet operations. * Use `syncWalletState` to keep the widget informed about wallet status from your dApp. * Customize styling with the `customStyles` prop. * Handle wallet events properly for the best user experience. # Widget Tech Stack This system powers AI-driven document Q\&A and contextual conversation experiences across decentralized applications (dApps), using a modular backend and a React-based frontend. ### Backend Overview Purpose: Provide an intelligent, multi-tenant backend system for Elsa-enabled dApps. Highlights: * RAG (Retrieval-Augmented Generation) for document Q\&A * Contextual chat with session memory * Role-based access control * Vector-based document search * Isolated environments per DApp #### Backend Technologies #### Runtime & Language Node.js, TypeScript (ES2020) #### API Framework Express.js, CORS, Multer, REST #### Data & Storage MySQL (via mysql2), Custom ORM ChromaDB (vector database for embeddings) #### Security & Auth JWT, bcryptjs, UUID Role-based access (\ admin\ ,\ dapp\_admin\ ) #### AI & Embeddings OpenAI GPT-4.1 +\ text-embedding-3-small LangChain framework for RAG ChromaDB client for semantic search #### External Services (Backend) | Service | Purpose | | ---------- | -------------------------------- | | OpenAI API | GPT-4.1 completions & embeddings | | ChromaDB | Vector similarity search | | MySQL | Relational data storage | ### Frontend Overview Built as a modular React widget to integrate seamlessly into any dApp UI. #### Frontend Technologies #### Framework React > \= 16.8.0 – Core UI framework TypeScript 5.3.3 – Type-safe development React Hooks – State and lifecycle handling #### Styling & UI Inline Styles – React CSSProperties CSS-in-JS – Programmatic styling PostCSS – CSS optimization pipeline Responsive Design – Mobile-first layout #### Web3 & Blockchain Web3 Provider Detection (e.g., MetaMask) EIP-1193 compliance Multi-chain Support: Ethereum, Polygon, Base Transaction signing, broadcasting, tracking #### API & Communication REST API integration Fetch API for HTTP requests WebSocket (planned) for real-time CORS handling # Elsa Dashboard <a href="https://github.com/HeyElsa/elsa-widget-dashboard" class="button primary" data-icon="external-link">Open Elsa Dashboard</a> <a href="https://heyelsa.notion.site/USER-GUIDE-27e40f5de355812abe9fe8cdaf6a02f8?pvs=25" class="button secondary" data-icon="book">USER GUIDE</a> # Event-based Communication Between dApp and the Elsa Widget. {% stepper %} {% step %} ### Architecture * Widget (npm package) * React component integrated by the DApp. * Does not directly access wallets. * Sends generic wallet requests to the DApp. * DApp (Host) * Integrates the widget package. * Has wallet provider logic (EVM, Solana, Bitcoin, Aptos, etc). * Listens for widget events and responds. * MessageChannel * Dedicated communication channel between widget and DApp code. {% endstep %} {% step %} ### Communication Flow * DApp initializes MessageChannel * DApp passes port to widget during initialization * Widget sends request via MessagePort * DApp handles request → performs wallet action * DApp sends response back via MessagePort {% endstep %} {% step %} ### Security Benefits * Same-Origin Isolation: MessageChannel creates isolated communication ports that only work within the same origin/context. * No Global Namespace Pollution: Unlike window\.postMessage, MessageChannel doesn't expose communication to the global scope. * Direct Port-to-Port Communication: Creates a private channel between two specific endpoints. * Structured Cloning: Messages are safely cloned, preventing reference sharing vulnerabilities. * Type-Safe Communication: Your implementation uses typed interfaces (WalletRequest, WalletResponse) for additional safety. {% endstep %} {% endstepper %} # Package <https://www.npmjs.com/package/@heyelsa/chat-widget> # Sample Implementation **Example Implementation**: <https://github.com/HeyElsa/elsa-widget-testdapp> This is a chain-agnostic implementation and any type of wallet can be integrated. Both dApps with browser wallets and dApps with embedded wallets (e.g scribble) can implement it. For wallet-related transactions like sign transaction, connect wallet etc, the widget sends requests to the dApp through events and the dApp processes these events and sends back the response. Security-related content has been updated in the technical docs. Complete implementation of the widget is available in the [Example code](https://github.com/HeyElsa/elsa-widget-testdapp). Features implemented are: 1. Knowledge base querying, 2. Actions: Send and Swap transactions are covered. Supported chains in the widget are : 1. Ethereum 2. Base 3. Soneium 4. Polygon # Elsa Brand Kit Welcome to the Elsa Brand Kit. Please follow the guidelines below when using our logos, colours, or referencing the Elsa brand in any communication. ## Brand Guidelines {% file src="/files/g19Lj14TJ9K9M6Z3ftEy" %} ### Logo The Elsa logo is a friendly, anthropomorphic mascot that represents our mission to make crypto and DeFi feel approachable rather than intimidating, with a warm smile that reinforces that sense of welcome. Its most distinctive feature, the circular emblem on the head, reads as a sensor, symbolising a smart agent with its finger on the pulse of the crypto market: always watching, always learning, and always working in the user's interest. Our horizontal lockup is the primary expression of the Elsa brand and should be used almost exclusively, except where size or space restrictions make it impractical. Our iconmark should be reserved for smaller applications where the wordmark would not remain legible, or in contexts where the Elsa brand name is already present alongside it. Before using the Elsa logo, please review the "don'ts" in our Brand Guidelines. Do not alter the lockup, recolour the logo outside the approved palette, stretch or distort it, or apply effects of any kind. See the Logo Misuse page for additional examples. {% file src="/files/75AnQgeM5VZUCRZVEtde" %} {% file src="/files/npxZNQTcXwpfmcGDPd8u" %} {% file src="/files/ioa8qTPBQxFQ0wfbVYit" %} {% file src="/files/HkaoKvwwoYTa4awwqgTx" %} {% file src="/files/X9NJRM4vh2Ewar16Efen" %} {% file src="/files/Hc73x2pc3iz4ne7A4gmQ" %} {% file src="/files/VtdV8hzaJ7BHmlCzvB69" %} {% file src="/files/dAcq7rLG7SecssnJKg16" %} {% file src="/files/T9j6til6wj9Zz07KfNIA" %} {% file src="/files/2pZWfqFVLHmBm9pUneS8" %} {% file src="/files/VrxTaAQvpBo4ium4VSHr" %} {% file src="/files/yI9B6SgQssp25UUa3ZTM" %} Please reach out to our team should you have any questions on how to use the Elsa brand. # HeyElsa MiCA Whitepaper In accordance with Title II of Regulation (EU) 2023/1114 (MiCA) *** <table data-header-hidden><thead><tr><th width="78.5703125"></th><th width="198.16015625"></th><th></th></tr></thead><tbody><tr><td>N</td><td>Field</td><td>Content</td></tr><tr><td>00</td><td>Table Of Content</td><td><p>Part A - Information about the offeror or the person seeking admission to trading</p><p>Part B - Information about the issuer, if different from the offeror or person seeking admission to trading</p><p>Part C- Information about the operator of the trading platform in cases where it draws up the crypto-asset white paper and information about other persons drawing the crypto-asset white paper pursuant to Article 6(1), second subparagraph, of Regulation (EU) 2023/1114</p><p>Part D- Information about the crypto-asset project</p><p>Part E - Information about the offer to the public of crypto-assets or their admission to trading</p><p>Part F - Information about the crypto-assets</p><p>Part G - Information on the rights and obligations attached to the crypto-assets</p><p>Part H – information on the underlying technology</p><p>J – Information on the sustainability indicators in relation to adverse impact on the climate and other environment-related adverse impacts</p><p><br></p></td></tr><tr><td>01</td><td>Date of notification</td><td>19th December 2025</td></tr><tr><td>02</td><td>Statement in accordance with Article 6(3) of Regulation (EU) 2023/1114</td><td>This crypto-asset white paper has not been approved by any competent authority in any Member State of the European Union. The operator of the trading platform of the crypto-asset is solely responsible for the content of this crypto-asset white paper.</td></tr><tr><td>03</td><td>Compliance statement in accordance with Article 6(6) of Regulation (EU) 2023/1114</td><td>This crypto-asset white paper complies with Title II of Regulation (EU) 2023/1114 and, to the best of the knowledge of the management body, the information presented in this crypto-asset white paper is fair, clear and not misleading and the crypto-asset white paper makes no omission likely to affect its import.</td></tr><tr><td>04</td><td>Statement in accordance with Article 6(5), points (a), (b), (c) of Regulation (EU) 2023/1114</td><td>The crypto-asset referred to in this white paper may lose its value in part or in full, may not always be transferable and may not be liquid.</td></tr><tr><td>05</td><td>Statement in accordance with Article 6(5), point (d) of Regulation (EU) 2023/1114</td><td>The utility token referred to in this white paper may not be exchangeable against the good or service promised in the crypto-asset white paper, especially in the case of a failure or discontinuation of the crypto-asset project.</td></tr><tr><td>06</td><td>Statement in accordance with Article 6(5), points (e) and (f) of Regulation (EU) 2023/1114</td><td>The crypto-asset referred to in this white paper is not covered by the investor compensation schemes under Directive 97/9/EC of the European Parliament and of the Council. The crypto-asset referred to in this white paper is not covered by the deposit guarantee schemes under Directive 2014/49/EU of the European Parliament and of the Council.</td></tr></tbody></table> ### Summary&#x20; <table data-header-hidden><thead><tr><th width="78.51953125"></th><th width="218.515625"></th><th></th></tr></thead><tbody><tr><td>07</td><td>Warning in accordance with Article 6(7), second subparagraph of Regulation (EU) 2023/1114</td><td><p>This summary should be read as an introduction to the crypto-asset white paper. </p><p><br></p><p>The prospective holder should base any decision to purchase this crypto-asset on the content of the crypto-asset white paper as a whole and not on the summary alone.</p><p><br></p><p>The offer to the public of this crypto-asset does not constitute an offer or solicitation to purchase financial instruments and any such offer or solicitation can be made only by means of a prospectus or other offer documents pursuant to the applicable national law. </p><p><br></p><p>This crypto-asset white paper does not constitute a prospectus as referred to in Regulation (EU) 2017/1129 of the European Parliament and of the Council (36) or any other offer document pursuant to Union or national law.</p></td></tr><tr><td>08</td><td>Characteristics of the crypto-asset</td><td><p>$ELSA token is a crypto-asset to be classified as crypto-assets other than asset referenced tokens (“ART”) or e-money tokens (“EMT”) under Title II of MiCAR</p><p><br></p><p>$ELSA is the native utility token of the Elsa crypto agent layer. It is designed to be used within the Elsa ecosystem for the following purposes:</p><p><br></p><ul><li>Payment and Discounts: To pay for, and obtain discounts on, execution and automation fees across the Elsa Copilot, Widget &#x26; SDK, and AgentOS surfaces.</li><li>Access and Enablement: To access higher usage limits, advanced automation modules, and partner-enabled features within the ecosystem.</li><li>Governance Participation: To participate in certain governance and configuration processes related to the Elsa protocol, where such governance is implemented and legally permissible.</li></ul><p><br></p><p>The token does not represent shares, equity, debt, or any ownership interest in any legal entity. It does not grant rights to dividends, profit-sharing, or repayment of capital. Holders of $ELSA bear the risk of price volatility and the potential loss of part or all of the token’s value.</p><p><br></p><p>Any future modifications to the rights or obligations associated with the token will follow transparent governance and change-management procedures, as detailed in the final token documentation and subject to applicable law.</p><p><br></p></td></tr><tr><td>09</td><td>Information about the quality and quantity of goods or services to which the utility tokens give access and restrictions on the transferability</td><td><p>$ELSA is a utility token that provides access to certain goods and services within t
프로젝트로 돌아가기