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 { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Subscribe to NewBaseFeePerGas events
api.query.system.events((events) => {
  events
    .filter(({ event }) =>
      event.section === stringCamelCase("BaseFee") &&
      event.method === "NewBaseFeePerGas"
    )
    .forEach(({ event }) => {
      console.log("NewBaseFeePerGas:", event.data.toHuman());
    });
});

Runtime Info

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