ENS is used to map a human-readable name, such as packt.eth, to more complex identifiers such as an Ethereum address. ENS shares its goal with the Domain Name Service (DNS) of the internet, which maps IP addresses to easily recognizable strings of characters. ENS contains two important components: the registry and the resolver. A registry is a smart contract that owns a domain and issues subdomains of that domain to users. The user has to follow the set of rules defined in the contract for registering a domain.
The registry maintains a list of all domains/subdomains and the following information about each of them:
- The owner, which can be an externally owned account or contract address
- The resolver
- The lifetime for all records saved under that domain
The owner of each domain will have access to set the resolver and time-to-live (TTL) for that domain. They can transfer the ownership of each domain or subdomain to another address. The resolver handles the process of translating names into addresses. Any contract that implements the relevant standards can act as a resolver contract in ENS.
On the Ethereum main network, you can register your names under the .ens TLD. It uses an auction-based registrar for allocating names to owners. The Ropsten test network allows both .eth and .test TLDs. The .test domain allows anyone to claim an unused name for testing purposes. The names claimed, expire after 28 days. The Rinkeby network also supports ENS but only for the .test TLD.