Gas Fundamentals
Every Ethereum operation costs gas. A simple ETH transfer uses 21,000 gas. A Uniswap swap might use 150,000+. Complex DeFi interactions can use millions. Your total cost = gas used × gas price.
Gas Cost Formula
Total Cost = Gas Used × (Base Fee + Priority Fee) × ETH PriceGas Used: Determined by transaction complexity (fixed per operation type)
Gas Price: In gwei (1 gwei = 0.000000001 ETH). Fluctuates with demand.
ETH Price: Gas is priced in ETH, so USD cost scales with ETH price.
Key Insight
Gas prices can vary 10-100x depending on network conditions. A swap that costs $5 on a quiet Sunday might cost $50+ during a popular NFT mint. Timing matters enormously.
EIP-1559 Explained
EIP-1559 (London upgrade, August 2021) revolutionized Ethereum gas pricing. Instead of blind bidding, fees are now more predictable with a base fee that adjusts automatically.
Two-Part Fee Structure
Base Fee
- • Algorithmically determined
- • Increases when blocks >50% full
- • Decreases when blocks <50% full
- • Burned (not paid to validators)
Priority Fee (Tip)
- • You set this amount
- • Paid directly to validators
- • Higher tip = faster inclusion
- • Usually 1-2 gwei is enough
Optimal Transaction Timing
Best Times to Transact
Cheapest (Green Light)
- • Weekends, especially Sunday
- • 2-6 AM UTC (late night Americas)
- • Major holidays
- • Low volatility, boring market conditions
Most Expensive (Red Light)
- • US market hours (2-9 PM UTC)
- • Major NFT mints
- • Token launches / airdrops
- • High volatility / crash events
Layer 2 Strategies
L2s are the single biggest gas savings available. By executing on Arbitrum, Optimism, or Base, you pay a fraction of mainnet costs while inheriting Ethereum security.
L2 Cost Comparison
When to Use L2 vs Mainnet
- • Trades under $10k
- • Frequent trading
- • Testing strategies
- • Most DeFi activities
- • Very large trades (>$100k)
- • Max security requirements
- • Mainnet-only liquidity
- • Long-term holds
Advanced Optimization
Batch Transactions
Combine multiple operations into one transaction. Some protocols (like 1inch) let you swap + stake + claim in one tx. Saves base tx overhead.
Use Gas-Efficient Protocols
Some DEXs are more gas-efficient than others. Uniswap V3 uses less gas than V2. CoW Swap batches orders for savings. Compare before trading.
Set Gas Alerts
Use tools like Thrive to alert you when gas drops below your target. Execute non-urgent transactions when gas is cheap.
Calculating Profitability
Gas Impact Calculator
Net Profit = (Trade Profit) - (Entry Gas + Exit Gas)Net profit = $20 - $20 = $0 (breakeven)
Net profit = $20 - $0.20 = $19.80
Rule of Thumb
If gas is more than 1% of your trade size, consider using an L2 or waiting for lower gas. For trades under $1,000 on mainnet, gas often eats your profits.
Interactive Gas Tracker
Compare gas costs across networks and calculate transaction costs:
Estimated Costs
Best Times to Transact
Pro Tips: Use L2s for 90%+ gas savings. Batch transactions when possible. Set gas alerts for your target price. For large trades, aggregator gas costs are often offset by better rates.
Related Articles
Frequently Asked Questions
Gas is the unit measuring computational effort for transactions. Each operation (transfer, swap, contract interaction) costs gas. You pay gas price × gas used. Gas prices fluctuate with network demand—high demand = expensive transactions.
EIP-1559 changed gas pricing: Base Fee (algorithmically set, burned) + Priority Fee (tip to validators). Base fee adjusts up when blocks are full, down when empty. This makes gas more predictable and burns ETH, making it deflationary.
Generally: weekends (especially Sunday), very late night / early morning UTC (2-6 AM), and during market lulls. Avoid: US market hours (2-9 PM UTC), major token launches, NFT mints, and high volatility periods.
For most trades under $10k, L2s (Arbitrum, Optimism, Base) save 90-99% on gas. Use mainnet for: large trades where slippage matters more than gas, maximum security, or when needed liquidity is only on mainnet.
Calculate: Trade profit - gas cost = net profit. If gas is 5% of your trade, you need 5%+ profit to break even. For small trades, use L2s. For large trades, mainnet gas is a smaller percentage and acceptable.