简体   繁体   中英

How to mint unique NFTs

I'm working on a NFT project using ERC721 smart contract (with ERC721URIStorage extension) where user can mint unique NFTs.

I have uploaded NFT's json metadata's (used for TokenURIs) to IPFS.

In the dapp (using react), there will be a mint button where the user clicks on it to mint a random NFT. I'm struggling though with developing the logic of minting random NFT. I have uploaded to IPFS a text file containing all the TokenURIs, and then reading this file in the mint function in my dapp where a random TokenURI is fetched and then minted. The issue here is that I couldn't find a way to put a flag on the selected TokenURI on IPFS so next time mint function is called it will not get this TokenURI at all.

I'm not sure if this is the right way to accomplish what I need (mint unique NFTs)

Any help or hint here will be much appreciated.

Tokens are traditionally minted sequentially, so from 0, 1, 2 to 10,000 for example. Many people simply append the tokenId to a baseURI that points to a folder or IPFS folder. So your tokens would be ipfs://<CID>/0 , ipfs://<CID>/1 , ipfs://<CID>/2 , and so on.

This way, you don't need to flag each 'used' tokenURI.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM