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 |
|
| |
ETH Registrar Controller |
|
| |
ETH Base Registrar |
|
| |
Public Resolver |
|
| |
Reverse Registrar |
|
| |
Reverse Resolver |
|
|
Use the Energy Web ENS Manager app
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