ERC-162 · Final · ERC · 2016-10-25
ERC-162: Initial ENS Hash Registrar
Described the first .eth name registrar for ENS, which allocated names through sealed-bid Vickrey auctions with ETH locked in per-name deed contracts.
What problem does it solve?
The Ethereum Name Service (EIP-137) maps human-readable names like alice.eth to addresses. ENS itself is only a registry. Someone has to decide who gets each name, and a new namespace invites a land grab, with squatters registering valuable names only to resell them.
EIP-162 documents the Initial Registrar, deployed to mainnet on 2017-05-04 to hand out .eth names. It was designed to be simple and temporary: learn from real usage for about two years, then replace it with a permanent registrar.
How it works
Restrictions. Only the .eth top-level domain was served, and only names of 7 characters or more. Shorter names were held back for later.
Hashed names. You bid on sha3(label), for example sha3('abcdefg') for abcdefg.eth, not the full ENS namehash. Because the registrar only sees hashes, it cannot check length itself. Anyone could call invalidateName with the plain text of a too-short name and earn a reward.
Gradual release. Names became available over 8 weeks. The first byte of a name's hash decided when.
Vickrey auction. Each name went through these states:
- Open: anyone calls
startAuction. - Auction (72 h): bidders send a sealed bid,
shaBid(hash, owner, value, salt), plus ETH. They may send more ETH than the bid to hide the real value. - Reveal (48 h): bidders call
unsealBidwith the real parameters. - Owned: the winner calls
finalizeAuctionand pays the second-highest bid. The minimum price is 0.01 ETH.
Deeds. The ETH is not paid to anyone. It is locked in a separate Deed contract for each bid. The winner's deed stays locked as collateral while they own the name. After one year, the owner can release the name and get the deed back. Losing bids are refunded at 99.5 %, and the rest is burned. Bids revealed too late, or never revealed, are mostly burned.
Sample code
Computing what the registrar expects, with ethers v6:
import { keccak256, toUtf8Bytes, solidityPackedKeccak256, randomBytes, hexlify, parseEther } from "ethers";
const labelHash = keccak256(toUtf8Bytes("abcdefg")); // the name being auctioned
const salt = hexlify(randomBytes(32));
const value = parseEther("0.5"); // true bid
// sealed bid = sha3(hash, owner, value, salt), as returned by shaBid()
const sealedBid = solidityPackedKeccak256(
["bytes32", "address", "uint256", "bytes32"],
[labelHash, myAddress, value, salt],
);
// newBid(sealedBid) with msg.value >= value, then unsealBid(...) in the reveal window
Things to know
- This registrar is historical. The spec planned to replace it after about two years and to stop new auctions after four. ENS has since moved
.ethto later registrar designs that charge a renewal fee instead of locking a deposit. - Revealing in time mattered. A bid revealed after the reveal window was mostly burned, so it could not be used to push up a winner's price.
- For how names resolve once registered, see EIP-137. For reverse lookups from address to name, see EIP-181.