Gas: the fuel that powers blockchain transactions

Think of gas like fuel in a car. Your car needs gasoline to run, and the farther or faster you drive, the more fuel you burn. A blockchain works the same way: every operation -- sending tokens, executing a smart contract, swapping on a decentralized exchange -- requires computational work from the network's validators. Gas is the fee you pay for that work.

Without gas fees, anyone could flood the network with millions of spam transactions at no cost, grinding everything to a halt. Gas serves two critical purposes:

  • Spam prevention: Making each transaction cost something means attackers cannot overwhelm the network for free.
  • Validator compensation: The people running the computers that process and verify your transaction are rewarded with the gas fees you pay.

The term "gas" is most closely associated with Ethereum, but virtually every blockchain has some form of transaction fee. Bitcoin calls them miner fees. Solana calls them transaction fees. The concept is universal even if the name differs.

How gas works on Ethereum

Ethereum's gas system has a few moving parts, but they are straightforward once you understand the basics.

Gas units: measuring computational work

Every operation on Ethereum costs a fixed number of gas units. Simple operations cost fewer units; complex operations cost more.

  • A basic ETH transfer: 21,000 gas units (the minimum for any transaction)
  • An ERC-20 token transfer (like sending USDC): ~65,000 gas units
  • A token swap on a DEX like Uniswap: 100,000-300,000 gas units
  • A complex DeFi interaction (depositing into a vault, multi-hop swap): 200,000-500,000+ gas units

The number of gas units for a given operation is deterministic -- a simple ETH transfer always costs 21,000 gas units regardless of network conditions. What changes is the price per unit.

Gas price: how much you pay per unit

The gas price is measured in gwei, a tiny denomination of ETH. One gwei equals 0.000000001 ETH -- one billionth of an ETH. Gas prices are quoted in gwei because the amounts are too small to express conveniently in ETH.

When the network is quiet, gas prices might be 5-10 gwei. During high demand, they can spike to 100 gwei or more. During extreme congestion events (like a highly anticipated NFT mint), prices have exceeded 500 gwei.

The fee calculation

Your total gas fee is simply:

Total fee = gas units used x gas price per unit

Example: A simple ETH transfer using 21,000 gas units at a gas price of 20 gwei:

21,000 x 20 gwei = 420,000 gwei = 0.00042 ETH

At an ETH price of $2,000, that is approximately $0.84.

The same transfer at 100 gwei would cost 0.0021 ETH, or about $4.20. The gas units stay the same -- only the price per unit changed.

Base fee vs priority fee: EIP-1559

In August 2021, Ethereum implemented EIP-1559, which changed how gas pricing works. Instead of a single gas price, there are now two components:

  • Base fee: A minimum price per gas unit set by the network based on demand. This fee is burned -- it is permanently destroyed, reducing the total supply of ETH. You cannot pay less than the base fee.
  • Priority fee (tip): An optional extra payment that goes directly to the validator who includes your transaction in a block. A higher tip incentivizes validators to prioritize your transaction. During low-traffic periods, a tip of 1-2 gwei is typically sufficient. During congestion, higher tips are needed to avoid waiting.

Your wallet usually handles this calculation automatically, suggesting a total fee based on current network conditions.

Why gas fees go up and down

Gas fees are not fixed -- they fluctuate constantly based on supply and demand for block space. Here are the primary factors:

Network congestion

This is the biggest driver. Ethereum can only process a limited number of transactions per block (roughly every 12 seconds). When more people want to transact than the network can handle, users must outbid each other for inclusion. It works exactly like surge pricing: high demand equals higher prices.

Transaction complexity

A token swap on Uniswap requires far more computation than a simple transfer. It involves reading multiple smart contracts, checking liquidity pools, calculating exchange rates, and updating balances. More computation means more gas units consumed -- even before accounting for the price per unit.

Token type

Sending native ETH is cheaper than sending an ERC-20 token like USDC or USDT. That is because ERC-20 transfers require interacting with the token's smart contract, which adds computational steps. Interacting with more complex token standards (like NFTs) costs even more.

Time of day and week

Gas prices tend to follow global activity patterns. Fees are often lower on weekends and during overnight hours (US time) when fewer people are transacting. This is not guaranteed, but it is a general pattern worth being aware of.

Gas costs across different blockchains

Ethereum mainnet is among the most expensive networks for transactions. Other blockchains and Layer 2 solutions offer significantly lower fees:

NetworkTypical transaction costType
Ethereum mainnet$1 - $50+Layer 1
Arbitrum$0.01 - $0.50Layer 2 (Ethereum)
Optimism$0.01 - $0.50Layer 2 (Ethereum)
Base$0.01 - $0.50Layer 2 (Ethereum)
Polygon$0.01 - $0.10Sidechain
BNB Chain$0.05 - $0.30Layer 1
Solana$0.001 - $0.01Layer 1
Bitcoin$0.50 - $30Layer 1

These ranges are approximate and fluctuate with network activity. Ethereum mainnet fees are highly variable -- a simple transfer might cost $1 during quiet periods or $50+ during congestion spikes.

Layer 2 solutions: why they are cheaper

Layer 2 (L2) networks like Arbitrum, Optimism, and Base are built on top of Ethereum. They process transactions off the main Ethereum chain, then periodically "settle" batches of transactions back to Ethereum for security. This is like carpooling: instead of each passenger driving separately, everyone shares the ride and splits the cost.

The result is that transactions on L2s have the security guarantees of Ethereum but cost a fraction of the price. For most everyday transactions -- swaps, transfers, DeFi interactions -- Layer 2s offer the same functionality at 10x to 100x lower cost.

The tradeoff is that moving assets from Ethereum mainnet to a Layer 2 (called "bridging") itself costs a mainnet gas fee, and withdrawing back to mainnet can take time (up to 7 days for some optimistic rollups without using a fast bridge). But once your assets are on an L2, everything is dramatically cheaper.

Failed transactions still cost gas

One of the more painful aspects of gas fees: if your transaction fails, you still pay for the gas consumed. The network processed your transaction up to the point where it failed -- that computation happened, validators did the work, and they get compensated regardless.

Common reasons for failed transactions include:

  • Setting a gas limit too low (the transaction ran out of gas mid-execution)
  • Slippage too tight on a swap (the price moved beyond your tolerance)
  • Trying to interact with a contract that has paused or changed
  • Insufficient token balance or approval

To minimize failed transactions, double-check your settings before confirming, and use the gas estimates your wallet provides rather than manually lowering them.

Gas and DeFi: why DeFi is expensive on Ethereum

Decentralized finance (DeFi) transactions are particularly expensive on Ethereum mainnet because they involve complex multi-step operations. A single DeFi interaction might involve:

  • Approving a token for spending
  • Swapping that token through one or more liquidity pools
  • Depositing the result into a lending protocol
  • Each step consuming its own gas

A full DeFi strategy that involves three or four steps can easily cost $20-$100 in gas on Ethereum mainnet. This is why DeFi activity has increasingly migrated to Layer 2 networks, where the same strategy might cost $0.50 total.

Practical tips for paying less gas

Use Layer 2 networks

For most DeFi and transfer activity, L2s like Arbitrum, Optimism, and Base offer the same functionality at a fraction of the cost. This is the single most impactful thing you can do.

Time your transactions

If you are not in a rush, monitor gas prices and transact during quieter periods. Gas trackers like Etherscan's gas tracker show current and historical prices.

Set reasonable gas limits

Your wallet suggests a gas limit for each transaction. Do not lower it arbitrarily -- a failed transaction costs gas with no result. But you can adjust the priority fee (tip) if you are willing to wait longer.

Batch when possible

Some protocols let you combine multiple actions into a single transaction. Claiming and reinvesting rewards in one step, for instance, saves paying gas twice.

Gas costs and portfolio mobility

Gas fees have a real impact on how quickly and cheaply you can adjust your portfolio. If you hold assets on Ethereum mainnet and gas spikes to $50 per transaction, rebalancing a portfolio across several positions could cost hundreds of dollars. This affects what CleanSky calls mobility risk -- the risk that moving or adjusting your positions is impractical because of high costs or slow withdrawal times.

Understanding your gas exposure across chains helps you plan ahead. Assets on cheaper networks can be moved quickly; assets on Ethereum mainnet during congestion may be effectively locked in place unless the amounts are large enough to justify the fees.

How CleanSky helps: CleanSky's risk framework includes a mobility dimension that factors in how easily you can exit or rebalance your positions. High gas costs on mainnet reduce mobility -- CleanSky helps you see this across your entire portfolio.

Key takeaways

  • Gas is the fee you pay for computational work on a blockchain. It prevents spam and compensates validators.
  • On Ethereum, your total fee equals gas units (fixed by operation type) multiplied by gas price (variable with demand).
  • Gas prices rise and fall with network congestion, just like surge pricing.
  • Layer 2 networks offer the same security as Ethereum at 10-100x lower cost.
  • Failed transactions still cost gas -- always double-check before confirming.
  • Gas costs directly affect your ability to move and manage your portfolio.

For more on the topics covered here, see our guides on blockchain basics, understanding risk in crypto, decentralized finance, and DeFi metrics explained.

See your positions across cheap and expensive networks — and understand the mobility risk of each one.

Try CleanSky Free →