Skip to main content

EIP-1559

Introduction

The following documentation explains the logic behind the Osmosis EIP-1559 fee market implementation. This implementation is designed to prevent spam attacks on the network by dynamically adjusting transaction fees based on network congestion.

Base Fee Adjustment

The heart of the EIP-1559 fee market is the adjustment of the base fee. The base fee represents the minimum fee required to include a transaction in a block.

The base fee adjustment is based on the concept of "block space competition." If the network is congested and more users want to send transactions, the base fee increases to allocate block space to the highest bidders. Conversely, if the network is underutilized, the base fee decreases to reduce transaction costs.

The adjustment is calculated using the formula:

baseFeeMultiplier = 1 + (gasUsed - targetGas) / targetGas * maxChangeRate
newBaseFee = baseFee * baseFeeMultiplier
  • gasUsed: The total gas used in a block.
  • targetGas: The target gas wanted per block, defined as 75,000,000.
  • maxChangeRate: The maximum allowable change rate for the base fee, defined as 1/10. The calculated baseFeeMultiplier is then used to update the CurBaseFee.

The base fee is constrained by minimum and maximum values defined as MinBaseFee (0.0025) and MaxBaseFee (5), respectively.

Integration

The current chain base fee can be retrieved from the following end point: ${LCD_ENDPOINT}/osmosis/txfees/v1beta1/cur_eip_base_fee

User txs will get priced at multiplier * B_t, where B_t is base fee at time of submission, and multiplier is an arbitrary constant that can be set in wallets / dapps.

An example fee calculation can be as the following:

low = base_fee * 1.05
average = base_fee * 2
high = base_fee * 3

Note that setting a conservative, high multiplier can ensure getting user transactions even throughout high transaction volumes, whilst it can lead to users paying higher transaction fees than needed.