I was trying to mint 70 NFTs at once and I set a limit of 8,700,000 but ran out of gas (wasted $300). What is the max limit we should set?
1 Answer
First, you should test minting those 70NFTs on one of the testnets such as Ropsten, Rinkeby, or Kovan. They simulate the real Ethereum network (Mainnet), but the Ether is not real so you won't lose any actual money.
Alternately, you can use some development tools (Hardhat
, Truffle
, Brownie
, etc). Those can give you the exact gas cost of your minting() function.
Minting 70NFTs can be really expensive in terms of gas, (depending on the amount of data in those NFTs). It might even hit a blockGasLimit
.
So yeah, first step is to test your deployment on a testNet. Then you should try to do actually deployment.
-
Testing on testnets makes no difference cos the projected costs on testnets are different than mainnet due to different validators and traffic intensity. Commented Jul 4, 2023 at 22:33
-
@ratib90486 gasPrice will oscilate, but gasCost (the amount of gas spent by transaction) will not. Those two are two very different values. The amount of ETH you spend on transaction equals gasPrice X gasCost of the transaction. gasLimit on the other hand is the max amount of gas you are willing to spend on a transaction.– SkyCommented Jul 5, 2023 at 19:59