1

Im currently onto developing my own NFT. It will be only one NFT in the contract with the ID "0".

First of all, do you see problems in adding the URI to the NFT after minting it (it has to do with the use behind it)?

Second: What would be the best approach to link the NFT in the IPFS. Should it be linked through a directory or directly (ipfs/directory-hash/token-id or ipfs/file-hash)

As I see the latest OpenZeppelin-Standard implies two Attributes: The Base-URI which is initial, and the tokenURI. Now should the Base-URI in that case be "ipfs/" or in the other case the "directory-hash". Or should the Base-URI be just ipfs/ and the token URI the hashed file without the directory.

Another possibility would be that the Base URI would be the gateway to access the file, but I would rather put the gateway on the Webapp.

I would really appreciate to hear some opinions and best practices :)

2

So regarding NFTs, the best practice would be able to have the following:

  1. Upload your Metadata info to a folder in IPFS and get the CID of the directory. the name of the file should be like <tokenId>.json
  2. Add the CID to the smart contract as a base URI like ipfs://<CID>
  3. Now during query to tokenURI function return ipfs://<CID>/<tokenId>.json

Now also make sure initial NFT drops may have bugs, so the best practice is to have the ability to change these baseURI and lock it once all data is final and are correct.

This will prevent you from redeploying the contract in case of any mistake in JSON. Also, you cannot edit any files in your IPFS folder after deployment.

2
  • Exactly what I was looking for, thank you for your tips :)
    – Luex
    Nov 5 '21 at 14:20
  • great ! you can also refer the freeze URI event in-case you wish to show that you're base URI is permanent on opensea. docs.opensea.io/docs/metadata-standards Nov 5 '21 at 15:52

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.