Gas Fee (Ethereum)

Why Trust Techopedia

What Is Ethereum Gas?

Ethereum gas is the fee that a user must pay to conduct a transaction on one of the most popular altcoins or blockchains, the Ethereum blockchain. In technical terms, gas refers to “the amount of computational effort” required to execute operations on a blockchain network.

Advertisements

To understand the definition of Ethereum gas fees better, we need to recap what a blockchain is. Imagine blockchain as a chain of hard drives. Each hard drive (block) has a limited amount of space to save transaction data.

Users transacting on a blockchain are actually paying gas fees so that their transaction information is uploaded to a block.

Gas fees are critical to a blockchain’s security. Part of the gas fees on Ethereum is paid to block validators – nodes that verify transactions and create new blocks – for performing honest work.

Gas fees also prevent users from spamming the network by making transactions expensive for such bad actors.

What Are Gas Fees Paid For?

Ethereum functions without a corporation supervising its daily operations. The public blockchain is an open and peer-to-peer (P2P) network with thousands of random participants called miners or validators powering the network. The blockchain collects a gas fee from transactions to pay miners and validators to do honest work.

Gas fees are integral to the daily operation of a blockchain. On Ethereum, gas fees are required for all types of transactions.

A Real-Life Example

Let’s take a look at a simple example of the Ethereum gas fee usage.

Brian is an NFT artist and wants to mint his NFT collection on Ethereum. He will have to upload an NFT smart contract to the Ethereum blockchain, for which he will have to pay gas fees to process the transaction. Each time he wants to make new changes to his smart contract, he will have to pay gas fees.

Amy is an NFT collector who notices Brian’s newly-minted artworks on an NFT marketplace called Opensea. Amy can make an on-chain bid for one of Brian’s NFTs. She will have to pay a gas fee to process her bid.

Amy can then choose to take a crypto loan on her newly-bought NFT by depositing it as collateral on an NFT lending protocol. Again, Amy will have to pay gas fees to complete the transactions.

How Do Gas Fees Work?

Gas fees are paid in the native currency of the blockchain network. On Ethereum, the native token Ether or ETH is used to pay gas fees. 

Gas fees are paid in ETH on Ethereum-based layer-two (L2) networks like Optimism and Arbitrium. L2s are designed to help Ethereum scale. They bundle transactions and submit them on the main chain (i.e. Ethereum), thereby removing the need of paying gas for every single transaction.

On the Ethereum network, gas prices are denoted in giga-wei (gwei).

What is gwei?
Gwei is a unit of ether (ETH) – like cents are to the U.S. dollar or pennies to the British pound. Each gwei is equal to 0.000000001 ETH.

How Are Gas Fees Calculated?

Each block on a blockchain has limited space. For example, the Bitcoin blockchain has a maximum block size of 4MB.

Ethereum block sizes are limited by setting block gas fee limits. 

An Ethereum block has a target size of 15 million gas and a maximum limit of 30 million gas. This means that the total amount of gas spent on all transactions in a block must be less than the block limit. 

Why Do Gas Fees Fluctuate?

The block limit creates a market for gas fees which fluctuate based on the demand for block space. If there are more pending transactions on a given day, the gas fees will be higher than average. 

Every block has a base fee, a value set by the protocol. A user has to equal the base fee at least, or their transaction will not be processed. 

A tipping feature called “priority fee” is important for the gas fee market. The priority fee allows users to tip block validators so that they are incentivized to include the user’s transaction in the upcoming block. Again, the priority fee is a factor of block space demand. 

Ethereum also has a gas limit of 21,000 gwei for a standard transaction.

A Real-Life Example

Let’s go back to our previous example. Amy now wants to pay 1 ETH to Brain. The base fee is 10 gwei, and Amy tips 5 gwei to speed up the transaction.

The formula to calculate the total gas fee for the transaction is as follows:

Total gas fee = gas limit * (base fee + priority fee)

With the figures above, Amy’s total gas fee will be 21,000 * (10+5), which is 315,000 gwei or 0.000315 ETH.

As such, 1.000315 ETH (1 ETH + 0.000315 ETH) will be deducted from Amy’s wallet to pay 1 ETH to Brian.

EIP-1559: Gas Fee Market Change

It’s important to note EIP-1559 when discussing Ethereum gas fees. Before EIP-1559, gas fees on Ethereum were priced using a simple auction mechanism where miners chose transactions with the highest bids when creating new blocks. In order to prevent abnormal gas fee spikes and network delays, EIP-1559 was implemented in 2021.

EIP-1559 introduced a base fee – which adjusts according to network congestion – to make Ethereum gas fees more predictable. It also introduced priority fees for users who want transaction priority. 

Block validators only receive the priority fees from the total gas. The base fee is burned by the protocol. The burning of the base fee counterbalances ETH inflation and removes the miner incentive to manipulate gas fees.

Before EIP-1559

After EIP-1559

Simple auction-based fee model

Gas fees have two components: base fee and priority fee

Occasional spikes in gas fees as miners included the highest gas fees bids when creating new blocks

Gas fees are more predictable

No base fee

The base fee adjusts automatically according to network congestion

No priority fee

The priority fee where users can tip validators to incentivize faster transactions

No fee burning

The base fee is burned

Miners receive total gas fees

Validators only receive priority fees

Fixed block size

Variable block sizes

The Bottom Line

The gas fee is the oil of a blockchain network. It is like petroleum or diesel, which cars need to move from one location to another. Without paying gas fees, users cannot transact on Ethereum. In turn, it is the use of ETH as gas that provides the token with utility and keeps its market demand high.

Advertisements

Related Questions

Related Terms

Mensholong Lepcha
Crypto & Blockchain Writer
Mensholong Lepcha
Crypto & Blockchain Writer

Mensholong is an experienced crypto and blockchain journalist, now a full-time writer at Techopedia. He has previously contributed news coverage and in-depth market analysis to Capital.com, StockTwits, XBO, and other publications. He started his writing career at Reuters in 2017, covering global equity markets. In his free time, Mensholong loves watching football, finding new music, and buying BTC and ETH for his crypto portfolio.