Delphi and Ethereum Name Service (ENS)

Stefan
3 min readApr 3, 2019

--

Ethereum is amazing, breakthrough technology. For the 1st time in history, we can write financial apps that do what banks do (savings, loans, time deposits, insurances, mortgages, pensions, etc) without a bank.

While HTTP allowed anyone in the world to create an online service, ETH will allow anyone in the world to create a financial service.

Ethereum is decentralized and censorship resistant. The banks cannot shut the network down, and neither can governments.

But if we want the masses to adopt this technology, then we need the user experience to improve. For example: we need human-readable names. Nobody really wants to send money to (or receive money from) a long hexadecimal number. This is where the Ethereum Name Service (ENS) comes in.

ENS translates human-readable names to Ethereum addresses (and back). Because ENS is built on Ethereum, it is secure and decentralized. ENS eliminates the need to copy or type long addresses. With ENS, you’ll be able to send money to your friend at aardvark.eth instead of 0x4cbe58c50480...

ENS has an awesome domain manager where you can search for domains and optionally register a domain. In this article, we will register a domain on the Goerli test net. If you don’t know what Goerli is or how to create an account on the Goerli testnet, then please refer to this article.

Assuming you have an account in MetaMask on the Goerli testnet, we will now register a new domain.

  1. Click on the MetaMask icon
  2. Unlock MetaMask with your MetaMask password
  3. You should see the MetaMask main menu. In the top of this window, click on Ethereum Mainnet
  4. A popup window appears. Click on Goerli test network
  5. Navigate to https://app.ens.domains/
  6. Make sure MetaMask is connected to app.
  7. Enter your name in the search bar ending with .eth, for example: delphi.eth
  8. Assuming the username is available, click on it
  9. Complete a transaction to secure your name

Congratulations! You have successfully registered a domain on the Goerli testnet. Please note that because you registered the domain on a testnet, the domain only belongs to you for 28 days. Once expired anyone can claim it.

We will now turn our attention to Delphi. While all of the low-level ENS functions are available in web3.eth.ens.pas, you don’t really need to understand those. Delphereum abstracts all of the complexities related to (reverse) lookup away from the developer.

When you instantiate a new Ethereum address, you can give Delphereum a hexadecimal-encoded address or a human-readable name. Should you give the latter, Delphereum will then lookup the Ethereum address under the hood. Here’s a simple example:

When you run this example, you should then be greeted with this dialog, displaying the Ethereum address for thecoinoffering.eth

Let us now go one step further. Every time a user might otherwise see an Ethereum address, they should instead see an ENS domain name. Here’s how to accomplish that in Delphi:

When you run this example, you should then be greeted with this dialog, displaying the ENS domain name for 0xa0400ba66b4f...

Congratulations! You got rid of long, cryptic addresses. Your users can just type a friend’s name and they are done. That’s a small change for man with a big psychological impact for mankind.

--

--

Stefan
Stefan

Written by Stefan

Delphi/Rust/Go developer. Ethereum consultant. Embarcadero MVP. Ex-Adobe, Macromedia. Helped build 1Password.

Responses (1)