Creating multiple ERC721 tokens

Hi,

I was wondering if anyone had any idea on how to create multiple unique ERC721 tokens (similar to cryptoPunks and cryptoKitties). For instance, say I want to write a smart contract to create 1000 soccer cards where users can buy and then eventually ‘mint’ their names on it. How do I create these cards efficiently in my smart contract and do I store them on the blockchain??

Generally speaking, NFT owners are stored on the blockchain like:
mapping(uint256 => address) tokenOwners;
And other information are stored in off-chain except tokenURI, which has details about the NFTs metadata.

2 Likes

hi,

thanks for your response! But how do I actually create the 1000 cards when I deploy my smart contract initially. Do I use a for loop that iterates 1000 times?? I’m just not sure.

Also, where would I store things like the card’s image and details etc…if it’s not on the blockchain doesn’t that mean it’s centralized and can be edited?

You could, or you could also use a Multicall contract to batch transactions together. A module like that is coming soon to Contracts.

1 Like

Is it possible to loop 1000 times in EVM? I think it will be failed when reaching the block gasLimit. :thinking:

Hmm, good point.

How then do I create a large batch of unique NFTs in one smart contract? :thinking: (in this case creating 1000 cards, that are each distinct)

Looping will be limited by gas consumption of each iteration, you could try to work on optimizing that. Why don’t you run some tests on local or remix and see how far you get? I’d consider using the Multicall module from solidity, or Multicall from ethers, which will batch multiple RPC calls.

If you can’t do 1k in a single loop, then make 5 calls with 200, etc.

2 Likes

thanks, i’d try this and give feedback on whether it worked.

1 Like