Skip to content
Independent crypto magazine Updated Publish with us
MustangCoinCrypto explained, without the hype

Explainers for people who hold keys, pay fees and read the fine print.

Basics

Why Gas Fees Exist

Ethereum's gas fees are the cost of including a transaction in a scarce and competitive block space.

Published Reading time 3 minDesk MustangCoin editorial

Intersection Almost Jammed Up
Photo: Ingolfson / Wikimedia Commons, Public domain

Gas is the key unit of how an Ethereum transaction's computational work is measured, and priced by demand.

The Ethereum.org developer documentation defines gas as the unit of work a transaction performs on the Ethereum network. Unlike claiming fees off the transaction size in bytes, gas pricing directly addresses the scarce supply of block space on Ethereum. A simple Ethereum transfer of value uses 21,000 gas, while interacting with a contract costs more, as each operation on a contract has its own gas cost.

In August 2021, EIP-1559 introduced a two-part pricing mechanism for Ethereum transactions. Under EIP-1559, the total fee a user pays to the network for a transaction is divided into two components: the base fee set by the protocol and the priority fee--also known as the "tip"--paid to the block proposer or validator. Importantly, the base fee is not earned by the block proposer/validator, but is burned by the protocol. The combustion of the base fee reduces the value of the ETH supply over time, and it's part of what makes a deflationary asset. The priority fee, on the other hand, represents a payment to incentivize a block proposer/validator to include the transaction, and it is not burned. But the priority fee is not fixed, it can be set by the user and varies widely, depending on the transaction they want to be included.

Depending on the fullness of the block, the base fee rises and falls to have more or fewer transactions included, providing a dynamic pricing model where fees are primarily driven by the demand for block space. As the Eco support article explains, "The base fee adjusts on a function of the number of transactions in the previous 2,000 blocks". This means that the fee you pay for a transaction depends on recent block fullness and fluctuates more directly with demand than with factors like the raw number of bytes. For example, during periods of high network congestion, the base fee can spike dramatically to limit the number of transactions included in a block and prioritize higher-paying transactions.

Hashes can be replaced by sending a later transaction with the same nonce (a unique identifier) and a higher fee. For EIP-1559 transactions, the Ethereum protocol specifies that two specific fields must be increased when replacing a transaction. The field maxPriorityFeePerGas must be increased, to signal a higher priority fee to the block proposer/validator. The maxFeePerGas must be increased to a new value that exceeds the target block's base fee, which can be pulled from the network when crafting the transaction. If that condition is met, then the user's transaction will be eligible to be included in the target block.

One way that users and developers can mitigate the burden of Ethereum transaction fees is by using rollups, or layer 2 scaling solutions that execute transactions off of the main Ethereum chain. In a rollup scheme, transactions are executed off-chain, with data such as transaction hashes posted to the Ethereum main chain. Rollups can significantly reduce transaction costs, both by batching multiple transactions together and by leveraging less computationally intensive cryptography.

Despite EIP-1559 changes and rollup protocols, Ethereum's gas fees remain a fundamental part of the network. For users and developers, understanding how gas pricing works and knowing how to manage transactions for optimal inclusion is key to navigating the fee market. Users can monitor the base fee and block fullness, send transactions during lower-demand periods, set an appropriate maxPriorityFeePerGas and maxFeePerGas, and even replace transactions with higher fees if needed. As Ethereum usage continues to grow, a nuanced understanding of gas and fees will be all the more important for participating in the largest decentralized application platform to date.