What are ETH gas fees?
ETH gas fees are the charges incurred for transactions and smart contracts on the Ethereum network. These fees are necessary to fund the computational power needed to execute commands within the Ethereum Virtual Machine (EVM).
The word “gas” serves as a metaphor for the fuel required to power the Ethereum Virtual Machine. Each transaction requires a specific amount of Ethereum gas depending on its complexity. The amount is expressed in Wei, the smallest unit of ETH. A simple ETH transfer requires less gas than a complex smart contract. Two factors determine the Ethereum gas fees: the gas limit, which defines the maximum computational power for a transaction, and the ETH gas price, which reflects how much a user is willing to pay per unit of gas.
The system ensures the Ethereum network runs efficiently and validators are fairly rewarded for their computational work. ETH gas fees fluctuate depending on network demand – high activity increases the cost, while low demand reduces it.
Why are they called “gas” fees?
In the Ethereum network, transaction charges are referred to as gas fees. Gas represents the computational effort required to execute transactions and smart contracts. The name is inspired by the energy consumption of a conventional machine: the term “gas” stands for the fuel powering the Ethereum Virtual Machine (EVM), much like a car needs petrol to run. This concept ensures every executed operation is charged a fee that reflects the necessary computing resources. Without such a system, malicious actors could flood the network with resource-heavy operations, leading to inefficiencies.
What is Gwei?
Gwei is a smaller unit of Ether (ETH), the Ethereum network’s cryptocurrency. One Gwei equals one billionth of an Ether, or 0.000000001 ETH. The name “Gwei” comes from “Giga” (billion) and “Wei.” Wei is the smallest denomination of Ether, named after cryptographer Wei Dai, the creator of B-Money. Wei Dai’s ideas are considered precursors to Bitcoin (BTC).
Gwei is mainly used to express gas costs, as it's more practical to quote ETH gas prices in Gwei rather than Ether. For instance, it’s more common to say that the ETH gas fee is 20 Gwei rather than 0.00000002 ETH.
Why are there Ethereum gas fees?
ETH gas fees play a key role in running the Ethereum network. They ensure the fair allocation of computing resources and efficient processing of transactions. Every action on Ethereum – whether a simple transfer or a complex smart contract – requires computational resources, which validators provide. ETH gas fees serve as an incentive for validators to confirm transactions and add them to the blockchain.
Another crucial element is protecting the network from spam and inefficient transactions. Without fees, malicious users could overload the network with worthless commands. Gas fees reduce such risks by ensuring that each transaction carries economic value. The exact workings of the system depend heavily on the Ethereum Virtual Machine and the interaction between gas limit and ETH gas price.
Ethereum Virtual Machine (EVM)
The Ethereum Virtual Machine (EVM) executes transactions and smart contracts on Ethereum. It functions as a decentralised global computer environment where developers can deploy programs (smart contracts). Each command executed by the machine requires a set amount of Ethereum gas, as the EVM consumes resources for every calculation.
The EVM operates deterministically, meaning all nodes in the network perform the same calculations with the same outcomes. To keep the network efficient and prevent it from being overwhelmed by endless or overly complex computations, every calculation incurs an ETH gas fee, expressed in Gwei.
The difference between gas limit and gas price
Ethereum gas fees consist of two main components:
Together, these factors determine the final Ethereum gas fee. A high ETH gas price can lead to faster processing, while a gas limit set too low may cause the transaction to fail.
How are ETH gas fees calculated?
On the Ethereum network, transaction fees (known as ETH gas fees) are calculated by multiplying the consumed gas units with the sum of the base fee and tip.
The formula is:
Total cost (in Gwei) = gas units × (base fee + tip)
One gas unit equals 0.000000001 ETH (10^-9 ETH), also known as Gwei. The base fee varies with network demand and is burned, while the tip (also called priority fee) goes to validators for processing the transaction.
Example calculation:
Say Jens wants to send Anna one ETH. A simple ETH transaction typically consumes 21,000 gas units. If the base fee is 100 Gwei and Jens adds a tip of ten Gwei, the fee is calculated as follows:
21,000 gas units × (100 Gwei + 10 Gwei) = 2,310,000 Gwei
Since one Gwei is 0.000000001 ETH, 2,310,000 Gwei equals 0.00231 ETH. So, the total cost of the transaction is 0.00231 ETH. Jens sends a total of 1.00231 ETH, Anna receives one ETH, 0.0021 ETH is burned and 0.00021 ETH is paid as a tip to the validators.
Base fee vs priority fee (EIP-1559)
With the introduction of EIP-1559, Ethereum’s fee model was revised. The transaction fee now consists of a base fee and a priority fee. The base fee is a fixed amount that applies to every transaction and varies based on network activity. This fee is burned – removed from circulation – which can have potentially deflationary effects on ETH. The priority fee, however, is an optional amount that users can add to prioritise their transaction over others. By offering a higher priority fee, users can ensure their transaction is processed faster by miners.
Gas limit and its impact on costs
The gas limit sets the maximum amount of gas that can be used to execute a transaction or smart contract. A higher gas limit enables more complex operations but also leads to higher potential costs. If the specified gas limit is too low, the transaction might fail due to insufficient gas to complete all required operations. In such cases, users lose the already consumed gas without the transaction being successfully completed.
It’s therefore important to set the gas limit carefully to ensure enough gas is available for the intended operation without risking unnecessarily high fees.
To optimise the gas limit, users can rely on wallets and tools that automatically adjust gas settings. Wallets and tools with automatic gas optimisation help set the right gas limit, while services like Etherscan’s Gas Tracker provide real-time data on current gas prices. These resources support users in striking the right balance between speed and cost.