Gas Fees for Beginners

As beginner, it’s important to understand the concept of gas fees and the tips and tricks related to this. We have touched a bit on the definition of gas fees in this article, and we will go through the concept deeper in this article

Gas Fees for Beginners
Photo by david Griffiths / Unsplash

Introduction

https://dune.xyz/hildobby/Gas, data as of 18 Mar 2022 15:00 HKT
  • As beginner, it’s important to understand the concept of gas fees and the tips and tricks related to this. We have touched a bit on the definition of gas fees in this article, and we will go through the concept deeper in this article
  • Gas fees are simply transaction fees that we, as users of a particular network, needs to pay to the miners or validators working to secure the network, in order to incentivize them to process / validate our transactions and record these onto the blockchain. We pay gas fees for practically everything — for transfers, approvals, deposits, withdrawal, and others. Gas fees are paid in the native currency of a blockchain. For example in Ethereum blockchain, you will be paying $ETH, and in BSC you will be paying $BNB
  • Not all gas fees are created the same. Let’s take a look at the most popular network i.e. the Ethereum Mainnet where gas fees are usually the highest. There are different gas fees levels for different activities, the highest typically being gas for NFT sale at OpenSea which is paid for by the buyers of the NFT, or ERC-721 / ERC-1155 (unless an offer is accepted by seller, in which case sellers as the trigger for the transaction will be paying for the gas). The lowest gas is usually for simple $ETH transactions from wallet to wallet
  • Gas fees are simply calculated by multiplying the unit of gas with the amount of gas used. The unit of gas is denominated in gwei (short for gigawei), and 1 gwei equals to 0.000000001 ETH. In the image above, the current gwei on 18 Mar 2022, 15:00 HKT is 27 gwei, which is equivalent to 0.000000027 ETH. The total gas fee that you incur on a given transaction is therefore defined as: gas used * 27 gwei. If we take an example of transferring $ETH from one wallet to another in which the maximum gas limit is 21,000 gas, then the exact fee that you will be paying on a simple $ETH transfer would be 21,000 gas * 27 gwei= 0.000567 ETH, or equivalent to about $1.6 at current Ethereum price
  • Please note that gas, once consumed, cannot be refunded back to users regardless of whether the transaction succeeds or not. In the example above, say a user decide to edit the gas limit from 21,000 to 18,000. What would happen is that miner who pick up the transaction will consume 18,000 gas as it is basically included as their base fee, but your transaction will not be successful. It is important to understand that while you can add tips to incentivize miners to pick up your transaction first, it doesn’t work to undercut the gas limit as you will just be paying gas for nothing
  • What should you do if you have a very important transaction that you want the miners to prioritize? You can pay a tip to the miners (in gwei, on top of the base fee, which is the fees included in the block that is the minimum you should pay). How much should you be tipping? The minimum tips that are accepted by top miners are aggregated in https://ethgasstation.info/. From the screenshot below, 41 gwei is the lowest tips that is accepted by all top miners in the network (equivalent to about $0.12). Notice that in the bottom there is also real-time base fee data of 33 gwei ($1.94 / transfer). If you choose to tip 41 gwei to your miner, note that the total gas fees that you will be paying is 41+33 = 74 gwei, or about $4.35 per transaction
https://ethgasstation.info/, data as of 18 Mar 2022 15:30 HKT
  • Another thing to note that transaction fees that are consumed by miners can be less than gas limit * base fee + tips. In that case gas that are not consumed can be refunded back to you. Suppose you set your gas limit to 50,000 (we denote this as max fees), the amount of gas refund you will get would be max fees — (base fee + tips). Having said this, to reiterate the previous point, a gas that has been consumed cannot be returned back to you and only unused gas can be refunded
  • Now that you have understood the basics of gas fees, limits and gwei, here are few useful gas tracker sites that you could refer to:

Etherscan Transaction gas price estimator

Blocknative ETH Gas Estimator Gas estimating Chrome extension supporting both Type 0 legacy transactions and Type 2 EIP-1559 transactions.

Tips and tricks

  • General tips on how to reduce gas fees:
    1) Plan well: Gwei is a function of traffic. You can consult the gas fees dashboard tracker provided above for gas estimates, and for planning purposes you can consult https://dune.xyz/hildobby/Gas. In the chart we can see that in general, weekends are less busy and UTC p.m are generally busier than UTC a.m, hence gas tend to spike during these times. These are, however, based on the past month data and it may not be indicative of the future. Another way we can plan is, if we have a foresight of potential NFT project launch, for example, expect gas price to spike during that time as minters list their items on exchanges, and you may want to avoid doing the less time-sensitive transactions during that time (note: NFT transaction in OpenSea is ranked the #1 gas burner by ethgasstation.info over the past 30 days, even above AMM transactions!)
https://ethgasstation.info/ date as of 18 Mar 2022
  • (cont’d):
    2) Try not to use as much wallets e.g staking your tokens with one wallet is so much cheaper than staking with two wallets, as you would only need to. In summary, try to minimize the amount of transactions you do as much as possible. This is with an exception to when you want to swap large amount of tokens on AMM,
    3) If you need to distribute assets to a lot of wallets, consider using CEX services instead: CEX transfers happen offchain, so there will be no transfer fees for such distribution. Some CEX also offer free withdrawal and free ERC-20 gas transfer
    4) Consider using Layer 2 network instead: Layer 2 (“L2”) is a another topic for discussion, but the summary is: transactions on the Ethereum Mainnet (L1) are expensive due to congestion. There are L2 solutions that help users in scaling up the transactions, as they employ technologies like rollups or moving transactions to the sidechains on this network. Therefore, this new process reduces gas fees and expedites transaction completion. Optimism, Arbitrum, Immutable X and Polygon are some of the layer-two scaling solutions for Ethereum. The downside is, you may not be able to find the specific product in Mainnet on these L2s
    5) You may want to utilize https://gastoken.io/: This is maybe for more advanced users, but gas tokens i.e. $GAS allows user to stack gas when it’s cheap for later use — in other words, tokenizing this fundamental resource on Ethereum. Using GasToken can subsidize high gas prices on transactions to do everything from arbitraging decentralized exchanges to buying into ICOs early. GasToken is also the first contract on the Ethereum network that allows users to buy and sell gas directly, enabling long-term “banking” of gas that can help shield users from rising gas prices. However, do note that with the Proof of Stake (“PoS”) merger for Ethereum network, gas fees are expected to be lower
  • General tips on how to speed up transactions:
    1) Speeding up transactions will incur some gas fees, so this should not be your first resort when your transaction is pending for some time: The first thing you need to do (which is also confirmed by Metamask), is to exit and close your browser completely, reopen it, and unlock MetaMask (this should apply regardless of whatever wallet you decide to use). If you have done so and the transaction is still stuck, you can navigate to the activity tab in MetaMask or any of your wallet, and it will show you all the pending transactions in your queue. You may click the ‘speed up’ button’, which will let you re-submit the same transaction, but with a higher gas fee that should allow the transaction to be processed faster
    2) To avoid having transactions stuck for a very long time, try not to undercut gas fees by too much. Always check the ethgasstation.info for recommendations on the lowest gas fee that you can put as limit
  • General tips on how to cancel transactions:
    1) Attempt in-app cancellation: This will not refund the gas that has been consumed, but if the transaction has not gone through, your transaction will be cancelled
    2) Manipulate the nonce manually: Provided that your transaction has not gone through, you can consider to manipulate the transaction nonce manually. Firstly, nonce is basically the transaction number that has been submitted by the same wallet address. Remember that a smaller nonce is always processed first by the network, so you need to ensure that that if you are trying to cancel transaction with nonce value of 15, that you enter your new transaction as nonce no 14. This can be done in two steps — the first step is navigate to your MetaMask’s wallet advanced setting and activate the permission for customized transaction nonce and advanced gas settings. The second step is to check the transaction nonce that you wish to cancel. The nonce is usually shown under your transaction hash in Etherscan (or BSC scan if you are on BSC network), also shown as screenshot below. Third step is to initiate an $ETH transaction, putting in your own wallet address as destination, and entering the nonce in the box with value of nonce of transaction to be cancelled -1 (in the example given, the nonce enterred should be 14). $ETH value can be 0, but ensure to set a higher gas limit for this cancellation transaction to ensure that it is being picked up first by the miners, before the current pending transaction you wish to cancel
Etherscan. Note: all pending transaction has a field called ‘Nonce’