Gas is required to transact on Ethereum. If you don’t, miners will not process your transaction. Think of it as the ‘fuel’ which powers Ethereum. This resource explains gas and its key role in the Ethereum network.
What Is Gas?
Gas is the fee which is paid to submit transactions to the Ethereum network. Every operation or activity requires varying amounts of gas. Gas can be split into 3 components:
- Gas cost represents the units of gas required to run a given operation.
- Gas price refers to the ETH-denominated value of a unit of gas.
- Gas limit is the maximum amount of gas that the sender of a transaction is willing to spend.
Gas is measured in gwei, a denomination of Ethereum’s native currency, ETH. Each gwei is equal to 0.000000001 ETH. It’s similar to how Bitcoin is denominated in satoshis (sats).
Network usage and transaction complexity significantly affect gas fee levels. When demand for using Ethereum increases, so too do gas fees. Likewise, the more complex a smart contract, the more gas it will take to execute.
READ: What is Network Congestion? (Beginners Course)
Why Gas Fees Exist
On Ethereum, operations require varying amounts of computing energy to perform. This requirement helps prevent spam on the Ethereum network.
It’s similar to using a toll road where a small fee is required from those who use the road, since it will require maintenance as a result of its usage. In order to transact on Ethereum, the toll must be paid.
To highlight the extent to which gas costs vary based on transaction complexity, refer to the below graph from Dune Analytics retrieved on Jan. 18, 2021. Here you can see that it costs:
- $1.98 to send ETH
- $3.90 to send ERC-20 tokens
- $4.19 for an ERC-20 approval
- $11.99 to trade on Uniswap
- $17.89 to deposit on Compound
Note, when a given transaction’s gas limit is not reached, any excess gas is returned to the sender. Conversely, the sender does not get their gas back when they set the gas limit too low. (In this situation, an Ethereum miner will complete the transaction until the gas limit is used up. The transaction will be recorded on the Ethereum blockchain as ‘failed’. The miner keeps the fees as compensation for allocating their resources and the sender will get back the amount they were wanting to transact.)
How to Monitor Gas
Since gas fees are constantly changing, it can be worthwhile monitoring them before submitting a transaction—particularly if it’s non-urgent.
In Ethereum’s history, there have been periods in which average gas fees have risen astronomically. During these periods, it’s not uncommon for gas fees to exceed the amount being transacted.
By monitoring gas levels, you can better determine what an appropriate gas limit ought to be. If you don’t know what to set your gas limit as, you may find that your fee is far too small relative to other pending transactions. When this happens, your transaction can get ‘stuck’ in the mempool.
READ: How To Drop & Replace A Stuck Ethereum Transaction
Below are recommended websites for monitoring gas fees, which are typically denominated in gwei. Consider bookmarking one or more of these.
(For those on Twitter, consider following @EthGasPrice, a bot which automatically tweets gas price updates. Also consider switching on notifications for alerts.)
Save on Gas with ERC-20 Gas Tokens
GasToken
GasToken is an ERC-20 token created in 2017 by a trio of blockchain researchers. GasToken lets you buy a tokenised form of gas, which can be used to subsidise high gas prices on eligible transactions. GasToken is the first contract on Ethereum that lets you buy and sell gas directly, enabling long-term storage and the potential to protect against high gas prices.
Chi Gastoken
Chi Gastoken is used to pay for transaction fees on 1inch and Curve. It is pegged to the price of gas. Just like GasToken, Chi is a tokenised form of gas. Chi Gastoken can be bought on 1inch.