[Ethereum] Best practice for guaranteeing an NFT is non-duplicate

erc-721nft

So I'm working on an NFT project that will eventually create a collection of approximately 3000 different unique NFTs. Kind of like cryptopunks.
Besides the ERC-721 contract, there will also be a server hosting a website where people will be able to go to mint said nft, as well as having the logic to generate the nft itself.
The issue I'm facing now is: how exactly can I guarantee the image will be 100% unique given 3000 or so possible combinations? I'm not quite sure if the information on the already-minted NFTs should be held serverside or in the ERC-721 contract itself. Having the information on the contract does seem to make more sense, but wouldn't that be a bit heavy? That would mean that whenever interacted with, the contract would know which NFT attributes have already been used for minting and would avoid minting a new one with any of those.
Is this the best way to approach it? Am I missing a best-practice?

Thanks!

Best Answer

There's a few ways to do it that I've seen.

  1. Use attributes

All the attributes are stored succinctly into one variable of 256 bits. If you can create a repeatable process to create an image from attributes and you can guarantee that every different valid input creates a separate image then you're good. It is trivial for the smart contract to validate non-duplication. (See CryptoKitties)

  1. Precalculate

You can precalculate all possible images. Then as tokens are minted the guaranteed-unique image is available. The entire set can be committed up-front, even if not publicly known. (Related to CryptoPunks)

  1. Trust

As new tokens are minted they do not have any image at all. Then, asynchronously, you will create and publish those images. The smart contract does zero validation here and people must trust you.

Related Topic