How to integrate ENS in DApp? Understand these three main methods

By April 30, 2021DApps
Click here to view original web page at blockcast.cc

31 total views

Learn how to integrate ENS in DApp through case practice.

Original title: “Introduction | Best Practices for ENS Integration”
Written by: makoto_inoue
Translation: Ajian

There are already more than 200 services integrated with ENS, so this article wants to show how dApps can make good use of ENS.

In our document, we have listed three main ways to integrate ENS. Here we also use the same expression.

Resolve ENS domain names

The first step in supporting ENS in an application is to make your application understand the ENS domain name, and support the use of ENS domain names wherever addresses are needed. This is especially useful for wallet services.

Please see the analysis result on meyetherwallet.com

Etherscan is one of the most commonly used Ethereum-related websites, where you can review all your transactions and account balances. In addition to searching for ENS domain names, a feature that few people know about is that their URLs also support ENS domain names, so you can directly enter “/address/matoken.eth” in the address bar.

When someone asks my Ethereum address, I always give them my ENS domain name, but not everyone knows what ENS is and how to use this name. If you have many Ethereum addresses, giving the complete Etherescan URL with your domain name will be a good bibimbap to bridge the gap in knowledge. It’s very simple for you. Just enter or copy the URL with your domain name. You don’t need to always remember which address is used for what, and people who want to interact with you don’t need to know what ENS is.

Reverse analysis

The second level of ENS integration is reverse resolution, where the ENS domain name is displayed where your application displays the address.

This feature can be implemented on three levels.

Display the ENS name of the user in the login

Uniswap will display your ENS name as your username. This is another case where ENS helps users distinguish clearly when using multiple Ethereum addresses, because which account you are using will be clearly displayed.

Display the ENS name of the asset owner/creator

This feature is closely related to the NFT market. Each NFT market has its own username system, but your username on Foundation cannot be displayed on other NFT platforms (such as OpenSea and Rarible).

But the ENS name displayed on the KnownOrigin platform can also be displayed on OpenSea. In other words, the ENS name is a portable user name.

However, not all NFT platforms provide such support, but it is very useful for NFT artists because they need to build a brand and identity on the chain.

If you are playing on an NFT platform that has not yet integrated ENS, please suggest that they integrate ENS, because this is your autonomous identity! No ENS, no name on the chain!

Display the ENS name in a series of Ethereum addresses

The list of Ethereum addresses may be a history of transactions, or a list of asset owners, a list of DAO members, a list of voters, etc.

Snapshot prioritizes the user name chosen by the user on their platform when displaying the voting results, but if there is no such dedicated user name, it will return the ENS name.

Let users name themselves

The final step of comprehensive ENS integration is to help users associate the ENS domain name with the resources created or managed by your application. It can take two forms:

domain registration

Let your product get an ENS name, and allow users to easily register subdomains, and your users can name the resources created in your dApp.

Many wallet services, such as Argent and Authenticreum, have helped users create subdomains under the product domain name, but the recent high gas/eth price makes the whole thing unsustainable because they have to help users pay for gas (we are developing L2 specification , Can alleviate the difficulties in it). Status does not allow users to obtain domain names for free, but sells them to users at the price of SNT tokens.

A more novel approach comes from Decentraland. They will not only issue subdomains under the main domain name of dcl.eth , but also .eth these domain names into NFTs. Just like the .eth top-level domain, all users can buy and sell these subdomains on secondary markets such as OpenSea.

Domain name update

Provide users with a simple way to allow them to point their existing domain names to resources created in your application so that they can reassign their domain names.

SnapShot also uses ENS in this way, such as https://snapshot.org/#/gnosis.eth .

They use ENS plain text records wherever you specify IPFS endpoints.

Other: cross-chain support

Although we already support parsing the address types of blockchains in 100, we still need the wallet service to integrate our functions so that users can use it.

TrustWallet is one of the first multi-chain specific wallets to support us, so you can send BNB to vikmeup.eth .

Another use for supporting ENS is when your application is deployed on sidechain/L2.

Nifty.ink is a kind of NFT Tuya service, deployed on the xDAI sidechain, and they have integrated ENS.

We are currently developing the L2 approach, and the advantage of this architecture is that anyone can query the ENS name on L1, but can update the ENS record on L2 to save gas.

Although we have not found an easy way to update the ENS record from the side chain, it is still a good integration method to be able to read the ENS information directly on L1.

to sum up

We showed a number of dApp cases that integrate ENS and provide a good experience for end users. Although it is difficult to support all three levels, all wallets should support “1. Resolve ENS domain names”, all DeFi projects should support ” 2.1 Display ENS names under user login status “, and all NFT platforms should support ” 2.2 Display ENS name of the asset owner/creator “.

Disclaimer: As a blockchain information platform, the articles published on this site only represent the author’s personal views, and have nothing to do with the position of ChainNews. The information, opinions, etc. in the article are for reference only and are not intended as or regarded as actual investment advice.

Let’s block ads! (Why?)

Leave a Reply