The primary purpose of the Ethereum Name Service (ENS) is to convert machine-readable identifiers, such as Ethereum addresses, into human-readable names.
The web started as a decentralized DNS-based system, where anyone could buy, own, and manage their domain name and move it from host to host as needed, with complete control and ownership over all underlying data. But how does a decentralized Web3 naming service work?
The community has shown a lot of interest in ENS, which is a new naming service built on top of Ethereum. The Ethereum Name Service is a Web3 blockchain system that allows users to set their own unique and memorable usernames.
Therefore, ENS intends to provide a complementary solution to DNS by utilizing Ethereum smart contracts to govern domain name registration and resolution. With the service, you can provide a unique name to all your wallet addresses and decentralized websites (DWeb). “alex.eth”, for example, allows you to quickly recognize and locate wallet addresses in a distributed environment.
The registry, registrars, and resolvers are three types of smart contracts in the ENS, as explained in the sections below.
Register
A single smart contract runs the ENS registry and keeps track of all domains and subdomains. The system has been kept basic on purpose, and its sole purpose is to bind a name to the resolver that is responsible for it. It also saves the following three crucial data:
- The owner of the domain: An external account or a smart contract can be the owner of the domain. The domain owner can update the resolution and TTL of the domain, transfer ownership of the domain to another address, and modify the entitlement of subdomains.
- Domain name resolvers: The process of converting names to addresses is handled by resolvers. Any contract can become a resolver if it follows specific guidelines.
- ENS Namehash: ENS saves names as hashes, which are generated using the “namehash” method. The namehash is calculated by combining the hash of the highest level part of the ENS domain names (known as the “labelhash”) with the namehash of the other parts and then hashing it again.
registrars
A registrar is a smart contract that has a domain name and can grant subdomain names to users based on rules (e.g. payment). The ENS team used the Vickrey auction registrar and the permanent registrar for .eth name registries.
On May 4, 2017, the ENS team released a smart contract that implements a Vickrey auction to register names longer than six characters. The Vickrey auction is a kind of sealed bid auction where buyers bid without knowing how many other bidders have bid, and the winner of the auction is the highest bidder who only has to pay the bid. second highest amount.
On May 4, 2019, the ENS team presented the “permanent registrar” instead of the auction registrar to register names longer than six characters. The perpetual recorder is It is designed to run indefinitely until the registrar’s contract is replaced due to a fatal failure. Changed The billing method for .eth names has been converted to an annual rent payment model, in which each name will be billed separately. USD 5 per year.
Along with the permanent recorder, it was created. The Registrar Controller idea to allow name owners to delegate name management. As a result, a name registered by the logger driver can configure the name and resolution registers as part of the registration transaction, simplifying the procedure.
In September 2019, it began. another auction called short name auction for the remaining short names with a length of 3 to 6. The ENS team used OpenSea, a well-known crypto asset market, as an auction platform, with the English auction as the auction method.
Bidding in an English auction is open to the public and bidders can bid in large numbers. The highest bidder will win. the name and amount of deposits will be The first year’s registration fee, which is considerably different from the Vickrey auction period.
the resolvers
The name-to-record mapping is saved in the resolver. The “public resolvers” implemented by the ENS team have eight record categories preset (see image below), but ENS can contain any record.
The ENS name resolution procedure consists of two steps. The user who wants to resolve the name must first search the registry for the relevant resolver, and then retrieve the resolution results from the resolver.