This page may contain legacy content

To get our most up-to-date content please access our documentation

January 12, 2022

Ethereum Gas Fees – The Ultimate 2022 Guide

Table of Contents

While Bitcoin may still be largely synonymous with crypto, much of the real progress in Web3 adoption comes from programmable blockchains such as Ethereum. Ethereum has been leading the way for other smart contract networks as well, which are gaining growing recognition. As such, we all recognize that the crypto realm has come a long way in the last couple of years. Nevertheless, there is one issue that Ethereum still hasn’t overcome. Namely, this relates to gas fees. Even though Ethereum gas fees are high, most blockchain developers still utilize its network, token standards, etc. However, some programmers haven’t even thought of how Ethereum gas fees could impact their blockchain projects, whether positively or negatively. Therefore, we’ve created the ultimate 2022 guide to Ethereum gas fees so that you can have a solid understanding of how to interact with Ethereum when executing transactions.

With that in mind, it is important to have a proper understanding of Ethereum gas fees. They are an essential part of interacting with the Ethereum network. Whether you are buying, selling, sending tokens, ETH, or completing other transactions, you should understand network fees. Plus, even more so if you are serious about becoming a blockchain developer. As such, in this article, we’ll address all major questions related to Ethereum gas fees that we’ve received lately. Thus, you will have a chance to find out how Ethereum gas fees work, how to calculate and estimate them. Also, you will learn why Ethereum gas fees are so high. Nonetheless, we’ll also explain how EIP-1559 affected Ethereum gas fees and what to expect from Ethereum 2.0. However, we’ll start by explaining what Ethereum gas fees are to ensure we are all caught up. 

Ethereum Gas Fees Explained 

As mentioned earlier, we will cover all aspects related to Ethereum gas fees. Of course, there are many details we could focus on; however, we primarily want to provide you with a decent overview. Before moving forward, we must also note that all other EVM-compatible chains (such as Polygon, Binance Smart Chain [BSC], Avalanche, etc.) also have network transaction fees. Thus, properly wrapping your head around Ethereum gas fees will benefit you when working with these networks. This also applies when working with MoralisWeb 3.0 development platform. Since this “Firebase for crypto” platform supports most major EVM-compatible chains, understanding network fees will come in useful for you. Moreover, network fees are also applicable for all Ethereum testnets and other networks’ testnets. As such, make sure to cover the sections below with proper attention.

However, in case you already have a solid understanding of Ethereum gas fees and are eager to start building, make sure to check out some of our example project guides. A few of our latest articles show you how to interact with smart contracts through a website, how to authenticate Android apps, how to index the blockchain, and much more. Next, create your free Moralis account and build some phenomenal dApps!

What are Ethereum Gas Fees?

If you’d like to comprehend and be able to answer “what are Ethereum gas fees?” confidently, you need to understand several key concepts. For one, you need to know what gas is and why it is so important. If you know the basics of the Ethereum network, you know that Ethereum Virtual Machine (EVM) acts as a global processor, which is powered by miners. They execute EVM smart contracts and apply their effects by adding new blocks to the blockchain. Moreover, the usage of EVM is measured in units of gas. Thus, the more intensive the usage, the more units of gas are consumed. Essentially, gas is the fuel that powers EVM; however, it is also the unit of measure for that fuel. Moreover, it is denominated in gwei (gigawei), which is equal to 10-9 ETH (0.000000001 ETH = 1 gwei).

Something that many people are not aware of is that each specific operation has a fixed price in gas as definite in Ethereum’s yellow paper. However, the price of gas changes according to the supply and demand factors. Thus, one gas doesn’t have a fixed value in gwei. Furthermore, the size of the block is a function of the entire amount of gas utilized by the set of transactions included in that block. This means that the amount of data that a block contains is not given by a measure of the data but as a measure of computation of involved transactions. Essentially, Ethereum gas fees are payments imposed upon users to compensate for the computing energy required for related processes. This is also where the “gas limit” comes into play. It is the maximum amount of gas that a user is prepared to spend on a given transaction.    

How Do Ethereum Gas Fees Work?

Now that you know what Ethereum gas fees are, let’s take a look at how they work. Since Ethereum is still using the proof-of-work (PoW) concept, miners play a vital role. They provide the computational power, which is required to verify and process transactions. As such, there is a miner behind every transaction. Further, since it would be absurd to expect miners to do that work for nothing, they must be compensated. The latter is accomplished with Ethereum gas fees. As such, you can also look at network gas fees as a reward for miners. The exact gas price in gwei depends primarily on the network congestion. However, the amount of gas depends on how large of a contract you are trying to execute and how quickly you want it executed. 

To get an even better understanding of how Ethereum gas fees work, let’s take a look at an example. Let’s say John wants to send 1 ETH to Mary. To do so, he would need to have 1 ETH + a necessary Ethereum gas fee at his disposal. Presuming John has sufficient funds, Mary will receive 1 ETH, while miners would get a part of the gas fees.    

How to Calculate Ethereum Gas

Up until August 2021, the exact gas fees were calculated using a first-price auction model (the legacy gas pricing model). Some of the EVM-compatible blockchains (such as BSC) still use that method. However, gas fee predictions using the legacy pricing model were not highly accurate. As such, the gas could have changed between the submission of the transaction request and the actual transaction. This often resulted in users paying gas fees for nothing. Plus, transactions could often get stuck for long periods of time. Moreover, while the legacy gas pricing calculation was rather simple, the new one (EIP-1559) is slightly more complicated. So, let’s take a closer look at how to calculate Ethereum gas. 

With the new model in place, calculating the total transaction fee works as follows: 

The total transaction fee = gas units (limit) * (base fee + tip)

In the above equation, the gas units or gas limits are defined in the Ethereum yellow paper (appendix “G”). The base fee was introduced with the London network upgrade and is something every block has. It is the minimum price per unit gas for inclusion in the block. The base fee is calculated by the network based on the current demand for block space. Further, the base fee is burnt (destroyed or taken out of circulation). Moreover, the priority fee (tip) is used to reward miners. Also, note that the tip is often set automatically by most wallets.

Ethereum Gas Fee Calculation Example

If we now use the example transaction from the previous section, we can calculate the gas fee. Of course, we need to know the exact values of the gas limit, the base fee, and the tip. Let’s presume that the current base fee is 100 gwei. Moreover, let’s say John adds a tip of 10 gwei. Using the Ethereum yellow paper, we also know that the gas limit for transactions is 21,000. Putting it all together, we get:

21,000 * (100 + 10) gwei = 2,310,000 gwei = 0.00231 ETH

For this example, John would need to have 1.00231 ETH to send 1 ETH to Mary. Further, out of 0.00231 ETH (the total transaction fee), 0.0021 ETH is the base fee, which is burned. (This is why Ethereum can now be deflationary when a lot of transactions are executed.) Moreover, the tip of 0.00021 ETH is what miners receive.

Estimating Ethereum Gas Prices

As mentioned above, gas fees prediction is much more accurate after the London hardfork. That’s because it uses the previous block’s details to calculate the base fee and not the current block’s. Moreover, using the above equation in combination with the Ethereum yellow paper and the Ethereum gas tracker on Etherscan, you can calculate Ethereum gas fees. As you can now see, the key is to properly estimate the current Ethereum gas price. Thus, you can also use some basic Solidity skills in combination with a particular smart contract to estimate Ethereum gas prices. You can then use that as a tool in other contracts and dApps. Moreover, by utilizing Remix, you can easily test your smart contract. 

If that is something you are interested in learning more about, make sure to check out the video below, starting at 14:08. There, you’ll be able to watch a Moralis expert as he takes on an example project. He will first tell you the details about the code files (available at GitHub). Then, he’ll guide you through the details of the “Store_secret.sol” smart contract. This is where you’ll be able to see the power of the “gasleft()” tool. Moving forward, he will show you how the contract works by running it in Remix. Nonetheless, you’ll also get to build a simple user interface.

https://www.youtube.com/watch?v=t9Gii8JWEvY

Why are Ethereum Gas Fees so High?

This may shock you, but high Ethereum gas fees are actually a good sign, at least in a way. They indicate a lot of interest and active users on the network. You see, every calculation, storing or manipulating data, and transferring of tokens consume a certain amount of “gas” units. Moreover, the more complex dApps on Ethereum get the more space of a limited-sized block they take up. 

Of course, high gas fees are a real problem, especially for average users, who can’t afford to spend hundreds or thousands of dollars on fees. As such, the Ethereum network is currently facing a paradox. On the one hand, Ethereum supporters want Ethereum to constantly gain popularity. On the other hand, they also want gas fees to remain reasonably low. Currently, the two aspects just don’t go “hand-in-hand”. However, Ethereum 2.0 is set to solve this issue (more on that later on).

Gas Fee Effects of EIP-1559

Above, we’ve talked a lot about the details of how Ethereum gas fees are now calculated. As such, you already know a lot about EIP-1559 (the London upgrade or hardfork). However, to ensure that everyone understands the key changes made to the legacy gas pricing model, let do a quick overview:

  • EIP-1559 made transaction fees more predictable (better transaction fee estimation).
  • It made transaction inclusion generally quicker. 
  • EIP-1559 also introduced offsetting the ETH issuance by burning a percentage of transaction fees.
  • Now, every block has a base fee, calculated by the network, based on the demand for block space. 
  • The base fee is burnt.
  • In addition to the base fee, there’s also a tip or priority fee. The latter serves as a reward for miners.
  • It also introduced “maxFeePerGas”, which enables users to set how much they are willing to pay for the transaction to be executed. This enables them to not pay more than the market price for gas (“baseFeePerGas”) and get any extra, minus their tip, refunded.

Gas Fees after Ethereum 2.0

Ethereum 2.0, Eth2, or Serenity refers to the set of interconnected upgrades to make the Ethereum network more secure and sustainable. The key change is to move from proof-of-work (PoW) to proof-of-stake (PoS). Further, Eth2 has three stages, with the first one (the Beacon chain) already successfully implemented. The implementation of the remaining two stages (“the merge” and “Shard chains”) should occur in 2022 and 2023. Since this set of upgrades will enable the platform to process thousands of transactions per second and scale globally, it is expected to also reduce gas fees significantly. The new proof-of-stake model should reduce high power consumption, which will result in lower fees.

Ethereum Gas Fees – The Ultimate 2022 Guide – Summary

If you’ve covered the sections above, you are now a semi-expert on Ethereum gas fees. As such, you should now have a clear understanding of what Ethereum gas fees are, how they work, why they are high, and what the future has in store via Eth2. You’ve also learned that EIP-1559 had quite an impact on how gas fees are calculated. Plus, by watching one of Moralis’ experts, you’ve been presented with an example project that shows you how to use smart contracts to estimate Ethereum gas prices. 

If you enjoyed this article and want to broaden your blockchain horizons further, we recommend you visit the Moralis YouTube channel and the Moralis blog. Both of these outlets offer you a great place to continue your free crypto education using our professional explanations and detailed guides. For instance, some of our latest topics explain what a Web3 wallet is, what ERC20 contracts are, and show you a DAO smart contract example, how to integrate mint function to JS interface, how to transfer ERC20 tokens, how to develop an NFT rarity ranking dApp, and much more. However, in case you are ready to take a more professional approach, make sure to enroll in Moralis Academy.  

Moralis Money
Stay ahead of the markets with real-time, on-chain data insights. Inform your trades with true market alpha!
Moralis Money
Related Articles
October 23, 2023

What is EIP-4844? All You Need to Know About Proto-Danksharding

November 20, 2023

What’s the Difference Between Polygon PoS vs Polygon zkEVM?

December 9, 2022

ERC 1155 NFTs – What is the ERC-1155 Standard?

January 18, 2023

Supabase Authentication – How to Authenticate Users on Supabase

August 8, 2022

How to Buy NFT Outfits In-Game

January 31, 2023

Notify API Alternatives – Easiest Way to Set Up Web3 Notifications

November 22, 2022

Exploring the Ultimate ERC20 Token API

December 9, 2022

How to Listen to the Blockchain with Ethers.js

November 30, 2023

The Biggest and Most Popular Blockchains for Developers