Defichain Domain as NFT
Defichain Domains are ERC721 compliant non-fungible tokens, meaning that .dfi domains can be transferred in the same fashion as other NFTs.
Deriving tokenId from Defichain Domain name
The tokenId of Defichain Domain name is simply the uint256 representation of the hash of the label (stefano
for stefano.dfi
).
In the example above, 41131809834712302827435754041642146671014829310876022445023625856466056975581 is the tokenId of stefano.dfi
Deriving Defichain Domain name from tokenId
Unlike deriving tokenId, deriving Defichain Domain name from tokenId is not as easy. This is because all Defichain Domain names are stored as fixed-length hash to allow registering infinite length of names. The downside of this architecture is that you cannot directly query Defichain Domain smart contracts to return Defichain Domain name using tokenId.
Our recommended way is to query via Defichain Domain subgraph. The graph decodes the hash to name as it indexes. The example code to query is as follows.
NFT Subdomain NFT
Currently, all the subdomains are not NFTs.
Metadata
.dfi does not have .tokenURI
. However, we created a separate metadata service which NFT marketplaces can fetch metadata for Defichain Domain such as registration data, name length, etc.
Last updated