Ethereum Name Service 백서

Ethereum Name Service

원문

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

es /// @param signature The signature from the addr /// @return The ENS node hash of the reverse record function setNameForAddrWithSignature( address addr, string calldata name, uint256[] calldata coinTypes, uint256 signatureExpiry, bytes calldata signature ) external returns (bytes32); ``` #### Signatures Signature format for `setNameForAddrWithSignature`: ``` validatorAddress, // the address of the reverse registrar functionSignature, // 0x2023a04c name, // string name value addr, // address to set name for coinTypes, // array of coinTypes wanting to be set signatureExpiry // expiry of the signature, up to 1 hour in the future ``` Signature format for `setNameForOwnableWithSignature`: ``` validatorAddress, // the address of the reverse registrar functionSignature, // 0x975713ad name, // string name value contractAddr, // contract address to set name for owner, // owner address of contract (i.e. the signature being verified) coinTypes, // array of coinTypes wanting to be set signatureExpiry // expiry of the signature, up to 1 hour in the future ``` ### Other Functions :::info The following functions are only available on the ETH Reverse Registrar. ::: #### Claim Address ```solidity function claim(address owner) public returns (bytes32); ``` Claims the caller's address in the reverse registrar, assigning ownership of the reverse record to `owner`. Equivalent to calling `claimWithResolver(owner, 0)`. Doesn't actually set the reverse record. ```solidity function claimWithResolver(address owner, address resolver) public returns (bytes32) ``` Claims the caller's address in the reverse registrar, assigning `ownership` of the reverse record to owner. If `resolver` is nonzero, also updates the record's resolver. After calling this function: * The reverse record for the caller (1234....addr.reverse) is owned by `owner`. * If `resolver` is nonzero, the reverse record for the caller has its resolver set to `resolver`; otherwise it is left unchanged. #### Get Default Resolver ```solidity function defaultResolver() public view returns (address); ``` Returns the address of the resolver contract that the `ReverseRegistrar` uses for `setName`. ### Do's and Dont's Under no situation is it recommended to force a user to change their primary name, nor doing so without clearly notifying the user of what the transaction they are about to execute could modify. Doing so could be seen as hostile or undesired behaviour by end users and might degrade their experience with your app. ## Layer 2 & Offchain Resolution All ENS resolution starts on Ethereum Mainnet (or testnet). However, by leveraging [CCIP Read](/resolvers/ccip-read) and [Wildcard Resolution](/ensip/10), name resolution can be taken cross-chain, offchain, and more. This allows for a lot of flexibility in how you can use your ENS and for storage of your ENS records on your favourite Layer 2, or even offchain. ### ENS on Layer 2 In the resolution process, clients first fetch the resolver associated with the name in the ENS registry on L1. That resolver is responsible for telling the client where to find the data associated with the name such as the addresses, text records, etc. If you want to register and resolve (sub)names from L2, you would write a resolver smart contract that defers resolution to the L2 and ideally verifies that data against the L2's storage proofs posted to L1. This process can be done with the [Unruggable Gateway](https://gateway-docs.unruggable.com/). An example implementation of Layer 2 resolving is: #### linea.eth Linea was the first L2 team to build a trust-minimized ENS subname system. Names are stored on Linea, verified with [storage proofs](https://docs.linea.build/developers/tooling/cross-chain/ccip-read-gateway) on L1, and function as ENS subnames such as [greg.linea.eth](https://app.ens.domains/greg.linea.eth). You can try it out [here](https://names.linea.build/). #### clv.eth Clave is focused on enhancing user experience and security through a mobile wallet that leverages account abstraction and device hardware. Clave accounts come with usernames that are now stored onchain in ZKsync Era, verified with [storage proofs](https://github.com/getclave/zksync-storage-proofs) in L1, and issued as ENS subnames such as [ulas.clv.eth](https://app.ens.domains/ulas.clv.eth). You can read more about the implementation [here](https://blog.getclave.io/introducing-onchain-clave-usernames-with-ens). ### Primary Names on Layer 2 The process of setting primary names from L2 is under active development. This doc will be updated as more information becomes available. ### Offchain Resolution Moving resolution processes offchain offers numerous advantages, including efficiency gains and reduced congestion on the main blockchain; however, it also introduces trade-offs in terms of trust, as it necessitates reliance on external systems. Depending on the implementation, names could be stored in a database or be ephemeral. Advantages of offchain name storage include gaslessness and instant updates. If this sounds appealing consider [writing an Offchain Resolver](/resolvers/ccip-read). Popular implementations of offchain names include but are not limited to: #### cb.id Coinbase Wallet is one of the largest mobile wallets issuing free ENS subnames to their users. These names are stored offchain on coinbase servers, and can be registered from the Coinbase Wallet App or Browser Extension. An example of a cb.id is [jesse.cb.id](https://app.ens.domains/jesse.cb.id). #### uni.eth Uniswap Wallet is another popular mobile wallet that issues free ENS subnames to their users. You can read more about the Uniswap Wallet ENS integration [here](https://blog.uniswap.org/introducing-uni-eth-your-unique-web3-username). An example of a uni.eth is [chase.uni.eth](https://app.ens.domains/chase.uni.eth). import { ContractDeployments } from '../../components/ContractDeployments' import { EmbedLink } from '../../components/EmbedLink' import { Card } from '../../components/ui/Card' import { ENSv2Deployments } from '../../components/ensv2/ENSv2Deployments' ## Deployments :::note This page contains information that is only relevant to developers who would like to interact with the contract manually. Most libraries will handle this for you. ::: ENS is multichain (read more [here](/web/multichain)) and can be used in any application. In addition to being able to query many address formats and record types, data can be stored [practically anywhere](/learn/ccip-read). However, resolution needs to start somewhere, so the entrypoint for resolution is Ethereum Mainnet, alongside the most popular testnets. <Card className="flex justify-center gap-4"> <span>Ethereum Mainnet</span> <div>→</div> <div className="flex flex-col"> <span>Base</span> <span>Arbitrum</span> <span>Offchain</span> <span>...</span> </div> </Card> ### Deployments Below you will find an abbreviated list of our latest contract deployments. The source of truth for ENS contract deployments is the [ensdomains/ens-contracts](https://github.com/ensdomains/ens-contracts/tree/staging/deployments) repository. #### Mainnet Interact with ENS on Ethereum Mainnet via [app.ens.domains](https://app.ens.domains). <ContractDeployments chain="mainnet" /> #### Sepolia (ENSv2) Sepolia runs the [ENSv2](/ensv2/overview) contracts: the [Universal Resolver](/ensv2/universal-resolver-v2) and the ENS apps for Sepolia resolve through this deployment. Interact with it via the [ENS App](https://app.ens.dev) and the [ENS Explorer](https://explorer.ens.dev). <ENSv2Deployments chain="sepolia" /> #### Sepolia (Legacy) :::warning These ENSv1 contracts still exist on Sepolia but are no longer in use: the Universal Resolver and the ENS apps for Sepolia are linked against the ENSv2 deployment above. ::: <ContractDeployments chain="sepolia" /> #### Holesky :::warning Holesky testnet support is being phased out. Please migrate your workflows to Sepolia. ::: Interact with ENS on the Holesky testnet via [holesky.app.ens.domains](https://holesky.app.ens.domains). <ContractDeployments chain="holesky" /> ### But what about multichain? While the core ENS protocol lives on Ethereum Mainnet, it can be used to resolve data for any chain! <EmbedLink title="Offchain / L2 Resolvers" description="Learn more about ENS on Layer 2 and offchain solutions" href="/resolvers/ccip-read" /> import { DNSGrid } from '../../components/DNSGrid' import { DNSUsageExamples } from '../../components/DNSUsageExamples' import { EmbedLink } from '../../components/EmbedLink' ## DNS on ENS \[ENS supports DNS names, allowing users to import DNS names into ENS.] The Ethereum Name Service is so much more than just `.eth` names. It is a general-purpose naming system that can be used for any kind of name. This includes DNS names. DNS functionality was originally introduced in [ENSIP-6](/ensip/6). ### Importing a DNS name There are currently two ways of importing a DNS name into ENS. Both methods require you enable DNSSEC on your domain, and setup a TXT record. This record is then verified using smart contracts on the Ethereum blockchain. To import a name, simply visit the [ENS Manager](https://ens.app), type in your name, and click "Import DNS". You will walked through setting up your DNS records. Additionally you can read more about the records and specifications here: <EmbedLink title="Importing a DNS name Gaslessly" href="/registry/dns#gasless-import" /> ### Why DNS on ENS? ENS aims to extend the existing functionality of the DNS system. This also means that existing DNS names (such as `.com`, `.org`, or `.xyz`) should be able to leverage the benefits of the ENS resolution process. <DNSGrid /> ### DNS Names in the wild DNS names are widely used and many users may already have one without even realizing it. Some major platforms that issue subdomains of their DNS names include: <DNSUsageExamples /> ### Top-Level Domains In addition to allowing any DNSSEC enabled name to be imported, ENS also allows existing DNS TLDs to take control of their smart-contract resolution process. Resulting in even more seamless integration with the DNS system. A list of all supported TLDs can be found [here](/dns/tlds) import { DNSGrid } from '../../components/DNSGrid' import { EmbedLink } from '../../components/EmbedLink' import { EnsProfile } from '../../components/EnsProfile' import { Card } from '../../components/ui/Card' ## What is the Ethereum Name Service? The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain. <Card className="flex flex-col items-center justify-center gap-2 sm:flex-row"> <EnsProfile name="nick.eth" /> <EnsProfile name="jefflau.eth" /> </Card> ENS maps human-readable names like 'alice.eth' to machine-readable identifiers such as Ethereum addresses, other cryptocurrency addresses, content hashes, metadata, and more. ENS also supports 'reverse resolution', making it possible to associate metadata such as primary names or interface descriptions with Ethereum addresses. Top-Level Domains (TLDs), like `.eth` and `.test`, are owned by smart contracts called [registrars](/registry/eth), which specify rules governing the allocation of their names. Enabling seamless interoperability with the DNS (Domain Name System). ### ETH Registrar The [ETH Registrar](/registry/eth) is the registrar for the `.eth` TLD, it allows for trustless decentralized names to be issued as tokens on the Ethereum Blockchain. Registration is done through smart contracts, and name ownership is secured by the Ethereum blockchain. ### DNS + ENS ENS has similar goals to DNS, the existing Internet's Domain Name Service, and aims to extend its capability. ENS also supports importing DNS names through the use of DNSSEC. Allowing you to take your `.com`, `.xyz`, or `.art` (and more) into the ENS ecosystem. Read more about DNSSEC names [on this page](/learn/dns). <DNSGrid /> ### Subnames <Card className="flex items-center justify-center text-xl"> <div className="text-right font-bold"> {['root', 'registrar', 'controller', 'resolver', 'registry'].map( (subname, i) => ( <div className={ ['opacity-20', 'opacity-50', '', 'opacity-50', 'opacity-20'][i] } key={subname} > {subname} </div> ) )} </div> <div className="text-blue font-bold">.ens.eth</div> </Card> Because of the hierarchical nature of ENS, anyone who owns a domain at any level can take control of resolution. Users can create subdomains manually, or take matters into their own hands and write their own resolution logic. For instance, if Alice owns 'alice.eth', she can create 'pay.alice.eth' and configure it as she wishes. Or, use a [Custom Resolver](/resolvers/quickstart), and programmatically issue subdomains, for example in an App, Community, or DAO. <EmbedLink href="/web/subdomains" title="Issuing Subdomains" description="Learn how to issue subdomains on ENS." /> ### ENS Manager App You can try ENS out for yourself now by using the [ENS Manager App](https://ens.app/), or by using any of the many ENS enabled applications on [our homepage](https://ens.domains/). <EmbedLink href="https://ens.app" target="_blank" title="ENS Manager App" description="The ENS Manager App is a web-based interface for managing ENS names." /> import { EnsProfile } from '../../components/EnsProfile' import { Card } from '../../components/ui/Card' ## Resolution \[The ENS Resolution Process] :::note This document aims to provide a brief overview of how resolution works, to read more about resolution checkout the [dedicated Resolution Section](/resolution). ::: One of the major parts of the ENS protocol is the resolution process. The Resolution process at its core is the process of converting a human-readable name to a machine-readable address. Though there is a lot of smart contract magic under the hood, the ENS system consists of two main paths: [Forward Resolution](#forward-resolution), used to go from name to address (and load other extra data), and [Reverse Resolution](#reverse-resolution), used to go from address to name. ### Forward Resolution Forwards resolution is the process of going **from name to address**. As well as to load the records associated to a name. These records include but are not limited to **discord**, **twitter**, **github**, **email**, **timezone**, and more. {/* TODO: Turn this into a component and fetch live data */} <Card> <div className="flex flex-col items-center justify-center gap-2 sm:flex-row sm:gap-6"> <EnsProfile name="ricmoo.eth" hideAddress /> <span className="hidden sm:block">➡️</span> <span className="block sm:hidden">⬇️</span> <Card className="w-64 rounded-md p-4"> <div> <span className="font-extrabold">ETH Address:</span> 0x5555...3dCa </div> <div> <span className="font-extrabold">BTC Address:</span> 1RicMoo...Jyn </div> <div> <span className="font-extrabold">Twitter:</span> @ricmoo </div> <div> <span className="font-extrabold">Github:</span> @ricmoo </div> <span className="font-extrabold">...</span> </Card> </div> </Card> Implementing forwards resolution in a dApp can be as simple as using a single line of code! To learn more about how to implement forwards resolution, check out the [Address Resolution](/web/resolution) documentation. ### Reverse Resolution Reverse resolution is the process of going **from address to name**. This is a crucial part of the ENS system, as it allows for any address, to be resolved into a human readable name. Instead of pages filled with addresses, you can now show the names of the people behind the addresses. <Card className="flex items-center justify-center gap-2"> <span className="font-medium">0x225...c3B5</span> <span>to</span> <EnsProfile name="nick.eth" hideAddress /> </Card> Implementing reverse resolution in a dApp can be as simple as using a single line of code! To learn more about how to implement reverse resolution, check out the [Address Resolution](/web/reverse) documentation. import { FrenCallout } from '../../components/ensv2/FrenCallout' ## DNS Name Resolution ENSv2 supports resolving traditional DNS domain names (like `.com`, `.xyz`) through the ENS protocol, provided the domain has DNSSEC enabled. This builds on the [DNS on ENS](/learn/dns) functionality from ENSv1, replacing the single `OffchainDNSResolver` ([ENSIP-17](/ensip/17)) with a set of three specialized contracts. Users don't interact with these contracts directly. The [Universal Resolver V2](/ensv2/universal-resolver-v2) handles the entire flow transparently. This page explains what happens internally and how to configure DNS records for ENS resolution. ### How It Works <FrenCallout fren="kuzco" variant="warning" title="Watch out!"> ENSv2's DNS resolution fetches DNSSEC proofs off-chain via [CCIP-Read](/resolvers/ccip-read) and verifies them on-chain. The on-chain DNSSEC proof submission used by the v1 [DNS Registrar](/registry/dns) for claiming DNS names remains on v1 infrastructure at launch. </FrenCallout> When the Universal Resolver encounters a DNS name (e.g., `example.com`), it finds the **DNSTLDResolver** set as the resolver for that TLD on the root registry. The DNSTLDResolver then follows a multi-step resolution strategy: 1. **Check ENSv1**: look for an existing resolver in the ENSv1 registry. If one exists (and it's not the v1 DNS TLD resolver or the DNSTLDResolver itself), delegate to it directly. This preserves backward compatibility. 2. **Query DNSSEC**: initiate a [CCIP-Read](/resolvers/ccip-read) request to fetch DNSSEC-signed TXT records for the domain. 3. **Parse the TXT record**: find the first TXT record starting with `ENS1` that yields a valid resolver address, and extract the resolver address and context. 4. **Delegate to the parsed resolver**: forward the request to the resolver contract specified in the TXT record. ENS ships two standard resolver implementations: the **DNSAliasResolver** (for name rewriting) and the **DNSTXTResolver** (for inline record data), but any contract implementing `IExtendedDNSResolver` can be used. ```mermaid flowchart LR UR["Universal Resolver"] --> TLD["DNSTLDResolver"] TLD --> V1{"Usable v1<br/>resolver?"} V1 -- yes --> Legacy["Delegate to<br/>v1 resolver"] V1 -- no --> DNSSEC["Fetch & parse<br/>ENS1 TXT record<br/>(CCIP-Read)"] DNSSEC -- "name rewriting" --> Alias["DNSAliasResolver"] DNSSEC -- "inline records" --> TXT["DNSTXTResolver"] ``` ### TXT Record Formats To enable ENS resolution for a DNS domain, add a TXT record with the prefix `ENS1`: ``` ENS1 <resolver-address-or-name> <context> ``` The `<resolver-address-or-name>` can be either a hex address (`0x1234...`) or an ENS name that resolves to the resolver contract. The `<context>` depends on which resolver is used. #### Inline Records (DNSTXTResolver) Set the resolver to the DNSTXTResolver address and encode records directly in the context. Multiple records are separated by spaces: ``` ENS1 dnstxt.ens.eth a[60]=0x1234... t[avatar]=https://example.com/pic.png ``` Supported record formats: | Prefix | Record type | Example | | --------------- | ---------------------------------------------------------- | ----------------------- | | `a[60]` | Ethereum address ([ENSIP-9](/ensip/9)) | `a[60]=0x1234...` | | `a[e0]` | Default EVM address, any chain ([ENSIP-19](/ensip/19)) | `a[e0]=0x1234...` | | `a[e<chainId>]` | EVM chain address by chain ID ([ENSIP-19](/ensip/19)) | `a[e8453]=0x5678...` | | `a[<coinType>]` | Non-EVM address by SLIP-44 coin type ([ENSIP-9](/ensip/9)) | `a[0]=bc1qar0...` | | `t[key]` | Text record | `t[avatar]=https://...` | | `c` | Content hash ([ENSIP-7](/ensip/7)) | `c=0xe301...` | | `d[key]` | Data record | `d[mykey]=0x1234...` | | `xy` | Public key (x and y concatenated, 64 bytes) | `xy=0x...` | <FrenCallout fren="peanut" variant="note" title="Values with spaces"> Values are separated by spaces. To i
프로젝트로 돌아가기