Hey there, I am Samrat Gupta aka Sm4rty, a Security Researcher and a Bug Bounty Hunter. This is the third blog in Ethereum basics Series. In this blog we will learning concepts of Gas in Etheruem and some terminologies. Lets get started:
Overview:
1. Concept of Gas in Ethereum.
2. How do Ethereum Gas Fees Works?
3. Gas Limit
4. Gas Price
5. Priority Fees
6. Why is Ethereum Gas so expensive?
7. How to reduce Gas cost?
8. Gas after “The Merge”
1. Concept of GAS in Ethereum:
Gas refers to the fee, or pricing value, required to successfully conduct a transaction or execute a contract on the Ethereum blockchain platform. Priced in small fractions of the cryptocurrency ether (ETH), commonly referred to as gwei and sometimes also called nanoeth, the gas is used to allocate resources of the Ethereum virtual machine (EVM) so that decentralized applications such as smart contracts can self-execute in a secured but decentralized fashion.
2. How Do Ethereum Gas Fees Work?
The Ethereum transaction fee mechanism was updated in August 2021 during a network upgrade called the London Upgrade. After the update, Ethereum network transaction’s total fee is calculated using the following formula:
Total fee = gas units (limits) x (base fee + tip)
Gas units are the maximum amount of gas the user is willing to pay to complete the transaction. Different types of transactions on the Ethereum network require different amounts of gas to successfully complete.
The base fee is the minimum amount of gas required to include a transaction in a given block. The network calculates the base fee based on demand and block space. Base fees tend to be higher when there are a large number of users interacting with the Ethereum network. When a block is mined, the base fee is “burned,” removing it from circulation.
3. Gas Limit
The Gas Limit refers to the maximum number of Gas a user is willing to spend on a computation. Some basic computations require a predetermined number of Gas and it’s easy for wallets to provide these estimates based on what type of an operation the user is trying to perform. For example, the Ethereum yellow paper states that every transaction requires 21,000 Gas. This is why most UIs will display 21,000 as the Gas Limit by default.
4. Gas Price
The price per unit of Gas is represented in GWEI, which is a more user digestible version of WEI. WEI is equivalent to ETH in the way that a penny is equivalent to the dollar, it is the smallest denomination of the currency. One GWEI is 10⁹ WEI and provides a much better user experience for calculating gas costs.
As you’d expect, the higher the proposed gas price, the higher the chances that the transaction will be included in the next block since this is what incentivizes miners. The default gas price on most interfaces is 20 GWEI, which should be sufficient to get a transaction in the next couple of minutes. Increasing the price to 40 GWEI will likely get you in the next block.
5. Priority fee
After the Ethereum London Upgrade, Ethereum introduced a priority fee (tip) to incentivize miners to include a transaction in the block. Without tips, miners would find it economically viable to mine empty blocks, as they would receive the same block reward. Under normal conditions, a small tip provides miners a minimal incentive to include a transaction.
6. Why is Ethereum Gas so High?
The main reason for this is Ethereum’s popularity. If there’s one thing that fuels the crypto industry, it’s demand. When demand for an asset or service goes up, prices will also increase.
Today, Ethereum has hundreds of thousands of users, with over a million transactions conducted daily. The sheer demand drives up gas fees, as running the blockchain takes more computational power. If you take the case of DeFi, Ethereum has emerged as a promising platform for developing DeFi solutions. Furthermore, the real use cases of Ethereum and its use in developing decentralized applications or dApps also burden the network. As a result, the increasing load on the Ethereum blockchain has translated effectively into massive growth in gas fees.
Further Reads:
https://www.blocknative.com/blog/why-eth-gas-fees-high
https://www.makeuseof.com/what-are-ethereum-gas-fees-why-so-high/
7. How Users can to reduce Gas cost?
Although there’s no avoiding gas fees if you want to use DeFi, there are ways to minimize the amount paid. Following are few gas saving tips:
- Check the network for congestion and plan ahead when possible. You can use gas monitoring websites like Etherscan or EthGasStation.
- You can use Layer 2 scaling solution like polygon as it greatly improve gas costs, user experience and scalability.
- Lower Your Gas Fees. Web3 wallets like MetaMask generally allow their users to customize transaction fees. Users can set the base fee for their transaction to a lower number.
Further Reads:
https://blog.makerdao.com/four-ways-defi-users-can-pay-less-in-ethereum-gas-fees/
https://www.blocknative.com/blog/why-eth-gas-fees-high
8. Gas Fee after “The Merge”
The Merge is the transition of Ethereum (ETH) blockchain to the Proof-of-Stake (PoS) consensus mechanism. PoS is energy-efficient, and the Merge will instantly cut 99 per cent of Ethereum’s carbon emissions, according to the Ethereum Foundation.
According to the Ethereum Foundation, the organisation behind the Ethereum blockchain, The Merge will have no “significantly change any parameters that directly influence network capacity or throughput”. This means, there won’t be any change in the gas fees.
Further Reads:
https://ethereum.org/en/upgrades/merge/
https://blockworks.co/the-merge-will-not-lower-ethereum-transaction-fees/