I want to mint nft with a custom structure :

  • 1 ipfs link to a png image
  • 1 ipfs link to a xml file
  • 1 ipfs link to binary file
  • 10 key/value pair

How can i do that ? can i use erc721 or use other one ?


1 Answer 1


You can use ERC721. You'd have 3 ways to go about it I think:

Create functions like tokenURI that would return the wanted address of the file.


Create a structure that stores those info. And store it in a mapping. Something like:

Struct additionalInfo{
 string xml;
 string bin;

mapping(uint=>additionalInfo) public tokenInfos;  ///tokenId to additionalInfos

Last way is like Casareafer said to do it offChain and simple intergrate this data in the metadata file.

Either onChain or offChain you'd have to write function in the front that can access this.

  • additionalInfo seems to be the good way but where i put it in my nft ? _mint(signer,tokenId); _setTokenURI(tokenId,uri); Because the mint have just these 2 methods
    – Cryptopowa
    Nov 24, 2022 at 10:09
  • 1
    this is valid, however I'd suggest this to go on the Metadata of the token since storing information in the blockchain is not cheap; I'd create a Metadata json file, upload it to IPFS through any platform and then store the IPFS CID in the contract
    – Casareafer
    Nov 24, 2022 at 10:55
  • If you wanted to do it onChain you'd have to create those functions (that would return the metadata address) yourself.
    – Torof
    Nov 24, 2022 at 11:21
  • @Torof but the metadata of a NFT are only : Name, Symbol and tokenURI. How to have additionalInfo inside and get/set this new data ?
    – Cryptopowa
    Nov 24, 2022 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.