Developers Forum for XinFin XDC Network

XDC Web3 Domains
XDC Web3 Domains

Posted on

What should we pay attention to when deploying XRC721 smart contract on XDCNetwork?

From our practical experience when deploying xdcdomain on XDC Network, we realize the following precautions are needed to ensure your contract can be displayed well on Blocksscan and Dcent wallet:

1. Avoid using TokenId with too long numbers:
We used hashname algorithm to convert text to unit256 and used it as tokenId, everything works perfectly, data is fully stored on blockchain. However, cannot display these transactions. Reason:

Domain: blocksscan.xdc

tokenId is a number that is too long, so explorer may not be fully supported.

Advice: Please keep it simple and use Counters.sol of OpenZeppelin to solve the creation is to store tokenId with increment variable.

2. Returns url format when calling tokenURI function:

function tokenURI(uint256 _tokenId) public view returns (string) {
return Strings.strConcat(

Make sure that calling the tokenURI function with the tokenId parameter always returns the url format ""

If you return base64 and store the entire json of the metatdata when calling tokenURI, surely blocksscan and dcent will not fully support and lead to not being able to read the metadata.

3. Metadata needs to be standards compliant:

See the metadata-standard here:

Note the image parameters are very important for dcent wallet to show your NFT. So try to store both the image path and the base64 of the image if possible.

image: This is the URL to the image of the item. Can be just about any type of image (including SVGs, which will be cached into PNGs by OpenSea), and can be IPFS URLs or paths. We recommend using a 350 x 350 image.

image_data: Raw SVG image data, if you want to generate images on the fly (not recommended). Only use this if you're not including the image parameter.

4. "xdc" string will be converted to 0x when you write to smart contract

So the solution when you need to display the correct xdc string, you need to hard fix it in the smart contract or set the variable to bytes.

Thanks! Hope to be of help to you!

Discussion (0)