I would like to adapt my current contract to include a post mint image/metadata reveal feature. i.e. after an NFT is minted I would only then like the image/metadata to be revealed for that particular NFT.

Here is my sad attempt.


Any help or suggestions you can provide would be great.

3 Answers 3


Your best option is to use tho different URIs. One for the pre-mint containing the general image and then changing that URI to the one containing the real images. From what I see you can already do it in your contract, just use the changeBaseURI (string memory baseURI_) public onlyOwner function when you want to do the revel.


I'm not sure you need to do anything at all.

Your tokenURI function already starts with

 require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

If the token doesn't exist then the function will revert all by itself.

  • The problem with this is if all the files are already uploaded to IPFS, someone could snipe the rares once they know the base URI since most follow the format baseURI/tokenID, so once tokenID 1 is revealed and the URI format is known, you could see any tokens metadata. This article explains some solutions for that: medium.com/web-design-web-developer-magazine/…
    – luxo
    May 10, 2022 at 10:10

There is no way to hide a reveal on the blockchain because your transaction is public. Here are the solutions I see:

  • Make a centralised backend that does the reveal, with the baseURI pointing to the backend
  • Host 'hidden' images with the baseURI leading to them and change the baseURI when needed at reveal

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.