Delphi and Ethereum Name Service (ENS)

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.

And because Ethereum is pretty much decentralized (more so than other blockchains), it is censorship resistant and therefore unstoppable. 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 Ropsten test net. If you don’t know what Ropsten is or how to create an account on the Ropsten test net, then please refer to this article.

Assuming you have an account in MetaMask on the Ropsten test net, 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 Main Ethereum Network
  4. A popup window appears. Click on Ropsten Test Network
  5. Navigate to https://manager.ens.domains/
  6. Enter your name in the search bar separated by dots and ending with .test, for example: wendy.appleseed.test
  7. Click on Search
  8. Click on Claim

Congratulations! You have successfully registered a domain on the Ropsten test net. Please note that because you registered the domain on a test net, 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.

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

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