EIPs Explained

EIP-1559 · Final · Core · 2019-04-13

EIP-1559: Fee market change for ETH 1.0 chain

Replaced Ethereum's gas-price auction with a protocol-set base fee that is burned, plus an optional tip, making fees predictable and letting blocks flex in size.

What problem does it solve?

Before August 2021 (the London upgrade), every transaction named a single gasPrice, and miners simply picked the highest bidders. This first-price auction was bad for users: you had to guess what others would bid, wallets routinely overpaid to be safe, and fees swung wildly from block to block. Blocks also had a hard fixed size, so a sudden burst of demand had nowhere to go but the fee.

EIP-1559 makes the protocol itself compute the price of inclusion and lets block size stretch temporarily, so fees respond smoothly to demand and most users can just accept a wallet's estimate.

How it works

  • Every block carries a base fee per gas, set by the protocol from the previous block. If the parent block was more than 50 % full (above the gas target of 15M gas), the base fee rises by up to 12.5 %; if it was less full, it falls by up to 12.5 %. Blocks may use up to 2× the target (30M gas) during spikes.
  • The base fee is burned, not paid to the block producer. This removes any incentive to stuff blocks to inflate fees and makes ETH deflationary when demand is high.
  • Users add a priority fee (tip) that goes to the block producer, and set a max fee they are willing to pay in total. The effective price is min(baseFee + maxPriorityFee, maxFee); the difference up to maxFee is refunded.
  • This introduced the type-2 transaction (0x02, via EIP-2718) with fields maxFeePerGas and maxPriorityFeePerGas. Legacy gasPrice transactions still work: their gasPrice is treated as both max and priority fee.

Pseudocode for the base fee update, from the spec:

BASE_FEE_MAX_CHANGE_DENOMINATOR = 8   # ±12.5 % per block
ELASTICITY_MULTIPLIER = 2             # gas_limit = 2 × gas_target

gas_target = parent.gas_limit // ELASTICITY_MULTIPLIER
if parent.gas_used == gas_target:
    base_fee = parent.base_fee
elif parent.gas_used > gas_target:
    delta = parent.base_fee * (parent.gas_used - gas_target) // gas_target // BASE_FEE_MAX_CHANGE_DENOMINATOR
    base_fee = parent.base_fee + max(delta, 1)
else:
    delta = parent.base_fee * (gas_target - parent.gas_used) // gas_target // BASE_FEE_MAX_CHANGE_DENOMINATOR
    base_fee = parent.base_fee - delta

Sample code

Sending a type-2 transaction and reading the current base fee (ethers v6):

import { JsonRpcProvider, Wallet, parseUnits, formatUnits } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const wallet = new Wallet(process.env.PRIVATE_KEY!, provider);

const block = await provider.getBlock("latest");
console.log("base fee (gwei):", formatUnits(block!.baseFeePerGas!, "gwei"));

const tx = await wallet.sendTransaction({
  to: "0x000000000000000000000000000000000000dEaD",
  value: parseUnits("0.01", "ether"),
  maxPriorityFeePerGas: parseUnits("1", "gwei"),  // tip to the block producer
  maxFeePerGas: parseUnits("40", "gwei"),         // absolute ceiling incl. base fee
});
const receipt = await tx.wait();
console.log("paid (gwei):", formatUnits(receipt!.gasPrice, "gwei")); // effective gas price

Inside a contract, the current base fee is available as block.basefee (opcode BASEFEE, added by EIP-3198):

uint256 fee = block.basefee; // wei per gas, this block

Things to know

  • A transaction is only valid if maxFeePerGas >= baseFee of the block it lands in. If the base fee rises past your max, the transaction waits in the mempool until it falls again.
  • Wallets usually set maxFeePerGas ≈ 2 × baseFee + tip so a pending transaction survives a few blocks of rising fees; you only pay the actual base fee plus tip.
  • The tip is what matters for ordering during congestion. In quiet periods 1 gwei or less is typical.
  • The same mechanism was reused for blob gas in EIP-4844, which has its own independent base fee.

#gas #fees #transactions #core #london

Details

Authors
Vitalik Buterin (@vbuterin), Eric Conner (@econoar), Rick Dudley (@AFDudley), Matthew Slipper (@mslipper), Ian Norden (@i-norden), Abdelhamid Bakhta (@abdelhamidbakhta)
Status
Final
Type
Standards Track / Core
Created
2019-04-13
Requires
Required by

Machine-readable: Markdown · JSON