Using the Ethereum Name Service

The Ethereum Name Service is available on Energy Web Chain and Volta Testnet

The Energy Web blockchain uses the Ethereum Name Service (ENS) for name-spacing assets that are anchored on our blockchain. ENS is a critical part of providing user-friendly dApps. You can interact with the ENS contracts that are deployed on the Energy Web Chain in several ways.

Below we explain:

Benefits of Ethereum Name Service

The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain.

Machine-readable blockchain identifiers such as Ethereum addresses, content hashes and metadata are difficult to interact with in a user interface. ENS was developed to provide human-readable, user-friendly mapping for these identifiers, and to give users the ability to reserve domain names for our applications. To date, it is the most widely used blockchain naming standard.

ENS solves a similar problem that Domain Name Systems (DNS) provide. DNS lets us navigate to a website using human language and an intuitive format (www.energyweb.org), rather than using an IP address that is impractical to remember and has no association with the content that it directs you to (104.26.13.227). Similar to DNS, ENS supports a structure of dot notation for hierarchy and nesting.

Using ENS, you can create identifiers for the following blockchain content types:

  • Address

  • Reverse address (e.g. an address resolves to alice.eth)

  • Content hash (e.g.: IPFS/Swarm hashes)

  • ABI definitions

  • DNS records

  • Public keys

  • Smart contract interfaces (see EIP 165)

  • Text (email, physical address, geo location, metadata)

You can see a full list here in the ENS documentation, as well as the specifications for resolving each type.

Examples:

As a simple example, if you want to send funds to your friend Alice, you can specify the recipient as “alice.eth” instead of “0x0052569B2d787bB89d711e4aFB56F9C1E420a2a6”.

If you want to refer to a content hash of a report listed at your custom domain, you can refer to it has “myReport.myDomain”, instead of by the hash identifier.

The two main components of ENS, explained below, are responsible for storing the human-readable address in smart contract registry, and resolving it to its original content.

Main Components of ENS

ENS has two primary components: the Registry and the Resolvers.

Registry

A smart contract that holds all of the domains/subdomains, the owner of the domain, and the domain resolver (the method used to map it back to its original address.) You can see the ENS Registry smart contract here.

Resolvers

Methods that translate the human-readable names to their original address. A resolver has multiple methods, each of which are responsible for resolving different types identifiers (for example, one method is responsible for resolving contract ABI definitions , one method is responsible for resolving content hashes.)

  • You can see the ENS smart contracts for all of the resolver types here

  • You can read more about the Registry and Resolvers in the original documentation here

What’s important to take away is that the two primary components for ENS are smart contracts that hold a mapping for all domains/subdomains, and provide resolver methods for translating different address types to a human readable form. These contracts are extendible, so you can add your own resolvers for different address types.

ENS on the Energy Web Chain

Energy Web has deployed the ENS smart contracts on the Energy Web mainnet and Volta testnet. You have several options for interacting with ENS, depending on your use case.

Interact directly with the smart contracts on the blockchain

Contract

Source

Volta address

EWC address

Registry

0xd7CeF70Ba7efc2035256d828d5287e2D285CD1ac

0x0A6d64413c07E10E890220BBE1c49170080C6Ca0

ETH Registrar Controller

0xb842CCA1682DC2Ee6A9da6A59bA4B5C736b229cD

0x9C99a28D3d702E6096361Ff31E724b772B5D709e

ETH Base Registrar

0x5630EBDbf41624fF77DcBfC4518c867D93E42E9f

0x3BDA3EE55a5b43493BA05468d0AE5A5fF916252f

Public Resolver

0x0a97e07c4Df22e2e31872F20C5BE191D5EFc4680

0xA517983Bd4Af4DF0Ed9b52DA4BC405d0A95eE7E2

Reverse Registrar

0xff7Befa016689dC5D89165867a65CF26B73e6514

0xcB9BCAa8010F51D6484570B99B127e8a26B6B468

Reverse Resolver

0x775e2a91501cdadeA65BF8eBb94a82529Fc2C34B

0x0C12c9087342DafE42b28A93998CEd711DC9a614

You can use this interface to search for available names in the Energy Web domain and register them to your address. Note that you will need to have sufficient funds in your wallet to do so as there is a fee for name registration.

Our management app is forked from the Ethereum Name Service Manager app.

Use a JavaScript library

There are a number of libraries that support ENS. These libraries have methods to configure your registry, and manage and resolve names. The IAM client library and IAM Cache server both connect to ENS using the ethers library. You can see the Ethers API support for ENS here.

For a full list of libraries that support ENS, see the ENS documentation here.

Additional Resources

Last updated