Try it Live
Run FeeMarket examples in the interactive playground
FeeMarket
Type-safe Ethereum fee market calculations for EIP-1559 and EIP-4844.Overview
FeeMarket provides complete fee calculation and projection for Ethereum’s two fee markets:- EIP-1559: Dynamic base fee adjusting based on block utilization (gas)
- EIP-4844: Exponential blob fee pricing for data availability (blobs)
Quick Start
API Methods
State Management
- State Types - Complete block fee market state and next state calculations
EIP-1559 (Base Fees)
- EIP-1559 Calculations - Calculate base fees, gas targets, and utilization checks
EIP-4844 (Blob Fees)
- EIP-4844 Calculations - Calculate blob base fees and excess blob gas
Transaction Fees
- Transaction Fee Calculations - Calculate EIP-1559 and blob transaction fees
Projections
- Fee Projections - Project future base fees across multiple blocks
Validation
- Validation Utilities - Validate transaction fee parameters and block state
Constants
EIP-1559
EIP-4844
Types
Core Types
- State - Block fee market state
- Eip1559State - EIP-1559 state subset
- Eip4844State - EIP-4844 state subset
Transaction Types
- TxFeeParams - Transaction fee parameters
- BlobTxFeeParams - Blob transaction fee parameters
- TxFee - Transaction fee result
- BlobTxFee - Blob transaction fee result
Learning Resources
- Fundamentals - Fee market mechanics, base fee adjustment, priority fees, blob gas
- usage-patterns.mdx - Common patterns for fee estimation and transaction cost calculation
BrandedFeeMarket
See branded-feemarket.mdx for tree-shakable namespace functions.WASM Support
Pure TypeScript implementation is optimal for FeeMarket. See wasm.mdx for details.Performance
BaseFee: ~4M ops/secBlobBaseFee: ~100K ops/seccalculateTxFee: ~20M ops/secnextState: ~2M ops/secprojectBaseFees: ~1M ops/sec per block
FeeMarket.bench.ts for detailed benchmarks.
References
- EIP-1559: Fee market change for ETH 1.0 chain
- EIP-4844: Shard Blob Transactions
- Fee Estimation Guide - Real-world patterns
Related
- Address - Ethereum addresses
- Transaction - Transaction types
- Uint - 256-bit unsigned integers
- Hex - Hex string utilities

