Skip to main content

Try it Live

Run Transaction examples in the interactive playground

EIP-1559 Transactions

Dynamic fee market transactions with base fee and priority fee, introduced in London hard fork.

Overview

EIP-1559 transactions (Type 2) replace fixed gas price with dynamic fee market. Users specify maxFeePerGas and maxPriorityFeePerGas, with actual fee determined by block’s base fee.

Type Definition

Source: types.ts:92-109

Creating EIP-1559 Transactions

Fee Market Mechanics

Base Fee

Block base fee adjusts based on block fullness:
  • Block > 50% full: base fee increases
  • Block < 50% full: base fee decreases
  • Maximum 12.5% change per block

Effective Gas Price

Examples:

getEffectiveGasPrice

Calculate effective gas price given base fee.

Usage

Source: EIP1559/getEffectiveGasPrice.js:13-18

Fee Estimation

Setting maxFeePerGas

Rule of thumb: maxFeePerGas = baseFee * 2 + maxPriorityFeePerGas

Aggressive vs Conservative

Gas Cost Calculation

RLP Encoding

Methods

Benefits

  1. Predictable pricing - Base fee makes fees more predictable
  2. Better UX - Users specify maximum, pay actual
  3. Faster confirmation - Priority fee for faster inclusion
  4. ETH burn - Base fee burned, reduces ETH supply
  5. Less overpaying - Only pay what’s needed

When to Use

Use EIP-1559 for:
  • Ethereum mainnet (London+)
  • Modern L2s with EIP-1559 support
  • Applications needing predictable fees
Prefer Legacy/EIP-2930 for:
  • Networks without EIP-1559
  • Specific gas price requirements

EIP Reference