Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ERC162, the proposal for the initial registrar contract of the Ethereum Name Service (ENS).

This article translates, summarizes, and expands on the proposal linked below.

Overview

The proposal describes a contract for the Ethereum Name Service (ENS). ENS is a system for managing domain names on the Ethereum blockchain that launched on mainnet on May 4, 2017.

The corresponding source code is available here.

For background information, see EIP137.

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.

  • EIP 137

A registrar allocates domain names to users of the system and is the only entity authorized to update ENS. The registrar of a node is its owner in the ENS registry. Registrars may be contracts or externally owned accounts, but at least the root and top-level registrars are expected to be implemented as contracts.

See the following article for more on ERC137.

[ERC137] How ENS Associates Addresses with Human-Readable Names

A central component of ENS is the registrar. Registrars are responsible for allocating domain names to users and have the authority to make changes and updates within ENS. A registrar may be operated through a smart contract or an externally owned account, although major registrars, such as the root and top-level registrars, are generally implemented as contracts.

Effective ENS operation requires well-designed registrars. Registrars are separate from the core ENS protocol, allowing different approaches to domain name allocation. Strategies for preventing domain squatting and unproductive speculation are particularly important. For the initial period, the proposal therefore recommends a simple allocation mechanism called the initial registrar. During this stage, registrations are limited to the .eth domain, and subdomains with fewer than seven characters are unavailable.

The initial registrar was implemented primarily by @alexvandesande and @arachnid to encourage broader discussion. The proposal anticipated replacing it with a permanent registrar. The permanent registrar would make more names available and incorporate lessons learned from the initial registrar. This change was expected to occur within approximately two years of the initial deployment.

Motivation

The following factors must be considered to optimize ENS adoption and the governance of the initial registrar's namespace.

Upgradeability

The initial registrar must be capable of being safely upgraded to a better permanent registrar using knowledge gained through experience. The initial system should therefore be designed with future improvements in mind.

Effective allocation

When a new namespace becomes available, it often triggers a land rush for names. Valuable names may be acquired and left unused in anticipation of later resale at higher prices. This can make the most useful names less accessible, reducing the benefits of ENS for its users. The initial registrar should focus on limiting the long-term costs of such misallocation.

Security

Because the registrar will be responsible for potentially unlimited amounts of ether, Ethereum's native currency, it must be designed with particularly strong security guarantees.

Simplicity

The ENS design emphasizes simplicity. The interim registrar should likewise be as simple as possible while meeting its other design objectives.

Adoption

Successful standards benefit from network effects that encourage further adoption. Registrars should consider strategies for increasing ENS adoption generally. In particular, they should promote widespread use of the namespaces they administer.

These considerations are important for the effective governance and adoption of ENS and its initial registrar.

Specification

Specific restrictions

The initial registrar of ENS is subject to several restrictions. These are intended to support stable operation and allow the collection of experience necessary for future improvements. The main restrictions are described below.

Operating period

The initial registrar is expected to operate for approximately two years. This period is considered sufficient to observe ENS, learn from its operation, and design the next version of the system.

Namespace restrictions

During the initial two-year period, the available namespace is restricted to the .eth top-level domain (TLD). This restriction is enforced by the owner of the ENS root node. The root owner should not assign any node other than .eth to the initial registrar.

Control through a multisig contract

The ENS root node should be managed by multiple parties through a multisig contract. This allows for more secure and decentralized administration.

Name length restrictions

The initial registrar prohibits the registration of names containing six or fewer characters. The intention is to avoid problems associated with very short names and encourage the use of more practical names.

These restrictions establish a foundation for the future of ENS and facilitate a transition to an improved system.

Name format for hash registration

The initial ENS registrar requires names to be submitted in a specific hashed format.

Names submitted to the initial registrar must be hashed using Ethereum's sha3 function. Importantly, the submitted hash is not the namehash defined in EIP137, but the hash of the subdomain label being registered.

For example, registering abcdefg.eth requires submitting sha3('abcdefg'). It does not require sha3(sha3(0, 'eth'), 'abcdefg').

This is the standard registration procedure for the initial ENS registrar and is intended to ensure system security and consistency.

Name auctions

The following describes domain name auctions in the initial ENS registrar.

ENS uses a Vickrey auction, a type of sealed-bid auction, to allocate domain names.

A Vickrey auction is a type of sealed-bid auction. Bidders submit written bids without knowing the bid of the other people in the auction. The highest bidder wins but the price paid is the second-highest bid. This type of auction… gives bidders an incentive to bid their true value.

  • Vickrey Auction, Wikipedia

Bidders submit their bids without knowing other participants' bids. The highest bidder wins but pays the amount of the second-highest bid. This mechanism encourages bidders to bid according to their actual valuations.

The auction has five stages.

  1. Not yet available

    • Many names cannot initially be auctioned. They gradually become available during the first eight weeks after launch.
  2. Open

    • The availability date of each name depends on a significant byte of its sha3 hash.
    • For example, 0x00 indicates immediate availability, while 0xFF indicates availability after eight weeks.
  3. Auction

    • Once the auction begins, bidding remains open for 72 hours.
    • Bidders submit ether and a sealed bid (the hash sha3(bytes32 hash, address owner, uint value, bytes32 salt)).
    • A bidder may send more ether than the actual bid amount to conceal the bid.
  4. Reveal

    • A 48-hour reveal period follows the bidding period.
    • During this period, bidders must disclose the actual contents of their sealed bids.
    • Ether is refunded after the bid is revealed.
    • If no bid is revealed, the name returns to the open state.
  5. Owned

    • After the reveal period, the winner submits a transaction to finalize the auction. The ENS setSubnodeOwner function records the winner's address as the owner of the name's hash.

The ENS auction proceeds through these stages with the aim of allocating domain names fairly.

Registrar parameters

The initial ENS registrar uses the following auction parameters.

Name Description Value
totalAuctionLength Total duration from the start of an auction to the end of the reveal period. 5 days
revealPeriod Duration of the period during which bidding is prohibited and bids must be revealed. 48 hours
launchLength Period over which all names become available for auction. 8 weeks
minPrice Minimum amount of ether that must be locked in exchange for ownership of a name. 0.01 ETH

totalAuctionLength (total auction duration)

The total period from the beginning of the auction until the end of bid revelation is five days.

revealPeriod (reveal period)

During the final 48 hours of the auction, bidders reveal their bids. New bids are not accepted during this period.

launchLength (launch period)

The eight-week period determines how long it takes for all domain names to become available for bidding.

minPrice (minimum price)

The minimum amount of ether needed to own a domain name is set to 0.01ETH.

These parameters explain how ENS auctions operate. An auction lasts five days, with the final two days reserved for revealing bids. It takes eight weeks for all names to become available, and at least 0.01ETH is required to acquire a name.

Deeds

In the initial ENS registrar contract, a Deed is a separate contract that performs specific auction-related functions. Its roles are described below.

Role of deed contracts

The initial registrar contract itself does not hold ether. All ether used in auctions is managed through separate deed contracts. A deed contract is created when a bid is submitted and is funded with that bid.

Processing after an auction

Once an auction ends and a particular hash has been registered, the winning bid's deed is retained in exchange for ownership of that hash. Unsuccessful bids are refunded.

Transfer of ownership

The owner of a registered name can transfer its deed to another account. This transfers ownership and control of the name to the new account.

Relinquishing ownership and recovering funds

One year after registration, the owner of a hash may choose to relinquish ownership and recover the value held in the deed.

Closing deeds for unsuccessful bids

Deeds for unsuccessful bids can be closed in several ways. When a deed is closed, its ether may be returned to the bidder, burned (burn), or sent to someone else as a reward for actions that help the registrar.

The deed system is an important mechanism for conducting ENS auctions fairly and transparently.

Refund schedule

The following table summarizes the refund schedule when deeds are closed in the initial ENS registrar contract.

Reason for closing a deed Refund recipient Refund percentage
A valid unsuccessful bid is revealed Bidder 99.5%
A bid submitted after the auction period is revealed Bidder 99.5%
A valid bid for an already-owned name is revealed Bidder 0.5%
An expired sealed bid is cancelled Canceller 0.5%
A registered hash is reported as invalid (reporter) Reporter 50%
A registered hash is reported as invalid (owner) Owner 50%

Notes

  1. These rules encourage bidders to reveal all bids on time. Late revelations could otherwise create opportunities to blackmail the highest bidder.
  2. Anyone may cancel a bid that has remained sealed for more than two weeks and five days and receive a small reward.
  3. Because names are hashed before auctions or registration, the initial registrar cannot independently enforce name length restrictions. A reward is provided for reporting invalid names.

Deployment and upgrade process

The following describes how the initial ENS registrar contract is deployed and upgraded.

Deployment of the initial registrar contract

  • The initial registrar contract is deployed after ENS itself has been deployed.
  • The contract takes the ENS address as a constructor argument.
  • After deployment, the multisig account controlling the ENS root node sets the initial registrar contract's address as the owner of the .eth node.

Upgrade process

  • The initial registrar contract is expected to be replaced by a permanent registrar contract approximately two years after deployment.
  • After the permanent registrar contract is deployed, the multisig account controlling the ENS root node transfers ownership of the .eth node to the new registrar.
  • Owners of hashes registered through the initial registrar are responsible for transferring their deeds (representing domain name ownership) to the new registrar.
  • Potential migration approaches include requiring transfers before a specified deadline or allowing the new registrar to retrieve ownership information from the initial registrar as needed.

This upgrade process enables ENS to evolve and provide a more efficient and functional system.

Planned deactivation

The following describes the planned deactivation of the initial ENS registrar contract.

The initial registrar contract stops accepting new auctions four years after deployment. This is intended to facilitate a smooth transition from the initial contract to the permanent registrar.

Eight years after deployment, all ether held in deeds becomes inaccessible. The planned deactivation is intended to allow ENS to adapt to new technologies and requirements.

These deactivation provisions are intended to support the continued evolution and sustainable operation of ENS.

Registrar interface

The initial ENS registrar contract provides the following interface functions.

state(bytes32 _hash)

Returns the current state of a particular name (hash), such as auction or owned.

entries(bytes32 _hash)

Returns detailed information about a registered name. This includes its state, deed address, registration date, deed balance, and highest auction bid.

getAllowedTime(bytes32 _hash)

Returns the time at which a particular hash leaves the not yet available state.

isAllowed(bytes32 _hash, uint _timestamp)

Determines whether the specified hash has left the initial not yet available state at the given timestamp.

startAuction(bytes32 _hash)

Transitions a particular hash from open to auction. If the hash is not in the open state, the function reverts.

startAuctions(bytes32[] _hashes)

Starts auctions for multiple hashes. This allows bidders to start auctions for multiple dummy hashes alongside the one name they are actually interested in.

shaBid(bytes32 hash, address owner, uint value, bytes32 salt)

Takes the bid details (hash, owner, value, and salt) and generates the sealed bid hash required to participate in the auction.

newBid(bytes32 sealedBid)

A bidder sends a sealed bid hash and an amount of ether to the main contract. The hash incorporates the hash of the domain name, the bid value, and a random salt. A bid is not associated with a specific auction until it is revealed. Sending more ether than the actual bid value can conceal the bid amount. The reveal period lasts 48 hours. Bids revealed after this period are invalid, and the ether cannot be recovered as described in the original explanation.

startAuctionsAndBid(bytes32[] hashes, bytes32 sealedBid)

A utility function that starts auctions for multiple domain names and submits a new bid in the same operation.

unsealBid(bytes32 _hash, address _owner, uint _value, bytes32 _salt)

Reveals the bid details after the bidding period ends. The registrar hashes these details using shaBid() and verifies that the result matches an existing sealed bid. If a new highest bid is revealed, the previous highest bid is returned to its bidder.

cancelBid(bytes32 seal)

Cancels an unrevealed bid according to the refund schedule.

finalizeAuction(bytes32 _hash)

Finalizes an auction after it has ended and the registration date has passed, assigning the winning bidder as the new owner of the domain name.

transfer(bytes32 _hash, address newOwner)

Transfers ownership of a particular domain name (hash) to a new owner. Only the current owner can call this function.

releaseDeed(bytes32 _hash)

Allows the owner to relinquish ownership of a domain name and recover the ether held in its deed. This is possible after a specified period has elapsed.

invalidateName(string unhashedName)

Reports a name as invalid if it contains six or fewer characters. According to the original function description, if the report is accepted, the reporter receives 10% of the domain name's deed value as a reward. This functionality is designed with the expectation that the registrar contract will be replaced within a few years.

eraseNode(bytes32[] labels)

Deletes owner and resolver records for subdomains of a domain name that is not currently owned. For example, to delete the .eth subdomain foo.bar.eth, pass the array [sha3('foo'), sha3('bar')].

transferRegistrars(bytes32 _hash) onlyOwner(_hash)

Used during the upgrade to the permanent registrar. If this contract is no longer the owner of the ENS root node, it transfers the deed to the current owner (the new registrar). If it is still the owner of the root node, the function reverts.

Additional considerations

The following explains the rationale for introducing the initial ENS registrar contract.

The difficulty of perfect domain name allocation

It is unrealistic to anticipate every problem associated with domain name allocation and design a perfect system in advance. Rather than pursuing perfection, ENS therefore adopts an approach of learning and making improvements through actual operation.

Restricting names to seven or more characters

The shortest and most valuable domain names are reserved for use by an upgraded registrar. This creates an opportunity to implement dispute resolution mechanisms in the future.

Gradual release of names

Releasing domain names gradually provides time to identify and address problems that arise after launch.

Restricting the TLD to .eth

Focusing on a single TLD, .eth, maximizes network effects and concentrates user interest.

Benefits of a three-character TLD

Adopting the three-character TLD pattern commonly used for internet domain names makes it easier to integrate ENS with the existing DNS system and increases the possibility of reserving the TLD for special use.

Benefits of holding ether as collateral

Unlike a conventional model that requires periodic payments to maintain ownership of a domain name, holding ether as collateral makes the initial registrar a revenue-neutral service.

This approach is intended to allow ENS to adapt to evolving blockchain technology and support long-term operation.

Prior work

The document draws on several important sources to provide a deeper understanding of ENS.

EIP137

Describes the basic structure and functionality of ENS, particularly the initial implementation of its registry contract (ENS.sol) and associated resolver contracts.

ERC26

The earliest proposal for a naming service operating at the contract layer. It provides ideas and concepts that underpin ENS.

Hash registrar implementation by @alexvandesande

Provides an example implementation for allocating and managing ENS domain names. This implementation helps illustrate how ENS works and how it can be used in practice.

Revision history

  • 2016-10-26
    • Added a link to Alex's design to the overview.
  • 2016-11-01
    • Renamed the planned deactivation section.
  • 2017-03-13
    • Updated the information about bidding and reveal-period timelines.

These sources help explain the overall design of ENS, its operating principles, and its implementation.

References

Maurelian, Nick Johnson nick@ethereum.org, Alex Van de Sande avsa@ethereum.org, "ERC-162: Initial ENS Hash Registrar," Ethereum Improvement Proposals, no. 162, October 2016. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-162.

Conclusion

This article examined ERC162, the proposal for the initial Ethereum Name Service (ENS) registrar contract.

If you have questions, feel free to contact me via direct message on Twitter.

Twitter @cardene777

I also publish articles on other platforms:

https://chaldene.net/