Linking IPFS in ERC-721

Hello guys,

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 :smile:

If the contract is going to be a single NFT, I guess it doesn't make a difference whether you use a directory or just a file link.

If you want to use a file link, you don't need to set the base URI (which is useful for directories), you can just leave it empty.

I don't think this would cause issues. Maybe if you load it on a site like OpenSea they're going to cache the metadata, and if you update it later you would have to flush their cache somehow.

1 Like