How to ensure fair distribution of pre-generated ERC721 tokens?

I'm trying to create a contract for my ERC721 collection that ensures (within reason) that tokens will be minted fairly and that we have no control over the order or the metadata beyond the initial image generation.

The way I was thinking to do this was:

  1. Generate images offchain
  2. Calculate provenance hash and set in contract as constant (since this shouldn't ever change)
  3. Randomize starting index so metadata is not mapped 1-1 with token ID (as discussed in this thread)

The biggest downside with this approach for me is that I won't be able to use the token ID as part of the metadata since this won't match the token ID directly, but the only way I can think to get around this is:

  • Set provenance hash later, after getting the starting index. Not the best since there's no guarantee that we didn't just change the order.
  • Assign 'random' token IDs when minting instead of sequencial. This way I can avoid doing the starting index randomzation but will require extra logic + gas to mint.

Is there another way to do this?

Thanks in advance.

If just: " Set provenance hash later, after getting the starting index. Not the best since there's no guarantee that we didn't just change the order."

You can put a immutable merkle root hash as verify

Can you elaborate a bit more please? The merkle root can change if I reorder the hashes so as I understand I'll still have the same issue as using just the hash.

Just make sure the root hash of the pre-generated part doesn't change

Change the metadata and its uri after the starting index is set.

Are you saying that using your method to ensure fair distribution, we can overcome the drawbacks by changing the metadata and uri to correctly reflect the index of the NFT (with respect to the starting index)?