Just getting started and hoping to get some clarity ERC721/metadata/IPFS

Hi Guys,

I've been getting into developing smart contract and been really enjoying the journey. My current challenge is to try and deploy a little ERC271 smart contract that will have 100 unique images+metadata. I've done a lot of reading and watched a few tutorials and as a result I've got a few questions I've not been able to find answers to (or sometimes, too many varied answers). I was hoping someone with a bit of experience could share some of their knowledge, and hopefully any replies may help some others who have questions, too:

What is best practice when it comes to managing images and metadata for NFTs with IPFS? I saw a few people say they had their images stolen before they launched because they uploaded them to IPFS. From what I understand, if every token is unique, then it's best to have a folder on IPFS with all the metadata files and images stored within them. That way, the base URI is set, and then the metadata is just /. Is that considered a pretty reasonable approach? Further to this, is it worth (or possible?) only adding it to my local IPFS node so that I have the hash, but only pinning them to a service such as Pinata after minting, so that if I were to do a proper NFT launch, the images could then be revealed only after pinning?

Placeholder images – it's popular to have a placeholder image for people who have minted tokens, but the artwork has not yet been revealed. Was is best practice for managing this? If the tokenURI is set at the time of minting, would you be setting it to point to the same metadata/image, then need to have a separate reveal function, that would iterate through all the tokens to have a new URI? I'm keen to know how this is typically handled.

I have played around with the contract wizard on Open Zeppelin's site which you can choose to include ERC721URIStorage. If you check the box, it adds it as well as keeping ERC721.sol. However, on this page OZ has an example ERC721 contract that ONLY has ERC721URIStorage.sol…is ERC721.sol not required?

I have seen a few people mention that the ERC721Enumerable contract can result in much greater gas prices, is that correct? I'm not completely clear what the use case for Enumerable is vs the standard ERC271 contract. Does it just let you set a _baseURI() and then generate a unique URI from that? If so, is it not pretty easy to implement this with abi.encodePacked() to generate this at time of minting? Or am I missing something?

Royalties – I've seen OpenSea suggest adding it as metadata within your contract. Is that correct? Or is it something that should be implemented at the contract level?

Thanks in advance for any replies. I know it's a long post.



It's not required but it's recommended to add it for clarity. I've updated the docs now.

No, this would not scale. You could implement it by changing the base URI so each token automatically points at a different file.

I'm not 100% familiar with OpenSea but as far as I know this is correct. Note that OpenSea has their proprietary royalty metadata format. There is a standard now in EIP-2981 that we will support in our next release, but it's not yet widely supported by all marketplaces.

I don't think this is worth it, but I don't know what's the state of the art for revealing the images later.

I'm not an expert in these topics, hope these answers help somewhat.