Victor Yeo
2 min readJan 24, 2022

--

Bulk Minting NFT

In this article, i will describe solidity smart contract and nodeJS app to perform bulk minting of NFT. The discussion is applicable to Ethereum compatible blockchain.

Referring to the diagram below:

The mintManyNFT function is part of the solidity smart contract. It takes as input array of addresses, and a baseURI. It loops through the number of addresses, and for each address, it mints an unique token Id to the address and sets the tokenURI.

In the nodeJS app, it calls the mintManyNFT function, passing in the array of addresses and the tokenURI.

The full source code is available at:

Note: The solidity smart contract function is not optimised for gas. There are several ways to optimise the function.

  1. Set the base token URI only once. Do not set the token URI for each address.
  2. Do not use the ERC721URIStorage contract, use your own counter to minimise storage cost.
  3. Any more ideas?

--

--