Skip to main content

Try it Live

Run FeeMarket examples in the interactive playground

EIP-1559 Base Fee Calculations

Dynamic base fee mechanism adjusting based on block gas utilization.

Overview

EIP-1559 introduced a dynamic base fee that:
  • Targets 50% full blocks (gasLimit / 2)
  • Increases up to 12.5% per block when above target
  • Decreases up to 12.5% per block when below target
  • Enforces minimum of 7 wei

BaseFee

Construct next block’s base fee using EIP-1559 formula. Parameters:
  • parentGasUsed - Gas used in parent block
  • parentGasLimit - Gas limit of parent block
  • parentBaseFee - Base fee of parent block (wei)
Returns: Next block’s base fee (wei) Formula:
Examples:
Edge Cases:

getGasTarget

Get target gas usage for a block (50% of gas limit). Parameters:
  • state - Block state with gasLimit
Returns: Target gas (gasLimit / 2) Example:
State method:

isAboveGasTarget

Check if block gas usage is above target (will increase base fee). Parameters:
  • state - Block state
Returns: true if gasUsed > gasTarget Example:
State method:

Constants

See constants.mdx#eip1559:

Base Fee Dynamics

Increase Rate

Block above target by X% → base fee increases by up to X/2 * 12.5%

Decrease Rate

Block below target by X% → base fee decreases by up to X/2 * 12.5%

Equilibrium

Constant 50% utilization maintains stable base fee:

Projecting Base Fees

See BaseFee projections:

Usage Patterns

Fee Estimation

Gas Target Monitoring

Implementation

Location: /src/primitives/FeeMarket/BrandedFeeMarket/BaseFee.js See branded-feemarket.mdx for implementation details.

References