How to save gas fee while minting an NFT

Adeeb Abdul Salam
NFT Malayali
Published in
5 min readNov 5, 2021

--

The Ethereum Street by Sachin Rajeev (https://foundation.app/@sachin_artist/~/84065)

Disclaimer this blog is written for type 2 transaction of EIP1559 also known as London update(August 15th 2021)

It’s tedious to look at the gas chart all the time to get the minimum price for minting. But most probably you will miss the window and be forced to mint at a higher gas price. The solution to this problem is pretty straightforward, we just specify the gas fee we are comfortable with and wait till the Ethereum network accepts it. It might take hours or days, but if this can save your money and time then I believe it’s worth the effort!.

Metamask Advanced options

In order to do this, you have to adjust the gas fee of transaction in the advanced options. Before confirming a Txn, metamask will show this final window with Est. Gas fee and Total. You can click on the underlined Est. gas fee to edit it.

Total = Est.gas fee + amount

Gas fee depends on the type of Txn. If the Txn is for sending a X amount of ETH to some wallet it cost lesser. But Txn to mint/list NFTs costs much higher.

Our objective is to edit the gas fee. So upon clicking the underlined gas fee a new window will pop up giving you an option to choose “low”, “medium” and “fast” Txn. You can also find the Advanced option just below that.

Your gas fee is mainly composed of 3 important fields.

Est. Gas fee (gwei) = Gas Limit *Max Fee

Gas Limit: It depends on the type of Txn. The lowest gas limit is 21000 which is set for normal payments. Txn like Minting/Listing of NFTs and swapping of tokens like WETH/USDT requires much more gas limit.

Gas limit is like the amount of petrol required for a Txn, if you don’t give enough it won’t reach the destination(Txn will fail) and you won’t be refunded. But if you increase the gas limit, the network will only utilize the necessary amount and return the rest to your wallet.

Max Priority fee: This is a tip you pay to the miner. It’s optional and metamask set this very low from the start, so reducing this wouldn’t make much difference to your total gas fee. But metamask doesn’t allow you to make it zero.

Max fee: Is the cost of gas in unit gwei. A good analogy would be, if Gas limit is the quantity of petrol then Max fee is the cost of petrol per liter. Gwei is a smaller unit of ETH, just like paisa is to rupees. This is the field you probably want to adjust the most to reduce est. gas fee. But until the ethereum network fee is below the Max fee you specified, the Txn will be pending.

1 gwei = 10^-9 ETH

A Txn will only go from pending to successful only when your Max fee matches the fee the network agrees with. It’s like saying “I will buy petrol and refill my tank when the gov reduce it below 100rs/litre”. So whenever that happens your Txn will automatically go through successfully. But there is one important thing.

until you have a Txn in the pending state any further Txn you submit will also go to the pending state.

This is because Ethereum executes Txn only in the order of submission. How does Ethereum know the order of your submission? By counting of course.

A hidden option

From the moment you create a wallet and send Txn’s it is numbered in increasing order. The first Txn you send will have a number 0, the next Txn you submit has a number 1, and so on. This only applies to the Txn you send, not the one you receive. And this count is called Nonce.

Nonce is another field similar to gas limit and max fee but it’s hidden by default unless you turn it on in metamask settings.

How to decide on an optimum Max fee?

Usually, the network fee is high when there is a lot of people using it. For eg when a popular collectible project is being minted or when a new token is released. So if you understand the network usage at the time of minting it can help you to decide at what amount should you fix your max fee. But if you specify a very low fee compared to the network fee, your transaction will get stuck in pending for a very long time.

So it’s important to specify a lower fee that you believe the network would agree within few hours or days.

Etherscan has a gas tracking page that can be used to know the current/previous network fees (aka gas fees). Although it doesn’t tell you the minting price directly in dollars. Instead, it tells you the gas price in gwei.

Now you compare this gas price chart and your Max fee to find an optimum fee that you are okay with and edit this in the advanced option then save it, and check the total fee. If it comes under your budget then confirm!

If you are not sure how low can the Max fee can be, then take 87.5% of the current base fee from etherscan as an approximate. You can go lower than that, but the waiting time will increase. So in conclusion you need to find the sweet spot between the price you wish to mint and the network price.

How to cancel or speed up a pending Txn?

Now that you submitted a Txn for minting/listing, but it is in a pending state for too long and you are tired of waiting. Then you still have the option to speed up your minting even if it cost you or you simply want to cancel it altogether.

There can be 2 scenarios.

  1. Metamask shows the option to speed up or cancel. Then you can simply click that and speed up. But if it’s canceling that you want to do, then set the gas limit to 21000 before saving.
  2. You are not seeing the option to speed up, but etherscan shows you have a pending Txn in your wallet address.

Then do as I described below.

  1. The first step is to make sure you have turned on Nonce in the advanced settings of metamask.
  2. Then find the nonce value of the last successful Txn you send (not the ones you receive). Let this value be your oldNonce
  3. For speeding up minting/listing=> go to the marketplace and initiate the Txn again.
  4. For canceling => Send 0 ETH Txn to your own wallet address
  5. Set the Nonce field value as “oldNonce+1”
  6. Confirm

References

https://etherscan.io/gastracker

--

--