ETH Gas 101: An Introduction to Ethereum Gas for Traders and Builders

Blocknative Ethereum Web3

The principle behind Ether (ETH) gas is straightforward. For your transaction to become part of the Ethereum blockchain, you must pay gas fees to transact. And the amount of gas you must pay varies from block to block — depending upon mempool congestion.

The gas price paid for each transaction acts as an incentive to miners for your transaction to be included in a block. The fee miners collect for this process needs to be attractive, but paying a high gas price can result in a profit loss for a trader.

While the principle is straightforward, the details of ETH gas are complex. Traders need to know how to find the Goldilocks gas price, ensuring max profit potential — there is a balance between paying enough gas to get on-chain quickly and overpaying for that result. Builders need to know how to provide that Goldilocks estimation to their users. Gas price estimation is tough to nail down, but with the right knowledge and tools Dapps can pinpoint ideal gas prices, lessening transaction anxiety for their users.

Gas glossary: Let’s break down important ETH gas terms

Before getting into gas prices and the importance it plays in the lifecycle of a transaction, there are some important distinctions to make between ETH gas terms:

  • Gas: A transaction unit that represents computational effort. It’s the fuel you must buy to get miners to add your transaction to a block.
  • Gas price: The amount you are willing to pay for every unit of gas required to complete a transaction (denominated in Gwei).
  • Gas limit: The maximum amount someone is willing to pay for a transaction to complete.
  • Gwei: A fractional unit of ETH — 1.0 ETH = 1,000,000,000 Gwei.
  • Transaction fee: The fee associated with the completed transaction (gas used * gas price). Collected by the miner who includes the transaction in a block.

The basics of navigating gas prices

Navigating gas prices is difficult regardless of experience level because gas prices change every second. Traders need to balance the time it takes for a transaction to be included on-chain with the potential profit. A transaction that needs to be confirmed quickly requires a high gas price — to incentivize miners to include it in a block.

A transaction that isn’t time-sensitive could have a lower gas price, though it still needs to be attractive enough for a miner to include it in a reasonable timeframe. If a gas price is set too low, the transaction could be missed, ignored, or the wallet could become stuck, freezing transactions from that wallet. A wallet will remain stuck until the transaction is resolved.

In the event of a stuck wallet, a user will have to issue a Speed Up or Cancel transaction.

By providing real-time gas estimation in a Dapp, builders can help traders confidently enter a gas price. But one gas price (the highest, most competitive!) will not work for every type of transaction. The type of transaction dictates how much ETH gas a trader is comfortable paying to include it in a block.

Types of ETH transactions

The gas price a trader is willing to pay is likely different depending on the type of transaction.

Consider two types of mainstream transactions: DeFi (decentralized finance) and NFT (non-fungible tokens). If the two were road trips, they’d have the same goal of reaching a final destination but would take different paths and pay different amounts of ETH gas to get there. A DeFi transaction would be like trying to drive from New York to LA as fast as possible regardless of which roads are traveled and how much gas is used. An NFT transaction would be like driving from New York to LA efficiently for the lowest cost.

Let’s take a look at some details of these two types of transactions.

DeFi transactions

A DeFi transaction, one built on a protocol using smart contracts, will often be time-sensitive. Profit is the endgame, and that is tied to how fast the transaction can get included in a block. To get included in a block, the transaction fee has to be attractive to miners. To make sure the transaction fee is attractive to miners, a trader needs to set the gas price accordingly. 

DeFi transactions can be very complex — sometimes calling multiple smart contracts. And the more complex the transaction, the higher the level of gas required for the number of operations a smart contract performs. 

What percentage of the profits are you willing to sacrifice to get the transaction completed? This is the ultimate question for a trader. If there’s a profit potential of $10,000 contingent on if it goes through in the next few minutes, how much of the $10,000 are you willing to lose to push the transaction to the front of the line? If the transaction is complex, the computational effort to include it in a block becomes greater, requiring higher gas prices to incentivize miners. As the gas price increases, the potential profit decreases. In the worst-case scenario, you end up with a grim trigger — when a fee is the same amount as the potential profit.

NFT transactions

While there are some NFT transactions that will be time-sensitive, they are not all necessarily so. An artist might create NFTs from their life’s work and want to get them included in a block to become sellable items. Ideally, this is done as fast as possible, but if gas prices are high at that exact moment, it’s probably not worth paying those fees because it will eat into the profit too much. If an artist thinks each NFT could sell for $1,000, but the gas price currently sits at $700, a 70% profit loss is probably not worth pursuing.

In this scenario, the artist could choose to wait until the gas price comes down, or they could set a low, uncompetitive price and wait a considerable time for their transaction to get picked up by a miner. An artist might be fine if the transaction takes one or two days to complete, but there’s also a limit to how patient people are. ETH gas prices are so volatile that a semi-competitive gas price that doesn’t get included in the current block could become extremely uncompetitive in the next block.

With thousands of new transactions entering the mempool every second, gas prices need to remain competitive. This competitiveness is nearly impossible to sort out if the goal is a low transaction fee regardless of time. Determining the right gas price at the right time is key to savvily navigating the marketplace and maximizing profit.

The challenge of ETH gas estimation for traders, builders, and Dapps

There is no limit to how many transactions can be included in a block, but there is a gas limit per block — only a certain amount of computation can fit inside any given block. More complex transactions will require more computational power to complete, and thus harder to estimate a competitive gas price.

Transaction complexity

A simple transaction would be a peer-to-peer transaction: you want to send someone one unit of ETH. This would not require a smart contract, a program on the blockchain that runs when conditions are met, so the computational power needed to complete this transaction is lower.

But let’s say instead of sending your friend one unit of ETH, you want to contribute it to a liquidity pool, adding your ETH unit to a collection of funds. This is a more complex transaction that requires a smart contract to check if conditions are met, requiring more computational power to complete.

While there’s no transaction limit per block, there will typically be around 125,250 transactions included in each one. But an extremely complex transaction could potentially occupy 25% or 50% of a block. This would require a lot of computational power and a very high gas price to complete. This kind of transaction will impact all other transactions currently waiting to get on-chain, redefining what a competitive gas price is at that moment.

A fluctuating marketplace

Finding the right gas price is further complicated by seemingly random fluctuations.

Because the transaction complexity levels can fluctuate so much between blocks, gas prices in previous or current blocks don’t give you an accurate view of what will be a competitive fee in the next block. When an attractive gas price is a fast-moving target, it becomes harder to estimate accurately.

While none of this is easy, it is certainly easier to estimate a competitive gas price when the goal is “on-chain as fast as possible.” Looking at the current highest gas price in a pending block will allow someone to confidently enter a very high gas price with the expectation that it will be competitive enough to get on-chain. It is much harder to estimate a gas price when the goal of a trader is “sometime soon, as long as I can still make a good profit.”

Complicating this even further is very small transactions getting confirmed out of nowhere. A block could be almost full, but a miner wants to use all available space and collect as much value as possible out of a block. So they find low-hanging transaction fruit, a transaction with a low gas price that could have been sitting around for days or weeks.

ETH gas estimation is a challenge for builders to include in Dapps and DeFi protocols. If you underestimate gas prices for your users, they will not get their transactions on-chain, and you’ll be dealing with customer service complaints. If you overestimate gas, you burn up funds that could otherwise be locked into your protocol. And leaving gas up to the wallet offloads an important functionality to a third party. If you can build that accurate ETH gas estimation into your Dapp, users will have much higher success rates getting their transactions on-chain.

ETH gas estimation in real-time

Focusing on the data in the mempool and what’s happening in the pending block will get an accurate look at gas prices. Gas Estimator provides real-time data about the probability of transactions getting included in the next block with specific gas prices.

Observe Ethereum

Blocknative's proven & powerful enterprise-grade infrastructure makes it easy for builders and traders to work with mempool data.

Visit ethernow.xyz

Want to keep reading?

Good choice! We have more articles.

eip-4844,-blobs,-and-blob-gas:-what-you-need-to-know
Ethereum

EIP-4844, Blobs, and Blob Gas: What you need to know

With the upcoming Dencun upgrade, Ethereum will adopt EIP-4844, commonly called proto-danksharding...

introducing-ethernow:-real-time-observability-for-ethereum
Ethereum

Introducing Ethernow: Real-Time Observability for Ethereum

On-chain data tells you what has happened. Pre-chain data tells you why it is happening. For anyone..

mempool-archive-quickstart:-how-to-use-blocknative's-historical-ethereum-mempool-data-to-analyze-private-transactions,-mev,-and-ofas
Blog Nav Post

Mempool Archive Quickstart: How to use Blocknative's historical Ethereum mempool data to analyze private transactions, MEV, and OFAs

Blocknative offers the most exhaustive historical archive of Ethereum's mempool transaction events,..

Connect with us. Build with us.

We love to connect with teams who are building with Blocknative. Tell us about your team and what you would like to learn.

"After first building our own infrastructure, we appreciate that mempool management is a difficult, expensive problem to solve at scale. That's why we partner with Blocknative to power the transaction notifications in our next-generation wallet."

Schedule a demo