How ENS Registration Works
October 18th, 2022

🧠 Trade 6 min. Get a deep understanding of ENS Registration.

🔥 ENS, what is it?

  • The Ethereum Name System (ENS) is a way of assigning a human readable name to an Ethereum Address.

  • For example, the ETH address 0x625e5a7cd2e3beecf0f89b60dfee88097b9b86b2 can also be identified as brokendown.eth.

  • In many ways it is quite similar to the traditional DNS (Domain Name System) where the IP address 1.1.1.1 can also be identified as cloudflare.com.

  • For this article, we’ll focus on the .eth extension.

🤩 I read the smart contract so you don’t have to!

📖 Registration Steps

ENS (.eth) name registration takes place via 3 interactions against the ETHRegistrarController contract.

  • #1 is a call to makeCommitment. (not written to chain)

  • #2 is a transaction to commit.

  • #3 is a transaction to registerWithConfig.

The current contract can be found on the ETH mainnet at this address: 0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5

🏗️ Make Commitment

  • makeCommitment bundles your registration details into one “secret” value. This is known as a “commitment”. One purpose is to obscure the name you’ll register.

  • An interesting note: The call does not read or write data to the blockchain. No data storage is used. As a result it can be invoked with 0 gas cost.

Registration Details:
---------------------
MyNewName.eth,
0x625e5a7cd2e3beecf0f89b60dfee88097b9b86b2,
someRandomSecret
Commitment "Secret":
---------------------
0x83f42c35570687e66e4f63008fa4d7bcc899d98dc656ffd8d6d3cd1d4108a

📥 Commit

  • We now store your commitment “secret” on chain. This, so the same name is not registered twice. We do this via commit.

  • Then we wait 60 seconds (otherwise contract will ignore our attempt to register).

commit('0x83f42c35570687e66e4f63...c656ffd8d6d3cd1d4108a')

✉️ Register

  • The last step:

  • Finally we make a transaction to register and (at the same time) provide ETH as payment. A number of checks are made:

    • ℹ️ was a valid commitment “secret” provided? (prev step)

    • ℹ️ is the name still available?

    • ℹ️ was the correct ETH fee paid?

  • Once all checks successfully pass:

    • ✅ A resolver is set. A resolver is another smart contract that handles the “routing” of your name. Often, ENS handles this.

    • ✅ The corresponding ERC-721 token (NFT name) is transferred to you.

    • Any ETH amount sent over the actual cost of the name is automatically refunded to you.

💜 That’s all! Now you know the major secrets to ENS Registration!

😊 Fun Facts

  • There is no size limit to an ENS (.eth) name. You could take your ETH address and register it: 0x625e5a7cd2e3beecf0f89b60dfee88097b9b86b2.eth

  • There is no upper limit (number of years) you can register a ENS name for.

Subscribe to Broken Down?
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.
More from Broken Down?

Skeleton

Skeleton

Skeleton