Solidity contract and mint-on-demand nft

I am working on a smart contract to mint-on-demand one (or a couple) nfts from a generative art collection of 1000. My plan is to pre-load the nfts and their json metadata to ipfs (via node.js or python), then from a web3 app, allow the user to mint 1-5 nfts in real time.

The issue, if I understand it correctly, is that the nfts/metadata files are numbered in order (1 thru 1000), corresponding with the tokenId that will be generated when one is minted, and if they proceed in order, a savvy user could look at the ipfs collection and know which nfts are next in line to be minted.

The reason I'd pre-load the nfts/metadata is so the collection hash can be made permanent . Unfortunately, this would eliminate the possibility of uploading nft/metadata when the user mints, since the ipfs collection hash would change with each new file. (Right?)

So I'm wondering if there's a best practice here (git project, videos, blogs especially helpful). For example: randomizing the next tokenId at the time of the users mint. Of course this requires an array of tokenIds which would be updated each time we select one at random, which increases gas costs to write to storage.

1 Like