Skip to main content
The feemarket module from cosmos/evm implements EIP-1559 dynamic fee pricing for Cosmos SDK chains with EVM compatibility.
This is part of cosmos/evm, not standard Cosmos SDK. For conceptual understanding of EIP-1559, see EIP-1559 Fee Market.

Parameters

The module contains the following parameters (types, proto):

Parameter Details

Parameter Storage Format

sdk.Dec (LegacyDec) values are stored as strings with 18 decimal precision (cosmos-sdk):

Configuration

Adjust parameters to achieve specific network behaviors (params validation):

Configuration Profiles

Scenario Comparisons

Decimal Precision Support

The module supports different token decimal configurations:

Configuration In Production

Parameters can be updated through governance proposals (msg server):
Submit with:

Best Practices

Parameter Selection by Use Case

Block Time Correlation

Faster blocks require higher denominators to maintain stability:
Examples:
  • 1s blocks → denominator ≥16 (prevents wild swings)
  • 6s blocks → denominator = 8 (Ethereum standard)
  • 12s blocks → denominator = 4 (can be more responsive)

Monitoring Key Metrics

Integration Examples

Interfaces

EVM JSON-RPC

The fee market integrates with standard Ethereum JSON-RPC methods (RPC backend):
string
Returns the current base fee as hex string. In EIP-1559 mode, returns the base fee; in legacy mode, returns the median gas price.
string
Returns suggested priority fee (tip) per gas. In cosmos/evm with the experimental mempool, transactions are prioritized by effective gas tip (fees), with ties broken by arrival time.
object
Returns base fee and gas utilization history for a range of blocks.
object
Block responses include baseFeePerGas field when EIP-1559 is enabled.

Transaction Types

The fee market supports both legacy and EIP-1559 transaction types (types):

CLI

gRPC

REST

Technical Implementation

State

The module maintains the following state (genesis proto):

State Objects

Genesis State

Begin Block

At the beginning of each block, the module calculates and sets the new base fee (source):

End Block

At the end of each block, the module updates the gas wanted for base fee calculation (source):

Base Fee Calculation Algorithm

The calculation follows the EIP-1559 specification with Cosmos SDK adaptations (source, utils):

Keeper

The keeper manages fee market state and calculations (source): The module also implements PostTxProcessing hooks for EVM transaction processing (source).

Events

The module emits the following events (types):

Fee Market Block Fees

Example:

AnteHandlers

The module integrates with EVM transactions through the EVMMonoDecorator, which performs all fee-related validations in a single pass (source):

EVMMonoDecorator

The primary ante handler that validates and processes EVM transaction fees (mono_decorator.go):

Fee Validation Functions

CheckMempoolFee
Validates transaction fees against the local mempool minimum (source):
CheckGlobalFee
Enforces the chain-wide minimum gas price set via governance (source):
CheckGasWanted
Tracks cumulative gas wanted for base fee calculation (source):

Module Distinctions

cosmos/evm vs Standard Cosmos SDK

This fee market module from cosmos/evm differs from standard Cosmos SDK fee handling:

Key Integration Points

The module integrates with EVM through:
  • AnteHandlers: Custom decorators for EVM transaction validation (source)
  • Hooks: PostTxProcessing for EVM state updates (source)
  • RPC: Ethereum JSON-RPC methods for fee queries (source)

References

Source Code

Specifications

Tools & Libraries