Ethereum

Ethereum Gas Optimisation Strategies

Techniques for reducing the Ethereum transaction fees paid by users and smart contract developers, including timing trades during low-congestion periods, using Layer 2 networks, batching transactions, and writing gas-efficient Solidity code.

Ethereum gas fees have been the single most-discussed friction point for mainstream adoption since the DeFi boom of 2020. At peak congestion, simple token swaps cost $50–200 in gas; complex interactions with DeFi protocols could exceed $500. Understanding how gas works and how to minimise your costs — whether as a user or a developer — is essential for efficient Ethereum participation. With the rise of Layer 2 networks, the average user's gas costs have fallen dramatically, but mainnet optimisation remains relevant for large transactions and developers deploying contracts.

How Ethereum Gas Works: EIP-1559 Mechanics

Post EIP-1559 (implemented August 2021), every Ethereum transaction pays two components: a base fee (set by the protocol algorithmically based on block utilisation, burned entirely — not paid to validators) and a priority fee (a tip paid directly to the validator/miner who includes the transaction). The base fee rises when blocks are more than 50% full and falls when blocks are less than 50% full, targeting 50% average utilisation. This creates a predictable fee mechanism where base fee adjustments are constrained to ±12.5% per block, making fee estimation far more reliable than the previous pure-auction model.

Users set a max fee (the absolute maximum they'll pay) and a max priority fee (their tip). Actual fee paid = base fee + min(max priority fee, max fee - base fee). Any difference between max fee and actual fee paid is refunded. Wallets like MetaMask automatically estimate appropriate values but allow manual adjustment — understanding this lets you save significantly by setting appropriate limits rather than accepting the wallet's conservative defaults.

Timing: Gas Price Patterns

Ethereum gas prices follow predictable patterns driven by global user activity. Base fees are lowest during European and North American off-hours: late nights UTC (00:00–08:00 UTC) and weekends consistently show 20–50% lower base fees than peak weekday afternoon hours. For non-time-sensitive transactions (moving funds to cold storage, routine DCA purchases, governance votes), scheduling them during low-congestion windows is the simplest and most impactful gas optimisation available to users.

Tools for monitoring gas: Etherscan Gas Tracker (real-time base fee and historical charts), GasNow (predictive gas recommendation), and Blocknative Gas Estimator (mempool-based prediction). Wallet extensions like Rabby display current gas prominently and warn when gas is abnormally high relative to recent history.

Layer 2 Networks: The Primary Gas Solution

The most impactful gas optimisation for regular users is simply using Layer 2 networks (Arbitrum, Optimism, Base, zkSync Era, Starknet) instead of Ethereum mainnet for routine DeFi activity. L2 transactions cost $0.01–0.10 compared to $2–50 on mainnet for equivalent operations, representing a 99%+ reduction in transaction costs. All major DeFi protocols have L2 deployments with equivalent functionality: Uniswap on Arbitrum, Aave on Optimism, Curve on multiple L2s, and so on.

The workflow: bridge assets from Ethereum mainnet to your L2 of choice once (this bridge transaction costs mainnet gas but is a one-time cost), then interact with DeFi protocols on L2 at near-zero cost indefinitely. When done, bridge back to mainnet if needed. For users whose DeFi activity is primarily swapping and yield farming on established protocols, making this switch eliminates 95%+ of gas costs immediately.

Transaction Batching

Each Ethereum transaction has a fixed base cost of 21,000 gas regardless of complexity, plus variable costs for computation and storage. Batching multiple operations into a single transaction eliminates redundant base costs. Strategies for batching: use protocols that combine multiple steps (Uniswap's permit2 enables single-signature multi-token approvals), use multicall contracts (Uniswap's Multicall and MakerDAO's MCD batch contracts combine multiple reads or writes), and use smart contract wallets (Safe, formerly Gnosis Safe) that execute multiple operations in a single transaction.

Token approval management is a specific area where batching saves substantially. The legacy ERC-20 approval flow requires two separate transactions (approval + execution) for each new token/protocol interaction. EIP-2612 permit signatures allow off-chain approval that's included in the execution transaction — saving one transaction entirely. Protocols like Uniswap v3 and Aave v3 support permit-based approvals; always prefer permit-based flows when available.

Gas Tokens and Refunds (Historical Context)

Pre-EIP-3529 (London upgrade), Ethereum offered gas refunds for clearing storage slots — creating incentives for gas token contracts (Chi Gastoken, GST2) that stored gas during low-price periods and burned it for refunds during high-price periods. This mechanism was substantially reduced in EIP-3529 and is no longer economically viable. Existing gas token holdings have minimal value in the post-London environment.

Developer-Side Gas Optimisation

For Solidity developers, gas efficiency is a first-class design concern. Key patterns: Storage minimisation — writing to storage (SSTORE) costs 20,000 gas for new slots and 5,000 for updates; packing multiple variables into a single 32-byte storage slot via struct packing reduces storage operations dramatically. Memory vs storage — reading from memory costs 3 gas; reading from storage costs 100–800 gas (cold vs warm access post EIP-2929); copying storage data to memory for repeated reads within a function saves gas on multi-read patterns. Short-circuit evaluation — ordering conditions so the cheapest checks run first in AND/OR chains fails fast without executing expensive operations. Custom errors — using custom error types (introduced in Solidity 0.8.4) instead of revert strings saves deployment gas and revert gas. Avoiding redundant operations — caching array lengths in loop bounds, using unchecked arithmetic where overflow is impossible (post Solidity 0.8.x).

Professional gas profiling tools: Hardhat Gas Reporter (outputs per-function gas costs in test runs), Foundry's forge snapshot (tracks gas changes across commits), and ETH Gas.Watch (monitors production contract gas usage). Deploying gas-optimised contracts saves every user who interacts with them — optimisation at deployment scales across the entire user base.

Practical User Checklist

For regular Ethereum users, the gas optimisation priority order is: (1) Move routine DeFi activity to L2; (2) Time non-urgent mainnet transactions for off-peak hours; (3) Use permit-based approvals instead of two-transaction approvals; (4) Set max fees manually based on current base fee rather than accepting wallet defaults; (5) Batch operations using multicall or smart contract wallets when executing multiple related transactions. These five steps, implemented consistently, can reduce an active DeFi user's annual gas spend by 80–95%.