author-image

Christof Jori

11 min read · 14 June 2024

Why Do Gas Fees exist?

Gas is like taxes. No one wants to pay it, as it leaves our wallet and never comes back. But gas fulfills a very important task. There are times, where Ethereum gas fees have reached astronomical heights and made the news. By why is that? What are the circumstances that lead to these peaks? And why are fees on Arbitrum, Optimism or Binance Smart Chain so low?

Let us start with the definition of gas, and what purpose it fulfils to get a better understanding of transaction fees. Gas is a fee that needs to be paid to conduct a transaction on many blockchains. But why does it exist? Well, there has to be some sort of mechanism to protect and incentivize the network. On Proof of Stake Blockchains (like Ethereum) we call them: Validators. On Proof of Work Blockchains, the correct word is: Miners. These people are responsible for verifying and processing transactions. Consequently, as there is no such thing as free lunch, they need to get compensation for their work. That is, parts of your gas. So both parties are satisfied - your transaction is getting processed on the blockchain and the validator gets paid for acting as a validators.

But what formular defines gas prices? In General, gas prices are calculated by the amount of work that happens on the blockchain. If you are simply sending an asset from A to B, gas prices are lower than calling complex smart contracts. That is, gas is calculated by the actions that happen on the blockchain. A simple transfer from A to B oftentimes just changes single values. Complex Smart Contract calls on the other hand need more computation, leading to higher initial gas fee prices. That explains what gas fees are and how they are calculated, but not why they are sometimes so extraordinarily high.

A competition for block space

Let us imagine the following: You’re selling apples in front of your house. But there is a problem. More customers are wanting to buy apples than you can satisfy. So what do you do? As an economically thinking person, the equation is clear. You raise the price. Now that will lead to a couple of people leaving, as they are not willing to pay the price. If there are still more people in front of your house than you can satisfy, you increase the price further. If no one visits your store, your prices might be too high. Hence, you lower them and more people will visit your store.

And the same thing happens on a Blockchain. If the network is congested, there is competition for block space, which leads to increasing gas prices. If there are no transactions, validators are forced to pick up any transaction, with potentially lower gas fees. If there are more transactions than validators can handle, they can pick the transactions with higher gas fees. Gas fees fluctuate and often change within minutes. Many Wallets or block explorers can give more insights into the current gas price per unit. Keeping an eye on these trends can help you make informed decisions. But, a better way might be to leverage Layer-2 solutions, let us check them out in the next section.

Layer 2s to the rescue?

Imagine you’re driving on the highway to your office. There are two lanes, and early in the morning, these lanes become congested with traffic. Now, imagine if additional lanes were added alongside the main road. These extra lanes would help to ease the traffic, allowing more cars to move smoothly. Despite taking different routes, all cars eventually merge back onto the main highway to reach the same destination. This is similar to how Layer-2 (L2) solutions work. They process transactions off the main blockchain (off-chain), reducing congestion.

L2s consume less gas because they handle the bulk of transaction computations off-chain, only committing the final state or summary back to the main Ethereum chain. On Layer-2s, multiple transactions are bundled together before being submitted to the main chain, spreading the cost of gas fees across many users and making it cheaper for each individual transaction. Because of these optimizations, L2 solutions can handle a higher volume of transactions with significantly lower gas fees while still ensuring the security and finality of the main Ethereum blockchain.

A Network Comparison

Ethereum (Mainnet)

A gas unit is the basic unit of computation in Ethereum. Each operation in a transaction consumes a certain amount of gas. In addition to that, the Base Fee is a minimum fee per gas unit that is set by the network protocol. This fee adjusts up and down depending on the network demand.

The Ethereum Improvement Proposal (EIP-1559) established a base fee for each transaction, which is subsequently incinerated, reducing the overall ETH supply. By tracking the ETH burn rate, users can gain insights into the deflationary pressure on Ethereum and its potential impact on the network's long-term economic dynamics. The priority fee (better known: "Tip") is an additional amount paid to miners to prioritize the transaction. If you want to adjust your gas settings, you are able to define a Max Fee as well as a Gas Limit. The Max Fee is the maximum amount you are willing to pay per gas unit (including both, base fee and the tip). The Gas Limit is the overall limit you are willing to spend for this transaction

Optimism (OP)

The OP Mainnet was originally designed to be EVM equivalent. That means, it reuses Ethereum code people are familiar with. But, transaction fees need to diverge from Ethereum. The total cost for a transaction on Optimism is the Execution Gas Fee and the L1 Data Fee.

The Execution Gas Fee is 1:1 identical to the one we have seen on the Ethereum Mainnet section. In general, it is the amount of gas used by the transaction multiplied by the gas price attached to the transaction. OP also uses the EIP-1559. Now here come's the clue: If an transaction costs 50,000 gas on ETH mainnet, so does it on OP mainnet. The only (big) difference is, that the gas price on OP is much, much lower. In order to calculate the gas fees on Optimism, you can utilize the same calculation as for Ethereum mainnet.

The L1 Data Fee fee differs from the Ethereum transaction fee. But wait, why do we need another fee, if our main goal is to reduce gas fees? The L1 Data Fee accounts for the cost to publish an OP Mainnet transaction to Ethereum and is primarily determined by the current base fee on Ethereum. When the Ecotone upgrade was introduced, Optimistic chains have the option of posting transactions using blobs. If enabled, the Ethereum blob data gas price will largely determine the L1 data fee.

Ecotone was an upgrade containing the Dencun upgrade from L1 and the adoption of EIP-4844 blogs for data-availability. With Ecotone, the gas calculation changed a bit. Without going into mathemtical details, at core, it is calculated by serializing the transaction, taking the current ethereum base fee and/or blob base fee into consideration and two parameters that scale the base fee and the blob base fee.

Binance Smart Chain (BSC)

The Binance Smart Chain, along with its BEP-20 Tokens has made itself very popular due to one major reason: Low gas fees. In recent times, tons of projects have shifted from Ethereum to BSC because of this reason. People were (and still are) frustrated with Ethereum's astronomous gas fees and in fear of loosing customers who are not willing to cope with that.

But let us dive into the reasons of why BSC's gas fees are so low. There are actually several factors leading to low gas fees on BSC. Let us begin with the consensus mechanism. BSC utilizes a Proof of Staked Authority (PoSA) which is less resource-intensive than Ethereum's Proof of Stake, leading to faster block times and lower transaction fees.

BSC's network design supports a high throughput of transactions per second (TPS), reducing congestion and maintaining low fees. With a block time of around 3 seconds and larger block sizes, BSC can process more transactions quickly, preventing network slowdowns. Its scalability ensures efficiency even during high demand, and Binance's incentives and subsidies further keep fees low to attract users and developers.

author-image

Christof Jori

5 min read · 27 May 2024