Blockchain Semantics Insights
Business Case | Deep Tech | Announcements | Blockchain Glossary |
Ethereum Name Services (ENS)By Viswanath Kapavarapu | April 20, 2018, 2:51 p.m. GMT
Have you ever felt the need to have an abbreviated name instead of lengthy hexadecimal addresses to move Ether between multiple accounts? If so, the Ethereum Name Service is here to rescue.
The Ethereum Name Service or ENS lets the user send Ether to an abbreviated name. For example, one could register “arthtoken.eth” against a length hexadecimal address like “0x6B5EF50f0a7a8433b743211dF9058967F16408dD” and ensure users can send money to this address if they feel the need to do so. Moreover, such service can be used to redirect to popular services, such as smart contracts, Dapps, or any other resource one can think of.
ENS is entirely decentralized, meaning that users need to participate in an auction to register a domain name. All transactions related to auction are mediated by smart contract, ensuring domain names are registered in a fair and transparent manner. In this article, we shall discuss on how to register a domain name on Ethereum using ENS.
Domain Names in ENS are maintained with the help of smart contracts known as “Registrar”.
These registrars maintain a list of all domains and store information about each:
- The owner of the domain
- The resolver for the domain
- The time-to-live for all records under the domain
The owner of a domain may be either an external account (a user) or a smart contract. Owners of the domain are responsible for setting the resolver. Resolvers do the actual process of translating names into addresses.
ENS on Ethereum
ENS Registrar is deployed on mainnet at 0x314159265dd8dbb310642f98f50c066173c1259b, where users may register names using auction based registrar. ENS is also deployed on the Ropsten testnet at 0xe7410170f87102df0055eb195163a03b7f2bff4a. For the purpose of this tutorial, we will make use of Ropsten test network.
Step 1 - Check whether the domain is available:
Follow this link https://www.myetherwallet.com/#ens to open MyEtherWallet and search for the required domain name you want to register. After you click on the search button, MyEtherWallet will show you whether the domain is available, if it's owned or if it's in progress on auction.
Step 2 - Register the name
If the domain name is available, you can start the auction for the required domain name. To start an auction, you need the following pieces of data:
- Domain Name - The name you want to register
- Account Address - The account you are sending the bid from
- Bid Amount - The maximum amount you’re willing to pay for the domain name
- Secret Phase - A random ‘salt’ value
As Ethereum transactions are publicly viewable, your bid amount is visible to everyone present on the network. Therefore in order to disguise the actual bid amount, you need to decide upon “Bid Mask”, the amount of Ether you want to deposit with the bid. This “Bid mask” amount must be at least as much as the value of your bid, but can be more too. For example, you may deposit 2 Ether as masking amount even though the actual bid is 1 ether; this is to disguise the true value of our bid. When you reveal the bid later, you will get the extra 1 ether back.
Once you have decided on all the above parameters, you can proceed further, by clicking the blue button named “Start Auction”:
Next, you need to unlock your account through Metamask and a popup will appear in the Metamask wallet with the details of the transaction to be sent. Confirm the details of the transaction and click “Accept” button. After the transaction has been sent, make sure that it has been successfully mined. If it doesn’t happen because of low Ether or gas costs, correct the parameters and re-send the transaction. Hopefully, post the transaction, auction shall automatically start for the domain name on the Ethereum Registrar.
Step 3 - Placing your bid
Once the auction has started, bids can be placed up to 72 hours. During this period, anyone willing to claim the domain name can place a bid for the domain name. The details of the bid, however, will be kept secret until the bidder chooses to reveal the information. The process of sending bid is similar to the process in Step 1. After you have placed a bid, save the details of the bid as you will require those details at a later point in time.
During the bidding period, bids can be sent from an account address any number of times. This means that if at any point in time, you feel the need to increase the bid, you can re-send transaction to the smart contract with the updated bid amount.
Once the three-day auction finishes, a two day “reveal” period begins. During this period, everyone who placed a bid must reveal their bid. If they don’t reveal the bid by the time the reveal period ends, the entire deposit will be forfeited. Therefore it is necessary to reveal the bid before the auction ends.
Step 4 - Revealing your bid
To reveal the bid, you need to enter the bid amount and secret phase entered in Step 2 and then submit a transaction to the Name Registrar.
After revealing your bid, the auction will be updated. If your bid is less than a previously revealed bid, you will be refunded the whole amount of your bid except a minor amount 0.5%. If your bid is the highest bid revealed so far, you will be set as a current leading bidder. If you are outbid a later point of time, the amount will be refunded back to you.
Step 5 - Finalizing the auction
Once the auction has completed, it must be finalized in order for the name to be assigned to the winning bidder. The winning bidder has to finalize the auction with an amount equal to the second highest bidder.
After finalizing the bid, the winning bidder will be refunded the difference between their bid and the next highest bidder. If there is only one bidder, then the bidder gets all the amount back except a nominal amount of 0.01 Eth. Post finalizing, the winner is assigned the ownership of the domain name in ENS. If you have carefully followed the steps listed above, you should have the domain name registered against your account address.
Once the domain name is owned by your account, you can configure it like any other name using the domain name manager. In further posts, we shall explain how to configure domain name with a public resolver, also configuring the domain name for a reverse lookup.