Ethereum Name Service 백서

Ethereum Name Service

원문

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

tes calldata name, bytes calldata data ) external view returns (bytes memory result, address resolver); /// @notice Performs ENS primary name resolution for the supplied address and coin type, as specified in ENSIP-19. /// Caller should enable EIP-3668. /// @param lookupAddress The byte-encoded address to resolve. /// @param coinType The coin type of the address to resolve. /// @return primary The verified primary name, or null if not set. /// @return resolver The resolver that was used to resolve the primary name. /// @return reverseResolver The resolver that was used to resolve the reverse name. function reverse( bytes calldata lookupAddress, uint256 coinType ) external view returns ( string memory primary, address resolver, address reverseResolver ); } ``` #### findResolver This function performs onchain [registry traversal](/ensip/1#registry-specification) of a DNS-encoded `name`. It returns the first non-null `resolver` address, the namehash of `name` as `node`, and the `resolverOffset` into `name` that corresponds to the resolver. If no resolver is found, `resolver` is null. `findResolver()` does not perform any validity checks on the resolver and simply returns the value in the registry. The resolver may not be a contract or a resolver. ##### Pseudocode Example ```js name = dnsEncode("sub.nick.eth") = "\x03sub\x04nick\x03eth\x00" 1. registry[namehash("\x03sub\x04nick\x03eth\x00")] = null ❌️ 2. registry[namehash(/*-4-*/"\x04nick\x03eth\x00")] = 0x2222222222222222222222222222222222222222 ✅️ // "nick.eth" 3. registry[namehash(/*-----9-----*/"\x03eth\x00")] = ... // not 4. registry[namehash(/*---------13-------*/"\x00")] = ... // checked findResolver(name) resolver = registry[namehash("\x04nick\x03eth\x00")] = 0x2222222222222222222222222222222222222222 node = namehash("\x03sub\x04nick\x03eth\x00") = 0xe3d81fd7b7e26b124642b4f160ea05f65a28ecfac48ab767c02530f7865e1c4c offset = 4 // name.slice(4) = "\x04nick\x03eth\x00" = dnsEncode("nick.eth") ``` #### resolve This function performs forward resolution using the `resolver` found by [`findResolver()`](#findresolver). It provides a standard interface for interacting [ENSIP-1](./1) and [ENSIP-10](./10) resolvers for onchain and offchain resolution. Provided a DNS-encoded `name` and ABI-encoded `data`, it returns the ABI-encoded resolver `result` and the valid `resolver` address. UR automatically handles wrapping calldata and unwrapping responses when interacting with an [`IExtendedResolver`](./10#pseudocode) and safely interacts with contracts deployed before [EIP-140: REVERT Instruction](https://eips.ethereum.org/EIPS/eip-140). ##### Resolution Errors * If no resolver was found, reverts `ResolverNotFound`. * If the resolver was not a contract, reverts `ResolverNotContract`. * If [EIP-3668](https://eips.ethereum.org/EIPS/eip-3668) (CCIP-Read) was required and it was not handled by the client, reverts `OffchainLookup`. * If CCIP-Read was handled but the `OffchainLookup` failed, reverts `HTTPError`. ##### Resolver Errors * If the called function was not implemented, reverts `UnsupportedResolverProfile`. * If the called function reverted, reverts `ResolverError`. ##### Smart Multicall Traditionally, resolvers have been written to answer direct profile requests, eg. `addr()` returns one address. To perform multiple requests, the caller must perform multiple independent requests (in sequence, parallel, or via batched RPC) or utilize an [external multicall contract](https://www.multicall3.com/) which does not support CCIP-Read. UR supports multicall with CCIP-Read and [`eth.ens.resolver.extended.multicall`](./22#ethensresolverextendedmulticall--0x96b62db8) feature. To perform multiple calls: ```solidity bytes[] memory calls = new bytes[](3); calls[0] = abi.encodeCall(IAddrResolver.addr, (node)); calls[1] = abi.encodeCall(ITextResolver.text, (node, "avatar")); calls[2] = hex"00000000"; // invalid selector ``` ```ts const calls = [ encodeFunctionData({ functionName: "addr", args: [node] }), encodeFunctionData({ functionName: "text", args: [node, "avatar"] }), "0x00000000", // invalid selector ]; ``` Using the following [interface](https://github.com/ensdomains/ens-contracts/blob/staging/contracts/resolvers/IMulticallable.sol): ```solidity interface IMulticallable { function multicall(bytes[] calldata data) external view returns (bytes[] memory); } ``` Encode the calls, invoke [`resolve()`](#resolve) normally, and decode the result: ```solidity bytes memory data = abi.encodeCall(IMulticallable.multicall, (calls)); (bytes memory result, address resolver) = UR.resolve(name, data); // note: could revert OffchainLookup bytes[] memory results = abi.decode(result, (bytes)); ``` ```ts const data = encodeFunctionData({ functionName: "multicall", args: [calls] }); const [result, resolver] = await UR.read.resolve(name, data); const results = decodeFunctionResult({ functionName: "multicall", data: result }); ``` The same [resolution errors](#resolution-errors) apply but [resolver errors](#resolver-errors) are handled differently. The call **always succeeds** and decodes into an array of results. The number of calls is always equal to the number of results. If `results[i]` is not multiple of 32 bytes, it is an ABI-encoded error for the corresponding `calls[i]`. ```solidity address ethAddress = abi.decode(results[0], (address)); string avatar = abi.decode(results[1], (string)); // results[2] == abi.encodeWithSelector(UnsupportedResolverProfile.selector, bytes4(0x00000000)); ``` ```ts const ethAddress = decodeFunctionResult({ functionName: "addr", data: results[0] }); const avatar = decodeFunctionResult({ functionName: "text", data: results[1] }); const error = decodeErrorResult({ data: result[2] }); // { errorName: "UnsupportedResolverProfile", args: ["0x00000000"] } ``` #### reverse This function performs multichain primary name resolution according to [ENSIP-19](./19). Provided a [byte-encoded](./9) `lookupAddress` and desired `coinType`, it returns the verified primary `name` and the addresses of forward `resolver` and `reverseResolver`. UR supports CCIP-Read during the forward and reverse phases. If the primary `name` is [unnormalized](./15), eg. `normalize("Nick.eth") != "Nick.eth"`, then `name` and `resolver` are [invalid](/ensip/19#reverse-resolution). * If [reverse resolution](./19#reverse-resolution) of the reverse name was not successful, reverts a [`resolve()` error](#resolution-errors). * If the resolved primary name was null, returns `("", address(0), <reverseResolver>)`. * If [forward resolution](./19#forward-resolution) of the primary name was not successful, also reverts a [`resolve()` error](#resolution-errors). * If the resolved address of `coinType` doesn't equal the `lookupAddress`, reverts `ReverseAddressMismatch`. `reverse()` is effectively (2) sequential `resolve()` calls. ##### Pseudocode Example ```js // valid primary name: vitalik.eth on mainnet reverse("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", 60) 1. reverse: resolve("d8da6bf26964af9d7eed9e03e53415d37aa96045.addr.reverse", name()) = "vitalik.eth" 2. forward: resolve("vitalik.eth", addr(60)) = 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 3. 0xd8dA == 0xd8dA => ✅️ "vitalik.eth" // invalid primary name: imposter vitalik.eth reverse("0x314159265dD8dbb310642f98f50C066173C1259b", 60) 1. reverse: resolve("314159265dd8dbb310642f98f50c066173c1259b.addr.reverse", name()) = "vitalik.eth" 2. forward: resolve("vitalik.eth", addr(60)) = 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 3. 0x3141 != 0xd8d => ❌️ ReverseAddressMismatch() // no primary name: burn address on Base mainnet resolve("0x000000000000000000000000000000000000dEaD", 0x80000000 ^ 8453) 1. reverse: resolve("000000000000000000000000000000000000dead.addr.reverse", name()) => ❌️ ResolverNotFound() ``` ### Backwards Compatibility UR supports **ALL** known resolver types if the caller supports CCIP-Read. Otherwise, it can only resolve onchain names. It is a **complete replacement** for existing ENS resolution procedures. Client frameworks should focus on building calldata and handling responses and rely on UR to facilitate resolution. ### Security Considerations UR uses a batch gateway to perform CCIP-Read requests. If the client does not support ENSIP-21, a trustless external batch gateway service is used which adds latency and leaks information. UR is deployed as an immutable contract and as an ENS DAO-managed upgradeable proxy. The main purpose of the proxy is to facilitate a seamless transition to ENSv2 and track the latest standards. Client frameworks should default to the proxy so their libraries are future-proof, with the option to specify an alternative implementation. ### Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). import { EnsipHeader } from "../../components/EnsipHeader"; ## ENSIP-24: Arbitrary Data Resolution <EnsipHeader authors={["premm.eth","raffy.eth","clowes.eth"]} created="September 25, 2025" status="draft" /> ### Abstract This ENSIP proposes a new resolver profile for resolving arbitrary `bytes` data. ### Motivation ENS has seen significant adoption across the blockchain ecosystem, but the current resolver profiles are too restrictive for many emerging applications. There is a clear need for a richer record type that can store unstructured binary data. This would provide a flexible, gas-efficient mechanism for associating any data with an ENS name. This would enable direct support for resolution of things like: * Hashed data commitments for off-chain data verification * Interoperable addresses * Context data ### Specification The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174. #### Overview This ENSIP introduces a new interface for the resolution of arbitrary `bytes` data: ``` /// @dev Interface selector: `0xecbfada3` interface IDataResolver { /// @notice For a specific `node`, get the data associated with the key, `key`. /// @param node The node (namehash) for which data is being fetched. /// @param key The key. /// @return The associated arbitrary `bytes` data. function data( bytes32 node, string calldata key ) external view returns (bytes memory); } ``` The [ERC-165] identifier for this interface is `0xecbfada3`. The `key` argument is a `string` type for simplicity and clarity. Resolvers implementing this ENSIP MUST emit the following event when data is changed: ``` /// @notice For a specific `node`, the data associated with a `key` has changed. event DataChanged( bytes32 indexed node, string indexed indexedKey, string key, bytes indexed indexedData ); ``` Resolvers MAY implement the following interface ``` /// @dev Interface selector: `0x29fb1892` interface ISupportedDataKeys { /// @notice For a specific `node`, get an array of supported data keys. /// @param node The node (namehash). /// @return The keys for which we have associated data. function supportedDataKeys(bytes32 node) external view returns (string[] memory); } ``` The [ERC-165] identifier for this interface is `0x29fb1892`. If implemented this function MUST return an array of `string` keys which the resolver MAY store data for. #### Rationale Retrofitting the `addr(bytes32 node, uint coinType)` function defined in ENSIP-9 as a getter for resolving arbitrary bytes was considered, but whilst cool, its usage is hacky and not semantically clear to developers. We considered simply storing `bytes` data as a `string` within text records but this is inefficient, expensive, and impractical. The `DataChanged` event emits both the `key` and the `indexedKey`. This allows for efficient event filtering whilst immediately exposing useful key data. `indexedData` is also emitted to allow data integrity checks whilst avoiding chain bloat. The optional `ISupportedDataKeys` interface allows for data key discovery. The intended usage of this interface is to enable data discovery for small, known, and bounded sets of keys without the need for external dependencies. #### Example Below is an illustrative snippet that shows how to set and retrieve arbitrary data: ``` pragma solidity ^0.8.25; interface IDataResolver { event DataChanged( bytes32 indexed node, string indexed indexedKey, string key, bytes indexed indexedData ); function data( bytes32 node, string calldata key ) external view returns (bytes memory); } contract Resolver is IDataResolver { mapping(bytes32 node => mapping(string key => bytes data)) private dataStore; function data(bytes32 node, string calldata key) external view returns (bytes memory) { return dataStore[node][key]; } // setData function can be used to set the data (not shown) } ``` Set and retrieve arbitrary data: ``` // Pseudo javascript example // Store arbitrary data const tx = await resolver.setData(node, "agent-context", "0x0001ABCD..."); await tx.wait(); // Retrieve arbitrary data const result = await resolver.data(node, "agent-context"); ``` ### Backwards Compatibility This proposal introduces a new resolver profile and does not affect existing ENS functionality. It introduces no breaking changes. ### Security Considerations None. ### Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). [ERC-165]: https://eips.ethereum.org/EIPS/eip-165 import { EnsipHeader } from "../../components/EnsipHeader"; ## ENSIP-25: AI Agent Registry ENS Name Verification <EnsipHeader authors={["premm.eth","raffy.eth","workemon.eth","ses.eth"]} created="October 2, 2025" status="draft" /> ### Abstract This ENSIP defines a standardized method for directly verifying, using text records, the association between an ENS name and an AI agent identity registered in a specific on-chain AI agent registry. ### Motivation With the introduction of on-chain AI agent identity registries, such as ERC-8004, in which agents may declare an associated ENS name, there is a need for a standardized verification method. This verification process is essential for establishing trust between an AI agent identity and the ENS name it claims to control. This ENSIP defines a direct lookup method using a parameterized text record key that includes a unique agent identifier. ### Specification The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174. #### Parameterized Verification Text Record Key To enable verification of an ENS name from a specific AI agent registry entry, this ENSIP defines a global parameterized ENS text record key: ``` agent-registration[<registry>][<agentId>] ``` Where: * `<registry>` is the ERC-7930 interoperable address of the registry contract (hexadecimal string with `0x` prefix), * `<agentId>` is the registry-defined agent identifier (string) and MUST NOT contain the characters `[` or `]`. The combination of `<registry>` and `<agentId>` MUST uniquely identify an agent within the context of the referenced registry. The value of this text record MUST be a non-empty string. Implementations SHOULD set the value to `"1"`. The specific value has no semantic meaning; the presence of a non-empty value is interpreted as an attestation by the ENS name owner that the ENS name is associated with the referenced AI agent registry entry. Verification clients MUST NOT depend on the specific value beyond it being non-empty. #### Verification Flow (Registry-to-ENS) Clients performing verification starting from an AI agent registry entry MUST follow the steps below: 1. Obtain the claimed ENS name, agent identifier, and registry address from the AI agent registry entry. 2. Construct the text record key `agent-registration[<registry>][<agentId>]`. 3. Resolve the text record with this key on the claimed ENS name. 4. If the resolved value is non-empty, the ENS name is considered verified for that specific agent registry entry. If the text record does not exist or resolves to an empty value, verification MUST fail. #### Ethereum Example For EVM-based registries, the registry address MUST be encoded as an ERC-7930 interoperable address with a 20-byte address length. Example registry (ERC-8004 on Ethereum mainnet): ``` 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 ``` ERC-7930 encoding (EIP-155 chain ID 1): ``` 0x000100000101148004a169fb4a3325136eb29fa0ceb6d2e539a432 ``` Corresponding verification text record key for agent `167`: ``` agent-registration[0x000100000101148004a169fb4a3325136eb29fa0ceb6d2e539a432][167] ``` Any non-empty value set under this key indicates a positive verification. #### Registry Compatibility This ENSIP is intended for AI agent registries that: * assign stable identifiers to agent registrations, and * allow an ENS name to be declared as part of the agent’s metadata (on-chain or off-chain). Registries using this ENSIP MUST document how agent identifiers and claimed ENS names are obtained to allow clients to perform correct verification. ### Rationale This ENSIP provides a minimal verification mechanism that leverages existing ENS text records without requiring resolver upgrades or registry-specific integrations. By embedding a registry entry identifier directly into the text record key, clients can perform deterministic verification from known registry inputs using a single resolver lookup. The registry component is encoded as an ERC-7930 interoperable address, which combines chain identification and the registry contract address into a canonical representation, enabling unambiguous registry identification across chains. ### Backwards Compatibility Not applicable. ### Security Considerations If an ENS name is transferred to a new owner, any existing verification text records may become stale. Clients SHOULD consider ENS name ownership changes when evaluating the validity of prior attestations and MAY apply additional freshness or revocation checks as appropriate. ### Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). import { EnsipHeader } from "../../components/EnsipHeader"; ## ENSIP-26: Agent Text Records <EnsipHeader authors={["premm.eth","justghadi.eth"]} created="May 17, 2025" status="draft" /> ### Abstract This ENSIP extends ENSIP‑5: Text Records by standardizing the `agent-context` text record key and `agent-endpoint[<protocol>]` for agent interface discovery. An ENS name provides a single, multichain identity for an AI agent. The `agent-context` is the entry point: it describes the agent and may reference agent registries (e.g. ENSIP-25) or endpoints set via `agent-endpoint` records. Clients discover one identity, one context, and connect via the indicated registries or endpoints. ### Motivation Agentic systems require a single, verifiable identity that works across chains. An ENS name provides that: one identity, one place for context and discovery. This ENSIP standardizes how agents declare themselves via `agent-context` and `agent-endpoint`. The context can point to whether the agent is registered in agent registries (e.g. ENSIP-25) or has protocol endpoints (MCP, A2A) set via `agent-endpoint` text records. ### Specification The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. #### Text Record Keys ##### agent-context * **Key**: `agent-context` * **Format**: Any format suitable for agentic systems (plain text, Markdown, YAML, JSON, etc.) The key **MUST** be published via `text(bytes32,string)` as defined in ENSIP‑5. The content describes the
프로젝트로 돌아가기