Discover more from Cronos Newsletter
Cronos Developer Series: How to Integrate Your dApp with Cronos ID Domains
What is Cronos ID Domains?
What is Cronos ID Domains?
Like ENS on the Ethereum mainnet, Cronos ID Domains is an implementation of EIP-137 on the Cronos mainnet chain. It is a dApp powered by smart contracts on the Cronos chain.
For the convenience of end-users, Cronos ID can be used via a front-end interface available at https://cronosid.xyz. Developers can interact directly with the smart contracts, of course.
Essentially, Cronos ID is an on-chain registry, which links wallet addresses (= complicated text string starting with
0x...) with human-readable domain names (= something like
mydomain.cro) and vice versa.
Why integrate Cronos ID with your dApp?
In summary, there are 3 key reasons to integrate Cronos ID with your dApp:
Cronos ID is incubated by Cronos Labs, the ecosystem accelerator of Cronos chain, and can be considered the canonical decentralized domain repository of Cronos chain. However, Cronos ID is not meant to be limited to Cronos chain, and will ultimately be multi-chain.
Crypto.com is planning to support the Cronos ID .cro domains within their consumer products (Crypto.com app, Crypto.com DeFi Wallet). Therefore, many Crypto.com users will also expect to find their self-custodial crypto address associated with their .cro domain name within the various dApps that they interact with.
The next Cronos ID features, notifications and messaging to wallets, are highly convenient features for dApp users, that will save dApp developers many hours compared with developing these features themselves.
Several thousand Cronos users have already purchased one or more Cronos ID domains. In the short term, these users may find it convenient, fun, and highly engaging to benefit from an enhanced user experience when they interact with your dApp. It’s all part of the mission of Cronos chain to make DeFi, NFTs and Gaming very, very easy for end-users.
When they log into your dApp, they will see their Cronos ID domain instead of their
0x...wallet address in the navigation bar of your dApp.
When they use your dApp to send or receive digital assets like tokens or NFTs, they will be able to enter a Cronos ID domain in the dialog box instead of the dreaded
Considering that Cronos ID domain owners are among the most active Cronos chain users, you may find that it could make sense, from a marketing standpoint, to target them with dedicated campaigns such as when you create an allow-list for your NFT collection.
Additionally, integrating with Cronos ID means that your dApp will soon be able to take advantage of some of the more advanced social features that Cronos ID has on their roadmap such as:
Cronos ID Notifications: this feature will enable you to notify your users simply by knowing their wallet address. This can be useful to let your users know that they have received a bid for their NFT, have lots of tokens available to harvest from a DeFi farm, or are about to be liquidated on a decentralized lending/borrowing protocol.
Cronos ID Messaging: this feature will enable users to communicate with each other, or with you, via their wallet address.
How to integrate Cronos ID with your dApp?
The Cronos ID team have published their draft documentation at https://docs.cronosid.xyz/. They will soon publish more detailed instructions on how to integrate the Cronos ID features with your dApp.
Meanwhile, we are sharing a simple Node (Typescript) repository to help dApp developers understand how they can interact directly with Cronos ID or any equivalent domain protocol that works like ENS.
The demo script demonstrates the main ways that you may want to interact with the Cronod ID domains protocol:
First, the script listens to the events emitted by the domain minting smart contract in order to find out what are some of the new domain names that have been minted within a specific block range on the Cronos mainnet chain. This can be fun!
Then, the script takes an arbitrary domain name (web3developer.cro) and completes forward resolution, meaning that it queries the Cronos ID domain registry in order to determine the wallet address who is the owner of this domain.
Finally, the script completes a reverse resolution, meaning that it uses the Cronos ID domains registry to find out what is the domain name associated with a given wallet address. As reverse resolution is not a sufficiently strong proof of ownership, the reverse resolution is followed by forward resolution, again, to check that the wallet address is indeed the owner of this domain.
Does it work on any EVM-compatible blockchain?
Generally speaking, if a user owns an EVM wallet address on Cronos chain, it means that they control the seed phrase or private key associated with this address on any EVM-compatible chain.
Given that Cronos ID is just a registry that maps EVM wallet addresses to human-readable domain names, this mapping is valid on any EVM-compatible chain. In other words, if a user owns the Cronos ID domain and the EOA (= “externally owned account”) wallet address on the Cronos chain, you can assume that they also own the EVM wallet address on every EVM-compatible chain. You just need to make the forward and reverse resolution queries to the Cronos ID registry on the Cronos chain.
However, there is a caveat to be mindful of: if the wallet address is not EOA, it is not controlled by a seed phrase or private key. This is the case of multisignature wallets like the ones provided by Gnosis Safe or Cronos Safe, which are in fact smart contracts. In that case, even if a user controls the multisignature wallet address on one chain, they do not possess its private keys and do not control the same address on every chain because the corresponding multisignature smart contract has not been deployed to every chain. It is important to be mindful of his limitation, which applies to all EVM chains (see here how Optimism tokens were lost because of a chain confusion when using a Gnosis Safe wallet).
In the tutorial repository, the authors have provided a simple function
isSmartContractAddress to check if an address is an EOA or a smart contract. If the wallet address is a smart contract address, you should disable domain lookup on any chain that is not the native chain where the domain is registered.
Hope this helps !