Gas cost optimization in 1/n ERC721

Hi @bahlsenwitz,

Welcome to the community :wave:

Yes. The OpenZeppelin Contracts ERC721 implementation supports:

  • tokenURI
  • baseURI + tokenURI
  • baseURI + tokenID

If you were using centralized metadata (e.g. from a server) then the lowest cost minting is just setting a single baseURI.

If you are using decentralized metadata (e.g. IPFS) then you could override the tokenURI function (from Release Candidate for Contracts 3.4) to return your IPFS.

Using either baseURI + tokenID or a single IPFS hash for the entire contract would reduce the cost of minting as you wouldn't need to store any metadata onchain for each token ID.

Not that I am aware of. You should test this with any services that you want to use (e.g. OpenSea) and what format you need to use for the URI when using IPFS.