I am looking at many existing NFT projects and I see that they set base url to point to a IPFS with metadata that also has the pointer to the png. All of these projects also simply mint id being equal to
totalSupply() + 1 on each mint. That means given the base URI and appending an id of the next token to be minted you should be able to see what token you would mint or it's rarity. This is in no way fair.
So far I know only of few solutions:
- Set the baseURI to some placeholder metadata and once you are fully minted set the baseURI to actual tokens. The down side is that you can indefinitely wait to be fully minted.
- Generate and upload the files to IPFS as some one is minting. You would need to listen to the on chain events and run a backend for that. Might become complex.
- Upload a random sequence to the contract so you mint not just
N+1index but a
sequence[N+1]. Problem is that people will see the sequence in constructor arguments for example.
- Set baseURI to the backend that queries the NFT's contract for it's total supply and only responds with metadata if the id of requested token is already minted. This will be a bottleneck to call blockchain every-time someone requests metadata until the collection is fully minted and you can set the baseURI direclty to IPFS.
My question is what is the most optimal way to deal with this problem without building a super complex infrastructure around it. May be there is already an elegant solution to this that I am just not aware of?