Skill — Copyable reference implementation. Use as-is or customize. See Skills Philosophy.
Gas Estimation and EIP-1559 Fees
This guide covers estimating gas for transactions and setting appropriate EIP-1559 fees using Voltaire’s provider and FeeMarket primitives.EIP-1559 Fee Model
EIP-1559 replaced legacy gas price auctions with a predictable fee structure:
The actual fee paid is:
min(maxFeePerGas, baseFee + maxPriorityFeePerGas).
Getting Current Gas Prices
Fetch current network fee data using provider methods:Estimating Gas for a Transaction
Useeth_estimateGas to simulate transaction execution and get the required gas:
Using GasEstimate Primitive
Voltaire provides a brandedGasEstimate type for type-safe gas handling:
Calculating EIP-1559 Fees
Use the FeeMarket primitive to calculate effective fees:Setting Appropriate Fees
Choose fee parameters based on urgency:Predicting Future Base Fees
UseFeeMarket.BaseFee to calculate what the next block’s base fee will be:
- Block 100% full: base fee increases 12.5%
- Block 50% full (target): base fee unchanged
- Block 0% full: base fee decreases 12.5%
Using Fee History
Get historical fee data to understand network conditions:Complete Transaction Cost Estimation
Combine gas estimation with fee calculation:Blob Fees (EIP-4844)
For blob transactions, there’s a separate fee market:eth_blobBaseFee is only available on networks with EIP-4844 (post-Cancun upgrade). It will error on older networks.Contract Gas Estimation
For contract interactions, use the Contract module’s built-in estimation:Related
- Contract Gas Estimation - Contract-specific gas estimation
- Fee Methods - Provider fee RPC methods
- FeeMarket Fundamentals - EIP-1559 mechanics in depth

