For those who had used applications on blockchain, like crypto exchanges, DApps and digital wallets, must heard of the term “Gas Fee”. It is a fee paid to the miners on blockchain when you issue a transaction to the network.
Here is an example I believe you can relate to: When you transfer money between bank accounts, you’ll need to pay administration or handling fees to the banks for their service. Similarly, miners of blockchain will have to pack your transactions and put them on the blockchain to make them valid. Therefore, gas fees is the administration or handling fee for the usage of their computing power.
On Ethereum network, Ether is used to pay for the gas fee. If you are going to send Ether or ERC20 tokens from wallets and exchanges, or interact with smart contracts, like investing in ICOs or using DApps, you’ll need to pay the gas fee in Ether to the network.
Screenshot from MetaMask
Take this screenshot from MetaMask as an example, which appears when you are going to send Ether. There are two columns related to gas fee: “Gas Limit” and “Gas Price”. For every transaction, the numbers of gas limit and gas price can be adjusted to your needs.
Gas Fee = Gas Limit x Gas Price
The total cost of Gas Fee for a transaction is Gas Limit x Gas Price. After you multiply the two numbers in the example above and convert it into Ether (FYI, 1 Ether = 10^9 GWEI), which is 21000 x 10 / 10^9, then you can get the Max Transaction Fee 0.00021 Ether.
Gas limit is the maximum units of gas you are willing to pay for the transaction. The amount of unit that is necessary for a transaction is related to its complexity. The more complex a transaction is, the more computation it will cost which results in a higher fee. Notice that if the amount of unit is insufficient, your transaction will fail. 21,000 is the gas limit set for normal transactions like sending Ether. However, interacting with smart contracts which is more complex will cost more units, such as token sales and DApps.
Gas Price is the price of each unit of gas which is expressed in GWEI. It will affect how quick your transaction will be put on the blockchain by the miners. Transactions with higher gas price gives higher incentives to the miners to include your transaction. On the contrary, transactions with lower gas price will have to wait for a longer time. You can choose to save money if you’re not in a hurry.
After knowing the basics, we’re looking into 6 important things you must know about gas fee.
1. Be aware of the gas limit you set in any token sale
You should set the gas limit to the recommended amount listed by the host of token sale. Since the smart contract of token sale is more complex than normal transactions, the gas limit should be set higher. I had once encountered “out of gas” error, because the gas limit remained at 21,000 which should be set to 100,000 when participating in token sales.
2. If you wish to save gas fee, you should lower gas price not gas limit.
As mentioned above, setting a lower gas limit could result in a failure. So you should save gas fee by setting a lower gas price and wait for a longer time.
3. You can get the unused gas fee back
Don’t worry if you set the gas limit too high. If there’s any unused gas, it will return to your account after the transaction is done. You can check on Etherscan. In the example below, the gas limit is set at 100,000, but the gas used is only 35,826, so the unused gas will return.
Screenshot from Etherscan
4. If the transaction fails, you still need to pay the gas fee
If you set the amount of gas limit too low which results in the failure of a transaction. You can not get back the gas fee that is already paid for the computation done by the network.
5. Make sure there’s enough Ether to pay gas fee
Keep in mind that you need to pay gas fee in Ether when you are going to send Ether or ERC20 tokens. Sometimes people forgets to have Ether in the wallet when sending tokens.
6.Useful Tools: ETH Gas Station, Etherscan
On ETH Gas Station, you can find the recommended gas price based on the condition of Ethereum network and choose whether you want to save gas fee or focus on speed. On Etherscan, you can check the information of each transaction, including gas limit, gas price and the actual gas fee.
Screenshot from ETH Gas Station
Article by Jacky, JOYSO
More about JOYSO, visit https://joyso.io/
or follow us on Telegram, Facebook, Twitter, Newsletter