Lumaktaw sa main content

Gas fees

Network fees

Network fees on Ethereum are called gas.
Gas is the fuel that powers Ethereum.

Hero header image

Summary

  • Every transaction on Ethereum requires a small form of payment to process
  • These fees are known as ‘gas’ fee
  • Gas fees are not set, they change based on network congestion

What are gas fees?

Think of Ethereum as a large computer network where people can do tasks like sending messages or running programs. Just like in the real world, these tasks require energy to get done.

In Ethereum, each computational action has a set "gas" price. Your gas fees are the total cost of the actions in your transaction. When you send a transaction or run a , you pay in gas fees to process it.

A robot

How do I pay less gas?

While higher fees on Ethereum are sometimes inevitable, there are strategies you can use to reduce the cost:

Time your transactions

Just like travelling off-peak is less crowded and more affordable, Ethereum is generally cheaper to use when North America is asleep.

Wait for gas to go down

Gas prices go up and down every twelve seconds based on how congested Ethereum is. When gas prices are high, waiting just a few minutes before making a transaction could see a significant drop in what you pay.

Use layer 2

Layer-2 chains are built atop Ethereum, offering lower fees and handling more transactions. They're a good choice to save on fees for transactions that don't need to happen on the main Ethereum network.

Try layer 2

What causes high gas fees?

Whenever the amount of computation (gas) on Ethereum exceeds a certain threshold, gas fees begin to rise. The more the gas exceeds this threshold, the quicker gas fees increase.

Higher fees could be caused by things like popular or NFTs, periodically increased trading on , or an overwhelming number of user activity at peak times.

Developers on Ethereum should take care to optimise their smart contracts usage before deploying. If lots of people are using a poorly written smart contract, it will consume more gas and could inadvertently cause network congestion.

Want to dive deeper? Check out the developer docs.

Attack of the Cryptokitties

In November 2017, the popular CryptoKitties project was launched. Its rapid spike in popularity caused significant network congestion and extremely high gas fees. The challenges posed by CryptoKitties accelerated the urgency of finding solutions for scaling Ethereum.

Why do we need gas?

Gas is a critical element in keeping Ethereum secure and processing transactions. Gas helps in many ways:

Gas keeps Ethereum by preventing malicious actors from overwhelming the network with fraudulent activities.

Because computation costs gas, spamming Ethereum with expensive transactions, either accidentally and maliciously, is financially disincentivized.

A hard-limit on the amount of computation that can be done at any one time prevents Ethereum from being overwhelmed, helping to ensure the network is always accessible.

How is gas calculated?

Advanced

The total gas fee you pay is made up of a few parts:

  • Base fee: a fee set by the network that has to be paid for a transaction
  • Priority fee: an optional tip to incentivise node operators to include your transaction
  • Units of gas used*: remember we said gas represented computation? More complex actions, like interacting with a smart contract, use more gas than simple ones, such as sending a transaction.
    • * See Figure 1 to see how much gas different types of transactions use

The formula for calculating a gas fee is units of gas used * (base fee + priority fee). Most wallets will calculate gas usage and display it in a more straight-forward way.

Figure 1: Gas used by transaction type
Transaction typeUnits of gas used
Sending ETH21,000
Sending ERC-20 tokens65,000
Transferring an NFT84,904
Swapping on Uniswap184,523

Frequently asked questions

Nakatulong ba ang page na ito?