Ethereum Name Service 백서

Ethereum Name Service

원문

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

wer many domains in the future, however since the retrieval mechanism uses wildcard + offchain resolver, there is no standardised way to retrieve important metadata information such as which L2/offchain database the records are stored on and where JSON RPC endpoint is to find event log information. ### Motivation With EIP-3668 subdomains already starting to see wide adoption, it is important that there is a standardised way to discover and access metadata about offchain names. This ENSIP allows third-party indexing services to listen to the `MetadataChanged` event to automatically discover and index metadata from different chains and smart contracts, without relying on centralised RPC endpoint repositories. ### Specification Compliant resolvers MUST implement the following interface: ```solidity // To be included in // https://github.com/ensdomains/ens-contracts/blob/staging/contracts/resolvers/Resolver.sol interface IOffchainResolverMetadataProvider { /** * @dev Returns metadata for discovering the location of offchain name data * @param name DNS-encoded name to query * @return rpcURLs The JSON RPC endpoint for querying offchain data (optional, may be empty array) * @return chainId The chain ID where the data is stored (format for non-EVM systems to be determined) * @return baseRegistry The base registry address on the target chain that emits events (optional, may be zero address) */ function metadata(bytes calldata name) external view returns ( string[] memory rpcURLs, uint256 chainId, address baseRegistry ); event MetadataChanged( bytes name, // DNS-encoded name string[] rpcURLs, // JSON RPC endpoint (optional, may be empty array) uint256 chainId, // Chain identifier (format for non-EVM systems to be determined) address baseRegistry // Base registry address (optional, may be zero address) ); } ``` **Requirements:** * `name` must be provided to call `metadata` function. When indexing `MetadataChanged` event, indexers MUST apply the `name` to all names that have the suffixes of the `name`. * `chainId` must be provided. For EVM-compatible chains, `chainId` SHOULD match the chain's EIP-155 identifier. A chainId of 0 means a non-EVM chain or off-chain database. * `rpcURLs` is optional and may be an empty array. * `baseRegistry` is optional and may be the zero address. If a non-zero address is specified, events will be emitted from this address. The interface of this contract is yet to be determined. #### metadata function The metadata function allows resolvers to dynamically provide information about where offchain data for a given name can be queried. This function returns the same information as would be emitted in a MetadataChanged event: the JSON RPC endpoint URLs, the chain ID where the data resides, and the base registry address on the target chain. #### MetadataChanged Event The MetadataChanged event emits the same information the `metadata` function returns so that indexers can subscribe to the event as the details change rather than periodically querying the function. **Key Terminology:** * **registry** = A contract that manages name ownership and hierarchical relationships for a set of subnames. The base registry manages top-level domains (also known as root registry within the v2 contract), while subregistries manage names under a specific parent * **subregistry** = A registry contract that manages subnames under a parent name. Linked from a parent registry via SubregistryUpdate events * **registry id/tokenId** = The unique identifier for a name NFT, derived from the labelhash and version id that increments every time the permission of the name changes effectively invalidating any permissions or approvals tied to the old token ID. * **EAC(Enhanced Access Control)** = a general-purpose access control base class. `resource` is a unique key to manage the resource which changes every time `tokenId` changes. For more detail, read [the namechain README](https://github.com/ensdomains/namechain/tree/main/contracts#access-control). EAC may not be the only way to manage access control and other events may be added in future. * **node** = In v1, node is a unique identifier of the name derived by a `namehash` logic. In ENS v2, `node` is a placeholder node for compatibility with standard resolver behavior and always set to 0. The full ENS name attached to the resolver needs to be reconstructed by traversing registry hierarchy set by `SubregistryUpdate`. #### rpcUrls Events `rpcUrls` url endpoint emits the following jsonrpc events when chainId is not `0`. When chainId is `0` it may emit custom events yet to be determined. ##### Registry Events ```solidity // Emitted when a new subname is registered. // A subname without expiration should set type(uint256).max // Context can attach any arbitrary data, such as resource id to keep track of EAC event NameRegistered( uint256 indexed tokenId, string label, uint64 expiration, address registeredBy, uint256 context ); // Emitted when a new token id is generated event TokenRegenerated( uint256 oldTokenId, uint256 newTokenId, uint256 context ); // Standard ERC1155 transfer event for name ownership changes event TransferSingle( address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value // must always be 1 ); // Standard ERC1155 transfer event for multiple name ownership changes event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); // Emitted when a name is renewed event ExpiryUpdated( uint256 indexed tokenId, uint64 newExpiration ); // Emitted when subregistry is updated event SubregistryUpdated( uint256 indexed id, address subregistry ); // Emitted when resolver is updated event ResolverUpdated( uint256 indexed id, address resolver ); ``` ##### Resolver Events ```solidity event AddressChanged( bytes32 indexed node, uint256 coinType, bytes newAddress ); event AddrChanged( bytes32 indexed node, address a ); event TextChanged( bytes32 indexed node, string indexed indexedKey, string key, string value ); event ContenthashChanged( bytes32 indexed node, bytes hash ); event NameChanged( bytes32 indexed node, string name) ; ``` ### Rationale This ENSIP addresses a key limitation of EIP-3668: while it enables offchain data retrieval, it provides no standardized way for third parties to discover where that data lives or how to index it. By providing metadata at the resolver level, this ENSIP enables: 1. **Automatic indexer discovery** - Indexers can discover new L2/offchain data sources by listening to events, without requiring manual configuration or centralized registries of RPC endpoints. 2. **Flexible data sources** - The optional nature of `rpcURLs` and `baseRegistry` accommodates different deployment patterns: from fully decentralized L2 registries that emit events, to custom databases that may emit APIs yet to be determined that are more suitable to index non-EVM chains or offchain database names. 3. **Future extensibility** - By requiring `chainId` but leaving the non-EVM format undefined, this ENSIP establishes the pattern while remaining open to future non-EVM integrations. ### Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). import { EnsipHeader } from "../../components/EnsipHeader"; ## ENSIP-17: Gasless DNS Resolution <EnsipHeader authors={["nick.eth"]} created="February 9, 2024" status="final" /> ### Abstract This standard describes a mechanism by which users can specify ENS resolvers and resolution data as DNS TXT records, resulting in a system where DNS names are resolvable in ENS with no onchain actions required. ### Motivation ENS has had DNS integration for some time, facilitated by the ability to prove the contents of a DNS TXT record onchain, and thereby claim the corresponding name in the ENS registry. This has several shortcomings, the most notable of which is the high transaction fees associated, as verifying a DNSSEC proof often costs in excess of 1,000,000 gas. Wildcard resolution (ENSIP-10) and CCIP-Read (EIP-3668) now permit a new approach, by which DNSSEC proofs are fetched and verified at resolution time instead. This permits users to enable ENS resolution of their names simply by setting a TXT record on their DNS name and enabling DNSSEC. ### Specification A new resolver, `OffchainDNSResolver`, is deployed and set as the resolver for all DNS TLDs; this resolver will be consulted whenever resolution is attempted for a nonexistent subdomain of these TLDs. The resolver then initiates a CCIP-Read request to a gateway which fetches and returns DNSSEC proofs for TXT records on that name. In the CCIP-Read callback function, the resolver verifies the DNSSEC proofs using an updated version of the DNSSEC oracle, and if they verify correctly, decodes the address of a resolver and optional extra data from the TXT record. The resolution request is then completed by invoking the resolver, optionally passing the extra data contained in the TXT record to enable it to vary its response dynamically. #### TXT record format Compliant TXT records MUST adhere to this format: ```ts ENS1 <resolver-name-or-address> [context] ``` Where: * `ENS1` is a fixed string, identifying this TXT record as a gasless ENS record. * `resolver-name-or-address` is either the 0x-prefixed hexadecimal address or the ENS name of the resolver to use to resolve queries for this name. If an ENS name is supplied, the name MUST be resolvable without using ENSIP-10 - meaning that the name MUST have a resolver set in the ENS registry, and the resolver MUST implement the `addr` function, which MUST NOT initiate a CCIP-Read request using `OffchainData`. * `context` is arbitrary additional data that may be passed to the resolver to complete the request (see below). #### Resolution Process ##### Summary The `OffchainDNSResolver` decodes or resolves the address of the resolver to use from `resolver-name-or-address`, and calls whichever of `IExtendedDNSResolver.resolve`, `IExtendedResolver.resolve` or a legacy resolution function is first supported. If either `resolve` function is invoked, nested CCIP-Read requests are handled correctly. ##### Detailed Description `OffchainDNSResolver` implements `resolve` by initiating a CCIP-Read request, reverting with `OffchainLookup` and specifying the address of a CCIP-Read gateway capable of fetching and returning DNSSEC signed DNS records. The callback function for the CCIP-Read request implements the following logic: 1. Use the DNSSEC oracle to verify the returned RRSet. If verification fails, revert. 2. For each record in the returned RRSet: 1. Check if the RR name matches the name being resolved and the record type is TXT. If either check fails, continue to the next record. 2. Check if the first field in the TXT record starts with `ENS1 `. If not, continue to the next record. 3. Decode `resolver-name-or-address` and `context` from the text record. 4. If `resolver-name-or-address` contains a `.` character: 1. Compute the namehash of `resolver-name-or-address`. 2. Call `resolver(bytes32)` on the registry, passing in the namehash. If the registry returns `0`, continue to the next TXT record. 3. Call `addr(bytes32)` on the resolver address returned in step ii. If the resolver returns `0`, continue to the next TXT record. 4. Treat the returned address as the resolver address to use in subsequent steps. 5. If `resolver-name-or-address` does not contain a '.' character, treat it as a hexadecimal address and decode it. Treat the decoded address as the resolver address to use in subsequent steps. 6. Using ERC165, check if the returned resolver supports `IExtendedDNSResolver`. If it does, call `resolve(bytes name, bytes query, bytes context)`, passing `context` from the TXT record as the last argument. The call to `resolve` may use CCIP-Read; if it does, reverts will be handled appropriately. Return the result of this call as the result of the initial resolution request and halt. 7. Using ERC165, check if the returned resolver supporst `IExtendedResolver`. If it does, call `resolve(bytes name, bytes query)`. The call to `resolve` may use CCIP-Read; if it does, reverts will be handled appropriately. Return the result of this call as the result of the initial resolution request and halt. 8. Otherwise, call the resolver with calldata equal to the `query` originally supplied to `OffchainDNSResolver.resolve` and return its result as the result of the initial resolution request and halt. This resolution path does NOT support nested CCIP-Read requests. The `IExtendedDNSResolver` interface is defined as follows: ```go interface IExtendedDNSResolver { function resolve( bytes memory name, bytes memory data, bytes memory context ) external view returns (bytes memory); ``` This acts as an extension of `IExtendedResolver` defined in ENSIP-10, providing the additional `context` argument, containing any supplementary data from the TXT record. Note that a TXT record may contain multiple text fields; in this implementation only the first field of each TXT record is considered. TXT record fields are limited to a maximum of 255 bytes each. #### DNSSEC Gateway API The DNSSEC Gateway implements the following API over CCIP-Read: ```go struct RRSetWithSignature { bytes rrset; bytes sig; } interface IDNSGateway { function resolve( bytes memory name, uint16 qtype ) external returns (RRSetWithSignature[] memory); } ``` Where: * `name` is a DNS-encoded name to query. * `qtype` is a DNS QTYPE as defined in RFC1034 - for example, `TXT` = 16. The returned `rrset`s are in the format described in section 5.3.2 of RFC4035: The RRDATA section from the RRSIG without the signature data, followed by a series of canonicalised RR records that the signature applies to. One RRSET is returned for each step in the chain of trust, starting with the DNSKEY RRSET for the DNS root `.`, and ending with the requested RRSET, if it exists. A Solidity DNSSEC implementation for decoding and verifying RRSET data is available at [https://github.com/ensdomains/ens-contracts/blob/staging/contracts/dnssec-oracle/](https://github.com/ensdomains/ens-contracts/blob/staging/contracts/dnssec-oracle/). ### Backwards Compatibility DNS names imported using the existing functionality will continue to function as before, and new names can still be imported using the DNS import functionality. If an imported name exists, it is used to resolve the request, and any TXT records for gasless DNSSEC are ignored. If desired, the owner of the name can set the resolver to `address(0)` to cause resolution to fall back to gasless DNSSEC. ### Security Considerations Gasless DNSSEC relies on a gateway and CCIP-Read to fetch cryptographic proofs of the chain of trust between the DNS root and the desired text record. It uses the same code, and hence has the same trust model, as the DNS import functionality; forging a DNS record would require access to a signing key somewhere in the chain of trust between DNS root and the record in question. Due to the use of a gateway service to generate responses, there is additional risk of unavailability: the gateway could be out of operation, or could choose to selectively refuse to answer (censor) certain queries. ### Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). import { EnsipHeader } from "../../components/EnsipHeader"; ## ENSIP-18: Profile Text Records <EnsipHeader authors={["TateB","raffy.eth","galligan"]} created="August 2, 2023" status="draft" /> ### Abstract This ENSIP which extends [ENSIP-5: Text Records](https://docs.ens.domains/ensip/5) defines a set of text records that should be used for profile information, along with the format that each should have. ### Motivation ENS names have become increasingly popular to use as an identifying profile across the Ethereum ecosystem. Although many apps have started integrating ENS "profiles", the only defined global text record keys are in ENSIP-5. These global keys were defined based on the usecase of ENS names at the time, and were not created with profiles in mind. This specification extends the existing set of global keys, as well as creating a new subset within global keys called "profile keys". ### Specification The Profile Keys are a subset of Global Keys, the newly defined global keys are specified in the "Global Keys" section. #### Profile Keys ##### `alias` **Description:** A display alias **Format:** Any text **Example:** `ENS` **Design Considerations:** This should be displayed near the ENS name, but should not be displayed as a replacement for it and should be below it in the visual hierarchy. You can also choose not to show the alias at all. ##### `theme` **Description:** A user customised theme to use **Format:** An array of comma separated hex colours. Order should be as follows: `<background>,<text>,<accent>,<accentText>,<border>`. Colours can be full or half length hex codes (e.g. `FFFFFF`, or `FFF`). A colour scheme can be incomplete but still valid by skipping a value similar to CSV (e.g. `000000,,F6F6F6,FFFFFF,FFF700`) **Example:** `3889FF,000,F6F6F6,FFFFFF,FFF700` **Design Considerations:** These colours can be used wherever a profile context is used (e.g. more than just the name), but separate colour schemes should never be used together on the same page. The scheme can also be extended to site-wide themability based on the primary name of the connected wallet. Selected accent and text colours should maintain a 4.5:1 contrast ratio against the selected background colour. Contrast ratio should be validated on record submission, as well as retrieval. If on retrieval colours do not meet the required contrast ratio, they should not be used. If the context requires that colours from a specific theme be used (e.g. an app theme), you can use the closest match to a colour in the theme. **Other Notes:** If allowing a user to select a theme that is specific to one vendor (e.g. `com.example`), you should use a vendor specific version of this record e.g. `com.example.theme` ##### `avatar` **Description:** An avatar image **Format:** See [ENSIP-12: Avatar Text Records](ensip-12-avatar-text-records.md) **Example:** See [ENSIP-12: Avatar Text Records](ensip-12-avatar-text-records.md) **Design Considerations:** This should be displayed next to the ENS name wherever possible. The image should be displayed with an aspect ratio of 1:1. If the source doesn't match the target ratio, the image should be cropped from the centre to fill the ratio. The image should not have any visible blank space. ##### `header` **Description:** A header image **Format:** See [ENSIP-12: Avatar Text Records](ensip-12-avatar-text-records.md) **Example:** See [ENSIP-12: Avatar Text Records](ensip-12-avatar-text-records.md) **Design Considerations:** This should be displayed above all other profile content, or not at all. The image should be displayed with an aspect ratio of between 3:1 and 6:1. If the source doesn't match the target ratio, the image should be cropped from the centre to fill the ratio. The image should not have any visible blank space. ##### `email` **Description:** An email that can be used as contact **Format:** Standard email address **Example:** `test@example.com` **Design Considerations:** None. ##### `description` **Description:** A biography **Format:** Any string not exceeding 160 characters in length. **Example:** `Human readable names for Ethereum.` **Design Considerations:** None. ##### `location` **Description:** A location **Format:** Any location, if location is layered should use `, ` for separation (e.g. `Melbourne, Australia`) **Example:** `Melbourne, Australia` **Design Considerations:** This value should not be assumed to be real coord
프로젝트로 돌아가기