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?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityAmount 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