SPACE ID 백서

SPACE ID

원문

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

rvice. For example, when users transfer assets to svensen.arb on Math Wallet, the assets are transferred to the traditional address in the record. Click “Edit” to edit the record address. #### **Extend** Users can extend their domain registration anytime during the registration period and within 90 days after it expires, which is a 90-day grace period. During the grace period, the domain name will be reserved only for its previous registrant to expand its registration. After the grace period, the name will not be reserved and will be open to the public to register. To expand the registration, click “Extend” to make the change. ## Your Domain SDK/API SPACE ID can provide the Web3 Name SDK and Domain API to every name service launched with SPACE ID 3.0 * Web3 Name SDK: It is specifically designed to support TLDs that have undergone the verification process, which is conducted through SID DAO. Once a TLD is successfully verified, it will be integrated into the official SDK. This integration allows all DApps that have already incorporated Web3 Name SDK to seamlessly support the verified TLD. In essence, Web3 Name SDK simplifies the process of adding and utilizing web3 domains with verified TLDs, offering a standardized and efficient solution for developers. * Domain API: In addition to Web3 Name SDK, we also offer an API for each TLD. This API is intended to facilitate both resolution and reverse resolution, empowering project developers to proactively seek out and engage with DApps for integration purposes. With this API, project teams gain the flexibility to independently connect their TLDs to various DApps, enabling two-way communication between their domains and the DApps they choose to integrate. This approach ensures greater adaptability and customization for projects seeking to leverage Web3 within their ecosystems. ## **Community Management Through Domain Fee Models** You can generate revenue and manage the community by establishing registration and renewal fees for domain names. It's important to note that SPACE ID collects a 15% protocol-level commission on these fees, which is a key aspect to consider in your revenue strategy. Here are some key points regarding this: * **Setting Registration Fees:** Design a pricing structure that outlines the cost for users to register domain names within your ecosystem. * **Renewal Fees:** Define the fees associated with renewing domain registrations, which may vary from the initial registration cost. * **Revenue Management:** Utilize the revenue generated from registration and renewal fees to support and enhance the community associated with your domain ecosystem. This income can be used for community development, maintenance, and other community-related activities. # Web3 Name API & SDK Streamline digital identity integration with SPACE ID's all-in-one Web3 Name API & SDK, empowering developers with simplicity, scalability, and game-changing potential.\ \ One API & SDK for all has always been one of the main features of SPACE ID to support all web3 dApps. It is ultimately designed to be a unified and streamlined approach that greatly simplifies the integration of web3 services, eliminating the need for developers to work with multiple protocols, saving time and reducing the risk of compatibility issues.\ \ Web3 Name API & SDK includes a suite of features and functionalities designed to facilitate domain name resolution and reverse resolution. This comprehensive SDK is equipped to support various top-level domains (TLDs) like .eth, .bnb, .sol, .arb, and the verified domains that are launched through the SPACE ID Toolkit. Additionally, it dynamically supports new TLDs as they are verified, ensuring seamless integration for domain name resolution and reverse resolution. For example, suppose you have integrated Web3 Name API / SDK, allowing it to support .bnb domain resolution on BNB Chain. When a new TLD, such as .allen, is launched on SPACE ID and subsequently verified, the SDK will automatically extend its capabilities to include .allen domain name resolution. This process requires no additional upgrades or development costs, streamlining domain management for developers and users. Notably, the Web3 Name API & SDK also accommodates domain names associated with blockchains outside the EVM, such as .sei, .inj, and .sol. # Web3 Name API SPACE ID provides a free HTTP API to help dApps integrate domain resolutions with ease. All data is queried on-chain securely in real time. The primary capabilities of the SPACE ID Web3 Name API include: 1. Domain Name -> Address resolution: Retrieve the crypto address uniquely bound to the domain name by entering the domain name. 2. Address -> Domain Name resolution: Retrieve the domain name associated with the address via inputs: 1) the crypto address, and 2) the chain id. * Given one crypto address could own multiple domain names, users can set a primary name such that their address can be 1-to-1 mapped to this primary name&#x20; ## 1. Resolve Domain Name -> Address <mark style="color:blue;">`GET`</mark> `https://nameapi.space.id/getAddress?domain=`&#x20; **Request URL Example:**&#x20; * Domain to be resolved: spaceid.bnb * <https://nameapi.space.id/getAddress?domain=spaceid.bnb>&#x20; ```json Status Code: 200 OK { "address":"0xb5932a6B7d50A966AEC6C74C97385412Fb497540" "code":0 "msg":"success" } ``` **Return Field Description** <table><thead><tr><th width="148">Name</th><th>Description</th></tr></thead><tbody><tr><td>address </td><td>Returns the resolved address. If no domain records are found, the address field will not be returned</td></tr><tr><td>code</td><td>0: address found, 1: no address found, -1: error</td></tr><tr><td>msg</td><td>result status and error message</td></tr></tbody></table> \*Get Address API now supports .four token CA resolving, sample query is provided for testing and integration. [https://nameapi.space.id/getAddress?domain=tst.four ](https://nameapi.space.id/getAddress?domain=tst.four) ``` Status Code: 200 OK { "address":"0x86Bb94DdD16Efc8bc58e6b056e8df71D9e666429" "code":0 "msg":"success" } ``` ## 2. Resolve Address -> Domain Name <mark style="color:blue;">`GET`</mark> `https://nameapi.space.id/getName?chainid=&address=` #### Query Parameters <table><thead><tr><th width="195">Name</th><th>Description</th></tr></thead><tbody><tr><td>chainid</td><td>The Chain ID that tells which chain the app is on (e.g. Ethereum: 1, BNB Chain: 56, Solana: 900)</td></tr><tr><td>address</td><td>The crypto address that can be resolved to a primary domain name</td></tr></tbody></table> **Request URL Example (single chain query):**&#x20; * BNB Chain (Chain ID: 56) Address to be resolved: 0xb5932a6B7d50A966AEC6C74C97385412Fb497540 * <https://nameapi.space.id/getName?chainid=56&address=0xb5932a6B7d50A966AEC6C74C97385412Fb497540> * Return:&#x20; ```json Status Code: 200 OK { "code": 0, "data": { "name": "spaceid.bnb", "chainID": 56, "errMsg": "" }, "msg": "success" } ``` \*GetName API now support four meme token domain retrieval <https://nameapi.space.id/getName?chainid=56&address=0x86Bb94DdD16Efc8bc58e6b056e8df71D9e666429> ``` Status Code: 200 OK { "code": 0, "data": { "name": "tst.four", "chainID": 56, "errMsg": "" }, "msg": "success" } ``` **Request URL Example (multi-chain query):** * Address 0xb5932a6B7d50A966AEC6C74C97385412Fb497540, to be resolved for names on Arbitrum, BNB Chain, and Mint.&#x20; * <https://nameapi.space.id/getDomainNamesByChainIdList?chainlist=42161,56,101,185&address=0x2e552E3aD9f7446e9caB378c008315E0C26c0398> * Return:&#x20; <pre class="language-json"><code class="lang-json"><strong>Status Code: 200 OK </strong>{ "code": 0, "data": [ { "name": "0x5206.arb", "chainID": 42161, "errMsg": "" }, { "name": "allen.bnb", "chainID": 56, "errMsg": "" }, { "name": "", "chainID": 0, "errMsg": "unsupported chain id: 101" }, { "name": "", "chainID": 185, "errMsg": "corresponding domain not found" } ], "msg": "success" } </code></pre> **Return Field Description** <table><thead><tr><th width="134">Name</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>Returns the resolved domain name. If no record is found, the name field will not be returned</td></tr><tr><td>code</td><td>0: name found, 1: name not found, -1: error </td></tr><tr><td>msg</td><td>result status and error message</td></tr></tbody></table> ## 3. Resolve Payment ID -> Address <mark style="color:blue;">`GET`</mark> `https://nameapi.space.id/getPaymentIdName/”paymentID”/”chaintype”`&#x20; #### Query Parameters <table><thead><tr><th width="195">Name</th><th>Description</th></tr></thead><tbody><tr><td>paymentID</td><td>The payment ID name that needs to be resolved (e.g. jerry@binance)</td></tr><tr><td>chaintype</td><td>The chain address to be resolved, from btc, evm, sol, tron, aptos, sui</td></tr></tbody></table> **Request URL Example:**&#x20; * Payment ID to be resolved: jerry\@binance, chaintype: evm * <https://nameapi.space.id/getPaymentIdName/jerry@binance/evm> * Return: <pre class="language-json"><code class="lang-json"><strong>Status Code: 200 OK </strong>{ "address": "0x5bcb636853ab70b873adaf2d9759ca1489669cce", "code": 0, "msg": "success" } </code></pre> ## Appendix for Supported Domains & Chains | Chain | Chain ID | Domain | | ------------------------- | -------- | ------- | | Ethereum Mainnet | 1 | .eth | | BNB Chain | 56 | .bnb | | BNB Chain | 56 | .four | | Solana | 900 | .sol | | Arbitrum One | 42161 | .arb | | Manta Pacific Mainnet | 169 | .manta | | Mode | 34443 | .mode | | ZKFair Mainnet | 42766 | .zfk | | Lightlink Phoenix Mainnet | 1890 | .ll | | ZetaChain Mainnet | 7000 | .zeta | | Merlin Mainnet | 4200 | .merlin | | Gnosis | 100 | .gno | | Taiko Alethia | 167000 | .taiko | | AlienX Mainnet | 10241024 | .alien | | Mint Mainnet | 185 | .mint | | AILayer Mainnet | 2649 | .ail | | Morph | 2818 | .mph | | DuckChain Mainnet | 5545 | .duck | | Gravity Alpha Mainnet | 1625 | .g | | Story | 1514 | .ip | | Injective | 901 | .inj | | Sei | 902 | .sei | | .lens on Polygon | 903 | .lens | | .crypto on Polygon | 904 | .crypto | # Web3 Name SDK ## Overview The primary capabilities of the SDK include: 1. Domain Name Resolution: It resolves Domain Names and Payment IDs to obtain essential information about the domain, including its associated crypto address, various records (such as avatars, IPFS links, social data), and metadata, etc. 2. Reverse Resolution: The SDK facilitates reverse address resolution. This feature makes it possible to determine the Primary Domain Name associated with a given crypto address, across different blockchains or TLDs. By default, all EVM-based Domain Names are supported for domain resolution in the Web3 Name SDK. Reverse resolution returns a Chain Primary Name for each EVM chain. Project administrators have the flexibility to choose whether to integrate support for all or only specific chains and TLDs. They can also configure custom settings for reverse resolution as needed. This adaptability allows projects to tailor the SDK's functionality to their specific requirements. ## Get Started Developers can integrate the resolution of web3 domain name <> crypto address using the Web3 Name SDK with zero configuration. ### Install `npm install @web3-name-sdk/core viem@^2.23.12` If you are using `next.js`, please add the following configuration in your `next.config.js` in order to transpile commonjs dependencies: ```javascript const nextConfig = { transpilePackages: ['@web3-name-sdk/core'], } ``` ### 1. Setup client ```jsx import { createWeb3Name } from '@web3-name-sdk/core' const web3name = createWeb3Name() ``` ### 2. Resolve a domain name You can get address from domain name with a single request: ```jsx const address = await web3name.getAddress('spaceid.bnb') // expect: '0xb5932a6b7d50a966aec6c74c97385412fb497540' const address = await web3name.getAddress('vitalik.eth') // expect: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045' const address = await web3name.getAddress('beresnev.crypto') // expect: '0x6ec0deed30605bcd19342f3c30201db263291589' const address = await web3name.getAddress('bts_official.lens') // expect: '0xd80efa68b50d21e548b9cdb092ebc6e5bca113e7' ``` #### Multichain address resolution Domain resolution for other chains can be provided by adding `coinType` param to `getAddress()`. ```jsx import { convertEVMChainIdToCoinType } from '@ensdomains/address-encoder' const address = await web3name.getAddress('gnome.gno', {coinType: convertEVMChainIdToCoinType(1)}) // expect: 0x4348d45967552d0176d465170b7375ed22dc627b ``` ### 3. Resolve an address There are optional parameters in the method to select your target chain or TLD (top-level Domain). By providing chain IDs, you can resolve addresses on selected chains and get an available domain name from all TLDs deployed on these chains. ```jsx // Resolve an address from BNB Chain const name = await web3name.getDomainName({ address: '0xb5932a6b7d50a966aec6c74c97385412fb497540', queryChainIdList: [56], }) // expect: spaceid.bnb ``` By providing TLDs, address can be resolved from the selected TLDs and get an available TLD primary name. ```jsx // Resolve an address from .bnb TLD const name = await web3name.getDomainName({ address: '0xb5932a6b7d50a966aec6c74c97385412fb497540', queryTldList: ['bnb'], }) // expect: spaceid.bnb ``` ### 4. Batch resolve addresses You need to provide your target chain client and then provide optional parameters in the method. The method returns a list containing the address and its corresponding domain. ```jsx const res = await web3Name.batchGetDomainNameByTld({ addressList: ['0x2886d6792503e04b19640c1f1430d23219af177f', '0xb5932a6b7d50a966aec6c74c97385412fb497540'], queryTld: 'bnb', }) // expect: [{address: '0x2886d6792503e04b19640c1f1430d23219af177f', domain: 'goodh.bnb'}, {address: '0xb5932a6b7d50a966aec6c74c97385412fb497540', domain: 'spaceid.bnb'}] const res = await web3Name.batchGetDomainNameByChainId({ addressList: ['0x77777775b611f0f3d90ccb69ef425a62b35afa7c', '0x3506fbe85e19bf025b228ec58f143ba342c3c608'], queryChainId: 42_161, }) // expect: [{address: '0x77777775b611f0f3d90ccb69ef425a62b35afa7c', domain: 'megantrhopus.arb'}, {address: '0x3506fbe85e19bf025b228ec58f143ba342c3c608', domain: 'idgue.arb'}] ``` ### 5. Record Domain text records can be fetched by providing domain name and the key. For example, the avatar record of `spaceid.bnb` is returned from this method given key name `avatar`: ```jsx const record = await sid.getDomainRecord({ name: 'spaceid.bnb', key: 'avatar' }) ``` ### 6. Metadata Domain metadata can be fetched by SDK directly. ```jsx // requesting const metadata = await web3Name.getMetadata({ name: 'public.gno' }) ``` ## Payment ID Domains Support Web3 Name SDK also supports the Payment ID domains (using *@tld* format) identifiers that map to addresses across multiple networks. It can simplify transactions by allowing users to send funds to easy-to-remember names. ```typescript const address = await web3name.getAddress('jerry@binance') const ethereumAddress = await web3name.getAddress('jerry@binance', { chainId: 1 }) // Returns the EVM address (chain ID 1) 0xa8aa200ce9dfe97deadd7cc3f197c6d8c242f2ee associated with the PaymentID domain ``` **Chain ID Table for PaymentID Resolution** When resolving PaymentID domains, you can specify a chainId parameter to get addresses for specific blockchains: | Type | ID | | ------- | -- | | Bitcoin | 0 | | EVM | 1 | | Solana | 2 | | Tron | 3 | | Aptos | 4 | | Sui | 5 | ```typescript // Example: Get Bitcoin address from PaymentID domain const bitcoinAddress = await web3name.getAddress('username@paymentid', { chainId: 0 }) // Example: Get Solana address from PaymentID domain const solanaAddress = await web3name.getAddress('username@paymentid', { chainId: 2 }) ``` ## ## Non-EVM name services As an all-in-one domain name SDK, non-EVM web3 domain name services are also included. Now we support SNS (Solana Name Service, .sol), Sei Name Service (.sei) and Injective Name Service (.inj). ### 1. Solana Name Service (.sol) Install additional corresponding dependencies for the Solana environment: ```jsx npm install @solana/web3.js@^1.75.0 @bonfida/spl-name-service@^3.0.10 ``` Create client and query domains: ```jsx import { createSolName } from '@web3-name-sdk/core/solName' const web3Name = createSolName() const domain = await web3Name.getDomainName({ address: 'HKKp49qGWXd639QsuH7JiLijfVW5UtCVY4s1n2HANwEA', }) // expect: bonfida.sol ``` ### 2. Sei Name Service (.sei) Install additional corresponding dependencies for the Sei environment: ```jsx npm install @sei-js/core@^3.1.0 @siddomains/sei-sidjs@^0.0.4 ``` Create client and query domains: <pre class="language-jsx"><code class="lang-jsx">import { createSeiName } from '@web3-name-sdk/core/seiName' <strong>const web3Name = createSeiName() </strong>const domain = await web3Name.getDomainName({ address: 'sei1tmew60aj394kdfff0t54lfaelu3p8j8lz93pmf', }) // expect: allen.sei </code></pre> ### 3. Injective Name Service (.inj) Install additional corresponding dependencies for the Injective environment: ```jsx npm install @siddomains/injective-sidjs@0.0.2-beta @injectivelabs/networks@1.14.6 @injectivelabs/ts-types@1.14.6 ``` Create client and query domains: ```jsx import { createInjName } from '@web3-name-sdk/core/injName' const web3Name = createInjName() const domain = await web3Name.getDomainName({ address: 'inj10zvhv2a2mam8w7lhy96zgg2v8d800xcs7hf2tf', }) // expect: testtest.inj ``` **Note: Next.js Configuration for INJ and SEI Name Services** When using INJ or SEI name services with Next.js, you'll need additional webpack configuration to handle dynamic imports and polyfills. Due to the complexity of these dependencies, extra configuration is required. Required dependencies: ```bash npm install crypto-browserify stream-browserify buffer babel-loader @babel/preset-env @babel/plugin-transform-private-methods @babel/plugin-transform-private-property-in-object @babel/plugin-transform-runtime ``` View the complete Next.js configuration example: [next.config.example.js](https://github.com/Space-ID/web3-name-sdk/blob/main/next.config.example.js) ## ## Use your own RPC We are using popular public RPC services by default to make it easier to use. But in some cases developers may prefer to use arbitrary RPC, so we provide optional parameter `rpcUrl` for each function that allows developers to use their own RPC to make requests. For example, you can put custom rpcUrl as a parameter in `getAddress` function. ```typescript // Use custom RPC url (https://arb1.arbitrum.io/rpc) const address = await web3name.getAddress('registry.arb', { rpcUrl: 'https://arb1.arbitrum.io/rpc', }) // expect: '0x8d27d6235d9d8EFc9Eef0505e745dB67D5cD2918' ``` For other functions, it's also possible to have a custom `rpcUrl` in the request. ```typescript // Use custom RPC url (https://arb1.arbitrum.io/rpc) const address = await web3name.getMetaData('registry.arb', { rpcUrl: 'https://arb1.arbitrum.io/rpc', }) // expect: '0x8d27d6235d9d8EFc9Eef0505e745dB67D5cD2918' ``` #### Request Timeout Control The SDK provides timeout control for all network requests. You can set timeouts in two ways: **1. Global Timeout** Set a global timeout when creating the client: ```typescript // Set a 5-second timeout for all requests const web3Name = createWeb3Name({ timeout: 5000 }) const solName = createSolName({ timeout: 5000 }) const seiName = createSeiName({ timeout: 5000 }) const injName = createInjName({ timeout: 5000 }) ``` **2. Function Request Timeout** Override the global timeout for specific requests: ```typescript // Set a 10-second timeout for this specific request const address = await web3name.getAddress('vitalik.eth', { timeout: 10000 }) // Timeout can be combined with other options const address = await web3name.
프로젝트로 돌아가기