- Want to know what are Gas fees in Ethereum ecosystem?
- How can you save on Gas fees and lower down your transaction cost?
Well, in this guide I will help you understand everything about Ethereum gas.
The other day I was preparing to participate in an ICO that required me to contribute in Ether (ETH).
The ICO was on Ethereum’s blockchain which meant that I needed to send my Ether (ETH) to an Ethereum smart contract address.
Soon after that, I figured out that MyEtherWallet (aka MEW) is one of the Best Smart Contracts Ethereum Wallets, so I started preparing my MEW for the ICO.
And as I have advised you to in my DApps write-up to read and understand the ICO requirements thoroughly, I did the same and went to the official ICO website to know what was required of me.
There I encountered that the ICO required a minimum recommended “Gas Limit” of 200000 and a “Gas Price” of 70 Gwei which should convert into fees of 0.014 Ether (ETH) or $3.15.
- Also see: How to buy Ethereum (ETH)
At that time, these terms of gas limit and gas price were alien to me.
Nevertheless, I did my due diligence and successfully participated in the ICO.
It was when I was doing my due diligence and researching these terms that I realized that they were all explained in a very technical way, and there was a lot of confusion around them. Moreover, it’s very important to understand these terms if you want to participate in DeFi or an Ethereum-based ICO.
Now that the ICO has concluded, I thought of introducing these terms to you in a more non-technical manner so that no one in the coinsutra.community is left behind.
But before that, I think a quick recap of Ethereum, Ether, and ICOs will be helpful.
What is Ether?
The official Ethereum project website says:
“Ethereum is a decentralized platform for applications that run exactly as programmed without any chance of fraud, censorship, or third-party interference.”
On the other hand, Ether (ETH) is the cryptocurrency which fuels these smart contracts, DApps, and transactions on the Ethereum blockchain.
Like Bitcoin, ETH is also a peer-to-peer currency, but it has a variety of applications, unlike BTC.
Ether (ETH), unlike BTC, can be programmed for many use-cases like for making DApps, enabling smart contracts, generating tokens during ICOs, and also for making standard P2P payments. That’s why Ethereum (or Ether) is also called programmable money.
Introduction to Ethereum Based ICOs
Typically an Ethereum based ICO looks like this:
- ICO website will declare its ICO timelines.
- Then they will declare their smart contract enabled address (ICO’s address).
- Participants need to send ETH to this address with a particular gas limit and gas price that is recommended by the ICO within the timelines.
Now, if your ETH transaction is mined and has enough gas limit as required by the ICO contract to get executed, then you will get your ICO tokens credited in your wallet.
Otherwise, if the gas limit is not enough, then the ICO’s smart contract execution will fail in between, and participants will not get their ICO tokens.
Introduction to Ether, Gas Limit, Gas Price, and Transaction Fees
To do anything on the Ethereum platform, you need to pay for it, and the payment (or fee) is calculated in Ether (ETH) via an intermediary benchmark called gas limit and gas price.
This equation is used for calculating ETH (or Transaction fees):
Ether = Tx Fees = Gas Limit * Gas Price
Let’s understand each component of this equation one by one:
What is Ether (aka Tx Fee)
On the Ethereum network, the final transaction fee is calculated in Ether. It is derived by the multiplication of the gas limit and the gas price.
For example, see this link of an Ether transaction on etherscan.io:
It shows the Tx fees (i.e. gas limit * gas price) in USD and ETH.
This fee is not claimed by wallets or other service providers; instead, it is paid to miners for mining blocks of transactions and for securing the Ethereum blockchain. This fee is paid by users to miners and is deducted from their whole transaction amount.
To understand the other two components of the equation (gas limit & gas price), take this example:
Let’s suppose you have a car which consumes 1-gallon of gasoline worth $10 per mile. Now, if you drive the car for 5 miles, it will cost you $50. This means that if you need to make your car work (or drive) for 5 miles, you will need to spend $50 by putting 5-gallons of gas into it.
Similarly, to run a line of code or do an operation on Ethereum, you need to burn the appropriate gas limit (like in a car), where each “gas limit” (like the car’s gasoline) will have a per unit price called “gas price”.
To clarify more:
- In a car, $10 (gas price) per gallon (gas limit).
- In Ethereum, 10 Gwei (gas price) per gas (gas limit).
Note: Gwei is the measuring unit of gas price (I will discuss this further in the article).
What is Gas Limit
Usually, when one is talking about “gas” in Ethereum, they are referring to “gas limit”. This simply means some amount of fuel is required to execute that operation or run that particular smart contract code.
Gas is a unit that gets translated further into Ether (ETH) as a cost of performing that action (or work). The requestor pays this cost to the miner who actually mines and validates that transaction (or action).
On Ethereum, the gas limit is measured in the unit of “gas”. For instance, if you want to execute 5 lines of code on Ethereum successfully, it will require 5 gas units. Think of it just like your car which consumes 5-gallons of gasoline for a 5-mile drive.
Gas limits are already defined on Ethereum depending upon how much code is needed to be executed on the blockchain for a particular operation.
If you play smart and say that you will feed in less amount of gas to run a particular code/operation, then it will fail and throw an error- “Out of Gas”. So in order to avoid this, you must feed in the right amount of recommended gas for the operation’s or smart contract’s code to get completed successfully.
Rule of thumb: If you want to pay less and are lowering the gas limit below the recommended gas limit, then this will not work. Instead, try lowering the gas price.
If you want to pay less for your transaction, you can do so by varying the other variable which also determines the final cost (or Tx fee) of the transaction. This variable is called “gas price“.
But mind you, lowering down the gas price will make the transaction take longer to be mined. This happens because all miners want to mine a transaction that has a higher mining reward (i.e. higher Tx fee).
On Ethereum, gas price is measured in a unit of Gwei. For 5 lines of code that need 5 units of gas, this would cost 5 Gwei.
Why not use ETH directly instead of gas price?
Actually, this is done to decouple the cost of any operation from the market price of Ether. As you know, cryptocurrency prices are very volatile, and ETH is no exception. That’s why on Ethereum’s blockchain, the gas limit for each operation is constant and fixed so that market volatility doesn’t impact Ethereum’s usage.
Just imagine a scenario in which instead of using this indirect way of fixed gas limits and variable gas prices, we had a fixed ETH cost. Let’s say the price of 1 ETH was $1000… No one would use the Ethereum platform because it would be too costly.
That’s why it becomes easy to bypass this volatility of the market and simultaneously lower the operations cost by using another variable.
How to Save on Ethereum Gas fees?
There are a few ways by which you can save on Gas fees:
The first thing you want to do is find the cheapest gas fees for a transaction to execute. To do this, head to Gasstation.info, and check the current gas fees.
As you can see from the above screen, the standard Gas fees is 173 and it could take less than 5 minutes to execute. I know that’s a lot of time, but depending upon your goal of transaction, you can use the standard fees or Trader fees.
Now, when you are using Metamask or any similar Ethereum wallets, you can set the gas fees. This is one thing not a lot of people are aware of, and they end up paying high gas fees.
Conclusion: Ether Gas
Generally, during normal times (when an ICO is not going on Ethereum), 21,000 gas limit is used for standard transactions. On the other hand, a 200,000 gas limit is used during an ICO.
For average gas prices, you can check on ethgasstation.
And these 3 types of gas prices are suggested during regular times for P2P transactions:
- Fast (40 Gwei)– Your transaction will likely get picked up in the very next block.
- Average (4 Gwei)– Your transaction will likely get picked up in next few blocks.
- Slow (0.6 Gwei)– Your transaction will likely get picked after several minutes.
But during an ICO, the average gas price shoots up to astronomical levels. You can keep an eye here for the latest recommended gas prices and gas limits. You can also calculate the average transaction fee and mean confirmation time for a given gas price and gas limit.
So that’s all from my side in this article, and I hope this helps you make the right choices for yourself.
Still, have questions about Ethereum gas prices and gas limits? Ask away in the comments below!
Like this post? Don’t forget to share it!
Here are a few hand-picked articles that you must read to increase your knowledge about Cryptocurrencies: