Ethereum Name Service 백서

Ethereum Name Service

원문

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

The name of a specific provider can be passed as a parameter.", "recordType": "data", "parameterType": "map" } } } ``` In this example, the owner of the node could use the key `proof-of-humanity[provider]` to store a proof of humanity attestation from a specific provider, and they could use `proof-of-humanity` to publish a default attestation to be retrieved if no provider is specified. ### Backwards Compatibility This proposal is built upon existing ENSIPs 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/). import { EnsipHeader } from "../../components/EnsipHeader"; ## ENSIP-28: ENS Name Owned Accounts <EnsipHeader authors={["premm.eth","workemon.eth","raffy.eth"]} created="August 13, 2026" status="draft" /> ### Abstract This ENSIP lets an ENS name list more than one account per chain, for example a Safe or a token bound account, and requires each listed account to prove that it consents to the association. The proof is a signature over an [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed message, stored as a data record alongside the listing. It covers EOAs, deployed smart accounts (via [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271)), and token bound accounts ([ERC-6551](https://eips.ethereum.org/EIPS/eip-6551)). ### Motivation ENS names often represent a user identity, for both human users and AI agents. A user frequently controls more than one account on a chain and wants those accounts associated with a single ENS name. [ENSIP-9](/ensip/9) resolves one address per chain, which suits a payment address but not an identity that spans several accounts. An association is only meaningful if both sides agree to it. A record written by the name owner alone is a claim about someone else's account, and anyone who controls a name can name any address in it. This ENSIP therefore defines both halves: how a name lists its accounts, and how each account proves that it consents to being listed. ### 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. #### Account Data Records An ENS name lists its accounts on a chain as an [ENSIP-24](/ensip/24) data record on its own node under the reserved key: ``` accounts[<chain-id>] ``` where `<chain-id>` is the EVM chain ID as an unsigned base-10 integer without leading zeros. The value MUST be the accounts encoded as consecutive 32-byte words, each holding an address in its low 20 bytes: ``` abi.encode(address account1, address account2, ...) ``` The number of accounts is the length of the value divided by 32. Accounts MAY appear in any order. A name MAY additionally publish the chains it has accounts on under the reserved key: ``` accounts-chains ``` whose value MUST be `abi.encode(uint256 chainId1, uint256 chainId2, ...)`. Clients MAY instead discover keys by indexing `DataChanged` events, defined in [ENSIP-24](/ensip/24). #### Proof Data Records The proof for an account listed under `accounts[<chain-id>]` is stored on the same node under the reserved key: ``` accounts[<chain-id>][<account>] ``` with the same `<chain-id>` as the listing it proves, and where `<account>` is `0x` followed by the lowercase hexadecimal representation of the listed account's address bytes. The value MUST be: ``` abi.encode(uint256 expiresAt, bytes signature) ``` Each account listed in `accounts[<chain-id>]` MUST have a record at its key. An account whose record is absent or empty is not verified. `expiresAt` is a Unix timestamp in seconds and MUST be non-zero. The proof is invalid at and after that time, and is valid for at most the two years preceding it. Until a proof lapses, an account cannot withdraw consent unilaterally, and removal rests with the name owner. Signers SHOULD choose the shortest window that suits the association. `signature` is a signature over the message defined below. It MUST NOT be empty. A listed account MUST therefore be able to produce an ECDSA signature or to validate one under ERC-1271. A contract account MUST be deployed before it can be listed. A token bound account is deployed through the ERC-6551 registry's `createAccount`. #### Consent Message The signature MUST be over the following EIP-712 typed data: ``` domain = { name: "ENS Name Owned Accounts", version: "1", chainId: <the chain the name's records are on> } struct Consent { bytes32 node; // namehash of the listing ENS name uint256 accountChainId; // the chain the listed account is on address account; // the listed account uint256 expiresAt; // must equal the record's expiresAt } ``` The `Consent` type hash is `0x8dff32c14409d396587044aa7663b77f60b1d374ec13710f3f0acdc3a810a94d`. The domain type hash, over `EIP712Domain(string name,string version,uint256 chainId)`, is `0xc2f8787176b8ac6bf7215b4adcc1e069bf4ab82d9ab1df05a57a91d425935b6e`, which gives these domain separators: | Chain | `chainId` | Domain separator | | ---------------- | ---------- | -------------------------------------------------------------------- | | Ethereum Mainnet | `1` | `0xefbd5fd6831eeaf1b039217878898cb25c5afb12a1789321e1e4b870d56bdab0` | | Sepolia | `11155111` | `0x0e8de794261382cbb6e04b05bebc36d7e32e3461ee7f992d81fb7236a1419cd6` | The domain's `chainId` is the chain the name's records are on. It binds a proof to one ENS deployment, so a proof signed against a name in one deployment does not verify against the same name in another. The domain contains no `verifyingContract`. These proofs are not verified by any one contract, so there is nothing for it to name, and its absence lets a proof survive a migration of the name's records to a new resolver. #### Verification To determine a name's accounts on a chain, a client: 1. Reads `accounts[<chain-id>]` and decodes it as consecutive 32-byte words, each holding an address in its low 20 bytes. 2. For each listed account, reads `accounts[<chain-id>][<account>]` and decodes it as `(uint256 expiresAt, bytes signature)`. An account whose record is absent or empty is not verified. 3. Rejects the record if `expiresAt` is zero, if `signature` is empty, if the current time is at or past `expiresAt`, or if `expiresAt` is more than two years after the current time. A verifier running on chain uses `block.timestamp` as the current time. 4. Reconstructs the `Consent` struct, taking `node` from the name being resolved, `accountChainId` from the record key, `account` from the listed account, and `expiresAt` from the record. Computes the EIP-712 digest, taking the domain `chainId` from the chain the name's records were resolved from, and validates `signature` for the listed account on the chain named by `<chain-id>`. Validation MUST be attempted in this order: 1. If the account has code, validate it by calling `isValidSignature` (ERC-1271) on `account`. Validation succeeds only if the call returns the ERC-1271 magic value `0x1626ba7e`. A revert, or any other return value, is a failure of that account's verification and MUST NOT affect any other account. 2. Otherwise, validate it by `ecrecover`. Validation succeeds only if the recovered address equals `account` and is not the zero address. Each account is verified independently. An account that fails any step is not an owned account of the name, and clients MUST NOT present it as one. Because the struct is reconstructed from context, a proof copied to another name, chain, account, or ENS deployment fails verification. #### Relation to Address Records The name's address records under [ENSIP-1](/ensip/1) and [ENSIP-9](/ensip/9) continue to resolve its primary accounts. Listed accounts are data records, not address records. #### Meaning of a Verified Owned Account A listed account becomes a verified owned account of the name when its proof verifies. Both sides have then acted: the name owner wrote the listing, and the account authorised a signature consenting to it. An owned account is not a payment address. Clients and explorers MUST NOT display the ENS name in place of the account address, and clients SHOULD NOT send funds to an owned account. The name's address records remain its payment addresses. #### Ethereum Example The name `agent.example.eth` lists two accounts on Ethereum mainnet, chain ID `1`: ``` data(namehash("agent.example.eth"), "accounts[1]") = 0x000000000000000000000000d8da6bf26964af9d7eed9e03e53415d37aa96045 000000000000000000000000b8c2c29ee19d8307cb7255e1cd9cbde883a267d5 ``` The proofs for those accounts, both expiring at `1798761600` (2027-01-01): ``` data(namehash("agent.example.eth"), "accounts[1][0xd8da6bf26964af9d7eed9e03e53415d37aa96045]") = abi.encode(uint256(1798761600), 0x...) data(namehash("agent.example.eth"), "accounts[1][0xb8c2c29ee19d8307cb7255e1cd9cbde883a267d5]") = abi.encode(uint256(1798761600), 0x...) ``` ### Rationale * **One signature scheme for all signing accounts.** EIP-712 signatures verify by `ecrecover` for EOAs and via ERC-1271 for contract accounts, including ERC-6551 token bound accounts, which are required to implement ERC-1271 and by default treat the holder of the bound NFT as a valid signer. Standard library functions already implement this cascade, for example OpenZeppelin's `SignatureChecker`, so clients need one code path. * **The account is bound inside the struct.** ERC-1271 only answers whether a digest is validly signed for a given account, and one signing key often controls several accounts. Without `account` in the struct, a consent signed for one account would verify for every account under the same signer. Binding `accountChainId` likewise stops a proof for a contract at a given address on one chain from verifying the same address on another. * **Expiry is what makes consent withdrawable.** A signature cannot be unsigned, so a required `expiresAt` is what gives an account a way out: it stops renewing and the listing lapses within a window of at most two years. ERC-1271 proofs additionally stop verifying when the account rotates its signers, which for an ERC-6551 account means a proof lapses when the owning token is transferred. ### Backwards Compatibility This ENSIP requires no change to existing resolution standards and introduces no new resolver profile method. ### Security Considerations * Proofs survive a transfer of the ENS name, so an owned account consented to the name, not to its current owner. Bounded validity windows mitigate this. * A proof shows that the account's signer consented to the association, not that the name and the account are controlled by the same party. Two cooperating parties can produce the same records. * An account delegated under [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) has code, so it is verified through its delegate under ERC-1271. Such an account can be listed only while its delegate implements ERC-1271, and changing the delegate can stop existing proofs from verifying. * A token bound account validates signatures against the current holder of its bound token, which it can read only on its own chain. An account bound to a token on another chain cannot be listed. ### Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). import { EnsipHeader } from "../../components/EnsipHeader"; ## ENSIP-3: Reverse Resolution <EnsipHeader authors={["nick.eth"]} created="December 1, 2016" status="final" /> Specifies a TLD, registrar, and resolver interface for reverse resolution of Ethereum addresses using ENS (formerly [EIP-181](https://eips.ethereum.org/EIPS/eip-181)). ### Abstract This ENSIP specifies a TLD, registrar, and resolver interface for reverse resolution of Ethereum addresses using ENS. This permits associating a human-readable name with any Ethereum blockchain address. Resolvers can be certain that the reverse record was published by the owner of the Ethereum address in question. ### Motivation While name services are mostly used for forward resolution - going from human-readable identifiers to machine-readable ones - there are many use-cases in which reverse resolution is useful as well: * Applications that allow users to monitor accounts benefit from showing the name of an account instead of its address, even if it was originally added by address. * Attaching metadata such as descriptive information to an address allows retrieving this information regardless of how the address was originally discovered. * Anyone can configure a name to resolve to an address, regardless of ownership of that address. Reverse records allow the owner of an address to claim a name as authoritative for that address. ### Specification Reverse ENS records are stored in the ENS hierarchy in the same fashion as regular records, under a reserved domain, `addr.reverse`. To generate the ENS name for a given account's reverse records, convert the account to hexadecimal representation in lower-case, and append `addr.reverse`. For instance, the ENS registry's address at `0x112234455c3a32fd11230c42e7bccd4a84e02010` has any reverse records stored at `112234455c3a32fd11230c42e7bccd4a84e02010.addr.reverse`. Note that this means that contracts wanting to do dynamic reverse resolution of addresses will need to perform hex encoding in the contract. #### Registrar The owner of the `addr.reverse` domain will be a registrar that permits the caller to take ownership of the reverse record for their own address. It provides the following methods: ##### function claim(address owner) returns (bytes32 node) When called by account `x`, instructs the ENS registry to transfer ownership of the name `hex(x) + '.addr.reverse'` to the provided address, and return the namehash of the ENS record thus transferred. Allowing the caller to specify an owner other than themselves for the relevant node facilitates contracts that need accurate reverse ENS entries delegating this to their creators with a minimum of code inside their constructor: ```solidity reverseRegistrar.claim(msg.sender) ``` ##### function claimWithResolver(address owner, address resolver) returns (bytes32 node) When called by account `x`, instructs the ENS registry to set the resolver of the name `hex(x) + '.addr.reverse'` to the specified resolver, then transfer ownership of the name to the provided address, and return the namehash of the ENS record thus transferred. This method facilitates setting up a custom resolver and owner in fewer transactions than would be required if calling `claim`. ##### function setName(string name) returns (bytes32 node) When called by account `x`, sets the resolver for the name `hex(x) + '.addr.reverse'` to a default resolver, and sets the name record on that name to the specified name. This method facilitates setting up simple reverse records for users in a single transaction. #### Resolver interface A new resolver interface is defined, consisting of the following method: ```solidity function name(bytes32 node) constant returns (string); ``` Resolvers that implement this interface must return a valid ENS name for the requested node, or the empty string if no name is defined for the requested node. The interface ID of this interface is 0x691f3431. Future ENSIPs may specify more record types appropriate to reverse ENS records. ### Appendix 1: Registrar implementation This registrar, written in Solidity, implements the specifications outlined above. ```solidity pragma solidity ^0.4.10; import "./AbstractENS.sol"; contract Resolver { function setName(bytes32 node, string name) public; } /** * @dev Provides a default implementation of a resolver for reverse records, * which permits only the owner to update it. */ contract DefaultReverseResolver is Resolver { AbstractENS public ens; mapping(bytes32=>string) public name; /** * @dev Constructor * @param ensAddr The address of the ENS registry. */ function DefaultReverseResolver(AbstractENS ensAddr) { ens = ensAddr; } /** * @dev Only permits calls by the reverse registrar. * @param node The node permission is required for. */ modifier owner_only(bytes32 node) { require(msg.sender == ens.owner(node)); _; } /** * @dev Sets the name for a node. * @param node The node to update. * @param _name The name to set. */ function setName(bytes32 node, string _name) public owner_only(node) { name[node] = _name; } } contract ReverseRegistrar { // namehash('addr.reverse') bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2; AbstractENS public ens; Resolver public defaultResolver; /** * @dev Constructor * @param ensAddr The address of the ENS registry. * @param resolverAddr The address of the default reverse resolver. */ function ReverseRegistrar(AbstractENS ensAddr, Resolver resolverAddr) { ens = ensAddr; defaultResolver = resolverAddr; } /** * @dev Transfers ownership of the reverse ENS record associated with the * calling account. * @param owner The address to set as the owner of the reverse record in ENS. * @return The ENS node hash of the reverse record. */ function claim(address owner) returns (bytes32 node) { return claimWithResolver(owner, 0); } /** * @dev Transfers ownership of the reverse ENS record associated with the * calling account. * @param owner The address to set as the owner of the reverse record in ENS. * @param resolver The address of the resolver to set; 0 to leave unchanged. * @return The ENS node hash of the reverse record. */ function claimWithResolver(address owner, address resolver) returns (bytes32 node) { var label = sha3HexAddress(msg.sender); node = sha3(ADDR_REVERSE_NODE, label); var currentOwner = ens.owner(node); // Update the resolver if required if(resolver != 0 && resolver != ens.resolver(node)) { // Transfer the name to us first if it's not already if(currentOwner != address(this)) { ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, this); currentOwner = address(this); } ens.setResolver(node, resolver); } // Update the owner if required if(currentOwner != owner) { ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, owner); } return node; } /** * @dev Sets the `name()` record for the reverse ENS record associated with * the calling account. First updates the resolver to the default reverse * resolver if necessary. * @param name The name to set for this address. * @return The ENS node hash of the reverse record. */ function setName(string name) returns (bytes32 node) { node = claimWithResolver(this, defaultResolver); defaultResolver.setName(node, name); return node; } /** * @dev Returns the node hash for a given account's reverse records. * @param addr The address to hash * @return The ENS node hash. */ function node(address addr) constant returns (bytes32 ret) { return sha3(ADDR_REVERSE_NODE, sha3HexAddress(addr)); } /** * @dev An optimised function to compute the sha3 of the lower-case * hexadecimal representation of an Ethereum address. * @param addr The address to hash * @return The SHA3 hash of the lower-case hexadecimal encoding of the * input address. */ function sha3HexAddress(address addr) private returns (bytes32 ret) { addr; ret; // Stop warning us about unused variables assembly { let lookup := 0x3031323334353637383961626364656600000000000000000000000000000000 let i := 40 loop: i := sub(i, 1) mstore8(i, byte(and(addr, 0xf), lookup)) addr := div(addr, 0x10) i := sub(i, 1) mstore8(i, byte(and(addr, 0xf), lookup)) addr := div(addr, 0x10) jumpi(loop, i) ret := sha3(0, 40) } } } ``` ### Copyright Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). import { EnsipHeader } from "../../components/Ensip
프로젝트로 돌아가기