We would like to publish our collection on OpenSea, the artwork is done, and would like to do so using Haslips' smart contract. This smart contract already has a similar thing that we are looking for, but it reveals all NFTs.


What do I need to do if I want the image to be revealed every time the user buys one? We have a great cover image that would show until the NFT is bought. So the users on OpenSea would see the collection with this "not revealed" image, but when they buy one, the NFT is revealed.

I am also open for suggestions if this would not be feasible or would become too expensive or if it's not user/blockchain friendly.

Thank you for your help and suggestions

  • did you have any luck making it work ? can you share link for your collection ? Jun 30, 2022 at 23:57

1 Answer 1


Inside SimpleNFT.sol, instead of the bool public revealed variable you could have a mapping (uint256 => bool) revealed.

This maps each tokenId to a boolean value (it is false by default). This boolean value specifies whether the token identified by tokenId is revealed or not.

Then, inside the mint function we want to reveal tokens as they are minted:

  function mint(uint256 _mintAmount) public payable {
    // ...
    for (uint256 i = 1; i <= _mintAmount; i++) {
      _safeMint(msg.sender, supply + i);
      // by adding the below line:
      revealed[supply + i] = true;

Next we need to update the tokenURI function

  function tokenURI(uint256 tokenId)
    // ...
    // change line to
    if(revealed[tokenId] == false) {
        return notRevealedUri;
    // ...

Finally, remove the reveal function altogether.

  • This works, but does not stop people from seeing the metadata manually even before a specific NFT is minted and hence revealed. Apr 25, 2023 at 18:08

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.