1

This part of own Q&A serial of posts which shares knowledge gained during work on one project

I was curios about options we have to mint a token. Is it possible to mint many tokens by single call?

1 Answer 1

1

Amount of tokens for minting might be extended from one to many, but there is a limit of gas to be used defined in ethereum ledger which brings natural boundaries on how many tokens could be minted at once.

3rd party solutions for similar task https://metasender.co/

In one transaction:

To mint one item, use _mint(...).

To mint up to 20 items, use _mint(...) in a for-loop.

To mint up to 500 items, use the "ghost minting" technique. Please see the Area NFT contract for an open source example of that. Note this is an advanced technique that will surely require customization based on your application.

To mint enough tokens to track ownership of nanobots a few micron in size and in aggregate totaling half the size of Earth, use the "lazy array" technique. Please see the Su Squares contract for an open source example of that. This is only possible at the time of contract deployment.

The _safeMint(...) function makes the recipient of a token, if it's a contract, get a onERC721Received(...) call. This functionality is not required by the standard and you may have some specific reason you want to use that.

You can only create N tokens at once efficiently during contract creation

Don't be afraid of creating contracts to create tokens

Contracts can be created efficiently using the proxy standard

By William Entriken

Your Answer

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

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