Skip to main content
Some chains implement dynamic gas pricing through fee market modules. Instead of hardcoding a gas price, CosmJS can query the current base fee from the chain and adjust automatically. This is supported for:
  • Osmosis — EIP-1559 style fee market (/osmosis.txfees.v1beta1.Query/GetEipBaseFee)
  • Skip feemarket — used by Cosmos Hub and other chains (/feemarket.feemarket.v1.Query/GasPrices)

Configuration

Pass a DynamicGasPriceConfig instead of a static GasPrice:

How It Works

When "auto" fee is used with a DynamicGasPriceConfig:
  1. The chain’s fee module is queried for the current base gas price (Osmosis uses /osmosis.txfees.v1beta1.Query/GetEipBaseFee; other chains use Skip’s /feemarket.feemarket.v1.Query/GasPrices)
  2. The multiplier is applied (default 1.3x) to stay above the minimum
  3. The result is clamped between minGasPrice and maxGasPrice
  4. If the query fails, minGasPrice is used as a fallback

DynamicGasPriceConfig Fields

Checking Support

You can verify whether a chain supports dynamic gas pricing before configuring it:

Getting Gas Prices from the Chain Registry

CosmJS does not integrate with the Cosmos Chain Registry directly, but you can use it as a source for gas prices. The registry publishes recommended gas prices for each chain in its chain.json files.

Fetching from the Chain Registry

The chain registry typically provides three gas price tiers per token: Using average_gas_price is a reasonable default. Use high_gas_price for time-sensitive transactions.

Libraries That Wrap the Registry

Several community libraries provide typed access to the chain registry: These are external packages, not part of CosmJS.