3

I have to mint 10000 NFTs. But calling mint function 10000 times is not a good idea I guess. Even I created a batchMint function that is calling mint function in loop and it is able to mint multiple NFTs at once (it is saving default gas of 21000 for each mint call). But I just want to know is there any standard or better approach to mint these 10000 NFTs at once.

2
  • Please see answer below, did that help? Commented Nov 6, 2021 at 23:47
  • I want to make sure you are required to mint this. It sounds like a "push" pattern, which might be better replaced with a "pull" pattern: Let users/buyers/to-be-owners mint them instead. I know you mention you "have to," but not sure if that is due to thinking the push pattern is the only way or not. Just making sure :-) Commented Aug 27, 2022 at 4:09

2 Answers 2

1

Please see the smart contract for https://tenthousandsu.com. This includes:

  • Mints 10,000 NFTs
  • All at once
  • And supports ERC-721 Enumerable

Su Squares is the first ERC-721 contract, it is mentioned in the ERC-721 specification as a demo, and it was recently re-released as fully open source so you can copy away!

1

You can also look at the ERC721A contract. The contract supports minting of multiple NFTs at gas cost of one.

There are some limitations, though:

  • Token IDs must be subsequent
  • Reducing the gas costs of minting NFTs is more important than optimizing any other ERC721 call. This means, for example, that read operations like ownerOf is no longer O(1).

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.