ERC-137: Ethereum Domain Name Service - Specification Ethereum Improvement Proposals AllCoreNetworkingInterfaceERCMetaInformational Standards Track: ERC ERC-137: Ethereum Domain Name Service - Specification Authors Nick Johnson  Created 2016-04-04 Table of Contents Abstract Motivation Specification Overview Name Syntax namehash algorithm Registry specification Resolver specification Contract Address Interface Appendix A: Registry Implementation Appendix B: Sample Resolver Implementations - Built-in resolver - Standalone resolver - Public resolver Appendix C: Sample Registrar Implementation Abstract This draft EIP describes the details of the Ethereum Name Service, a proposed protocol and ABI definition that provides flexible resolution of short, human-readable names to service and resource identifiers. This permits users and developers to refer to human-readable and easy to remember names, and permits those names to be updated as necessary when the underlying resource (contract, content-addressed data, etc) changes. The goal of domain names is to provide stable, human-readable identifiers that can be used to specify network resources. In this way, users can enter a memorable string, such as ‘vitalik.wallet’ or ‘www.mysite.swarm’, and be directed to the appropriate resource. The mapping between names and resources may change over time, so a user may change wallets, a website may change hosts, or a swarm document may be updated to a new version, without the domain name changing. Further, a domain need not specify a single resource; different record types allow the same domain to reference different resources. For instance, a browser may resolve ‘mysite.swarm’ to the IP address of its server by fetching its A (address) record, while a mail client may resolve the same address to a mail server by fetching its MX (mail exchanger) record. Motivation Existing specifications and implementations for name resolution in Ethereum provide basic functionality, but suffer several shortcomings that will significantly limit their long-term usefulness: A single global namespace for all names with a single ‘centralised’ resolver. Limited or no support for delegation and sub-names/sub-domains. Only one record type, and no support for associating multiple copies of a record with a domain. Due to a single global implementation, no support for multiple different name allocation systems. Conflation of responsibilities: Name resolution, registration, and whois information. Use-cases that these features would permit include: Support for subnames/sub-domains - eg, live.mysite.tld and forum.mysite.tld. Multiple services under a single name, such as a DApp hosted in Swarm, a Whisper address, and a mail server. Support for DNS record types, allowing blockchain hosting of ‘legacy’ names. This would permit an Ethereum client such as Mist to resolve the address of a traditional website, or the mail server for an email address, from a blockchain name. DNS gateways, exposing ENS domains via the Domain Name Service, providing easier means for legacy clients to resolve and connect to blockchain services. The first two use-cases, in particular, can be observed everywhere on the present-day internet under DNS, and we believe them to be fundamental features of a name service that will continue to be useful as the Ethereum platform develops and matures. The normative parts of this document does not specify an implementation of the proposed system; its purpose is to document a protocol that different resolver implementations can adhere to in order to facilitate consistent name resolution. An appendix provides sample implementations of resolver contracts and libraries, which should be treated as illustrative examples only. Likewise, this document does not attempt to specify how domains should be registered or updated, or how systems can find the owner responsible for a given domain. Registration is the responsibility of registrars, and is a governance matter that will necessarily vary between top-level domains. Updating of domain records can also be handled separately from resolution. Some systems, such as swarm, may require a well defined interface for updating domains, in which event we anticipate the development of a standard for this. Specification Overview The ENS system comprises three main parts: The ENS registry Resolvers Registrars The registry is a single contract that provides a mapping from any registered name to the resolver responsible for it, and permits the owner of a name to set the resolver address, and to create subdomains, potentially with different owners to the parent domain. Resolvers are responsible for performing resource lookups for a name - for instance, returning a contract address, a content hash, or IP address(es) as appropriate. The resolver specification, defined here and extended in other EIPs, defines what methods a resolver may implement to support resolving different types of records. Registrars are responsible for allocating domain names to users of the system, and are the only entities capable of updating the ENS; the owner of a node in the ENS registry is its registrar. Registrars may be contracts or externally owned accounts, though it is expected that the root and top-level registrars, at a minimum, will be implemented as contracts. Resolving a name in ENS is a two-step process. First, the ENS registry is called with the name to resolve, after hashing it using the procedure described below. If the record exists, the registry returns the address of its resolver. Then, the resolver is called, using the method appropriate to the resource being requested. The resolver then returns the desired result. For example, suppose you wish to find the address of the token contract associated with ‘beercoin.eth’. First, get the resolver: var node = namehash("beercoin.eth"); var resolver = ens.resolver(node); Then, ask the resolver for the address for the contract: var address = resolver.addr(node); Because the namehash procedure depends only on the name itself, this can be precomputed and inserted into a contract, removing the need for string manipulation, and permitting O(1) lookup of ENS records regardless of the number of components in the raw name. Name Syntax ENS names must conform to the following syntax: ::=