ERC-162 ENS Initial Hash Registrar (Initial ENS Hash Registrar)
Final · Names & metadata · created 2016-10-25
Defines the initial registrar that distributes .eth names of the Ethereum Name Service (ENS) through a sealed-bid auction. The winning bidder locks up ether as collateral and becomes the owner of the name.
Why it is needed
When a new namespace opens, a land grab tends to occur in which people claim names that look worth reselling. If valuable names are locked up without actually being used, the usefulness of the naming service itself shrinks. However, it is hard to know from the start which allocation method is best, and attempts to anticipate every problem and design perfect rules in advance are likely to fail. Moreover, a registrar holds ether without any limit, so it must be designed safely and must be replaceable to reflect lessons learned in operation. To meet these needs, this ERC describes an initial registrar that restricts the namespace to names of 7 or more characters under .eth, distributes names through a Vickrey auction, and assumes replacement by a permanent registrar after about 2 years. It is a standard that documents as is the implementation deployed to mainnet on May 4, 2017.
What to implement
function state(bytes32 _hash) constant returns (Mode): A state machine that returns the current state (mode) of a name hash.function entries(bytes32 _hash) constant returns (Mode, address, uint, uint, uint): Returns the state of a registered name, the Deed address, the registration date, the Deed balance, and the highest auction bid.function getAllowedTime(bytes32 _hash) constant returns (uint timestamp): Returns the time at which the given hash leaves the initial not-yet-available state.function isAllowed(bytes32 _hash, uint _timestamp) constant returns (bool allowed): Takes a hash and a time and returns true only if the initial not-yet-available state has passed.function startAuction(bytes32 _hash);: Changes the state of a hash from Open to Auction. Fails if the state is not Open.function startAuctions(bytes32[] _hashes);: Starts auctions for several hashes at once. Dummy auctions can be mixed in to hide the name you are actually interested in, and a dummy auction with no bids closes after 1 week.function shaBid(bytes32 hash, address owner, uint value, bytes32 salt) constant returns (bytes32 sealedBid);: Takes bid parameters and builds the sealed bid (sealedBid) hash needed to take part in an auction.function newBid(bytes32 sealedBid);: Places a bid by sending ether along with the sealed bid hash. You can hide the amount by sending more than your actual bid, and the bid is not tied to a specific auction before it is revealed.function startAuctionsAndBid(bytes32[] hashes, bytes32 sealedBid): A convenience function that calls startAuctions and newBid together in a single transaction.function unsealBid(bytes32 _hash, address _owner, uint _value, bytes32 _salt);: Submits the bid contents during the reveal period and verifies that they match the sealed bid. If it is a new highest bid, the previous highest bidder's ether is returned.function cancelBid(bytes32 seal);: Cancels a sealed bid that remains unrevealed, according to the refund schedule rules.function finalizeAuction(bytes32 _hash);: Finalizes the auction after the reveal period ends and calls ENS's setSubnodeOwner to record the winner as the node owner.function transfer(bytes32 _hash, address newOwner);: Changes the owner of the ENS node for the hash to a new owner. Only the current owner can call it.function releaseDeed(bytes32 _hash);: After a certain period has passed, the owner gives up the name and gets the collateral ether back.function invalidateName(string unhashedName);: Reports a registered name of 6 characters or fewer by its plaintext before hashing. The reporter receives part of the Deed value as a reward.function eraseNode(bytes32[] labels): Lets anyone clear the owner and resolver records for subdomains of a name that is not currently owned in the registrar.function transferRegistrars(bytes32 _hash) onlyOwner(_hash);: Moves the Deed to the new registrar when upgrading to the permanent registrar. Fails if this registrar still owns the root node.
In depth
Initial restrictions: .eth only and 7 or more characters
The initial registrar is designed to run for about 2 years. During that time the namespace is limited to the .eth top level domain (TLD), and this restriction is enforced by the owner of the ENS root node not assigning any node other than .eth to the initial registrar. The root node must be a multisig contract jointly managed by several parties. Registration of names of 6 characters or fewer is also prohibited. By leaving the shortest and usually most valuable names to the permanent registrar, they can be distributed later, after a dispute resolution process is in place, if that proves necessary. A single TLD concentrates on one namespace and builds network effects, and a three-letter TLD is a familiar form in existing DNS, which raises the chance that it will be reserved as a special-use domain, as with the precedent of .onion.
Hash submission format: sha3 of the label
The value submitted to the registrar is the sha3 hash of the label of the subdomain you want to register, not the namehash of EIP-137. For example, to register abcdefg.eth you must submit sha3('abcdefg'), and you must not submit sha3(sha3(0, 'eth'), 'abcdefg'). Because auctions and registration proceed with the name hashed, the registrar itself cannot verify the character limit. So when a name of 6 characters or fewer is registered, the restriction is backed up by rewarding anyone who reports the plaintext through invalidateName. The source states that deliberately limiting functionality this way forces the registrar to be rebuilt within a few years.
The 5 states of a Vickrey auction
A name's auction lifecycle is divided into five states. Not-yet-available is the state right after launch when a name cannot yet be auctioned, and release times are spread out according to the top byte of the sha3 hash, so that 0x00 opens immediately and 0xFF opens 8 weeks later. Once Open, an auction can be started, and in the Auction state a sealed bid of the form sha3(bytes32 hash, address owner, uint value, bytes32 salt) is submitted together with ether for 72 hours. In the Reveal state the bid contents must be revealed within 48 hours, and if no one reveals, the name returns to Open. After the reveal ends, the winner sends a finalize transaction and the name becomes Owned. The parameters are totalAuctionLength 5 days, revealPeriod 48 hours, launchLength 8 weeks, and minPrice 0.01 ether.
Deeds and the refund schedule
The registrar contract itself does not hold a balance. All ether sent is held in a separate Deed contract, and a Deed is created and funded when a sealed bid is submitted. The Deed of the winning bid is kept as the price of owning the name, and losing bids are refunded. The refund ratio differs by reason. A valid losing reveal and a reveal after the auction period return 99.5% to the bidder, a valid bid reveal for an already owned name returns 0.5%, cancelling an expired sealed bid returns 0.5% to the canceller, and an invalid name report gives 50% each to the reporter and the owner, with the rest burned. A bid that stays sealed past 2 weeks and 5 days can be cancelled by anyone for a small reward. One year after registration, the owner can give up ownership and get the Deed value back.
Blocking late reveals and dummy auctions
The refund for revealing a bid on an owned name is only 0.5% in order to make everyone reveal all bids on time. If late reveals were allowed, an attack would become possible in which someone extorts the current highest bidder by threatening to reveal a new second-highest bid. As the newBid description says, the ether of a bid revealed after the 48-hour reveal period has passed is burned and cannot be recovered. Meanwhile, startAuctions lets you open auctions for several hashes at once, so even if you are interested in only one, you can start it mixed in with dummy hashes. This raises the cost for an attacker who bids indiscriminately on every new auction. A dummy auction that is opened but has no bids closes after 1 week.
Deployment, upgrade, and planned deactivation
The initial registrar takes the ENS address in its constructor, so it is deployed after ENS is deployed, and the multisig account that owns the root node sets the initial registrar address as the owner of the eth node. After about 2 years it is replaced by the permanent registrar. The permanent registrar is deployed, the multisig assigns ownership of the .eth node to the permanent registrar, and existing hash owners must register their Deeds directly with the permanent registrar. Two options are under consideration: requiring the transfer before a deadline, and having the permanent registrar query the initial registrar when it has no record. transferRegistrars moves a Deed to the current owner (the new registrar) when this registrar is no longer the owner of the root node. To limit reliance on it, new auctions stop after 4 years, and after 8 years the ether remaining in Deeds becomes inaccessible.
Rationale for the ether collateral model
Instead of the familiar model in which you must pay repeatedly to keep a name, this design locks ether up as collateral. This approach is simpler and makes the initial registrar a revenue-neutral service that makes no profit. The price the winner pays is the second-highest bid under Vickrey auction rules, and the minimum amount is minPrice 0.01 ether. The collateral is not burned or collected as a fee. It is held in the Deed and returned when an owner who has held the name for at least 1 year gives it up. This standard was finalized with Final status and describes the implementation deployed to mainnet on May 4, 2017.