NewBaseFeePerGas

Event v210 → current #0

Emitted when the EIP-1559 base fee is updated.

View events on chain
Useful for: developerswalletsanalytics

The Big Picture

EIP-1559 dynamic fees adjust with congestion. Track this to time transactions for lower costs.

Use Cases

  • Track gas trends
  • Optimize tx timing
  • Build gas oracles

Triggers

Preconditions

  • Block finalization
  • Fee calculation complete

Effects

Storage Modified

Postconditions

  • BaseFeePerGas updated
  • New fee for next block

Event Data

#NameTypeDescription
0
fee
→ base_fee
U256 New base fee per gas in wei (U256)

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Subscribe to NewBaseFeePerGas events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.BaseFee.NewBaseFeePerGas.get(block.hash);
  for (const evt of events) {
    console.log("NewBaseFeePerGas:", evt.payload);
  }
});

Runtime Info

Pallet Index
25
Event Index
0
First Version
v210
Current Version
v411