All pallets

BaseFee docs

Look up any call, event, or storage item with code examples. Runtime v472 · Block #9,197,056

Developer documentation for the BaseFee pallet of the Subtensor blockchain, part of the Bittensor decentralized AI network. This page is designed for developers integrating with the chain: look up any call, event, or storage item, copy code examples in TypeScript, Python, or Rust, and filter by your role. For in-depth explanations, version history, and relationships between items, see the Reference section.

BaseFee

Index: 25 7 items

Calls 2

set_base_fee_per_gas

call details

Manually sets the EIP-1559 base fee (admin only).

Parameters

NameTypeFormatDescription
feeU256—fee: 256-bit unsigned integer (Ethereum-style)
Modifies: BaseFeePerGas
// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);

// Build set_base_fee_per_gas call (typed, named args)
const fee = undefined as any /* U256 — replace with real value */;

const tx = api.tx.BaseFee.set_base_fee_per_gas({
  fee,
});

set_elasticity

call details

Sets the base fee elasticity parameter (admin only).

Parameters

NameTypeFormatDescription
elasticityPermill—elasticity: Per-million ratio (0..1,000,000)
Modifies: Elasticity
// ----------------------------------------------------------------------
// HEADS UP: 1 arg below has a complex type with no usable default.
// Look for `undefined as any` and replace it with real value
// before running — the snippet compiles, but will fail at runtime as-is.
// ----------------------------------------------------------------------
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);

// Build set_elasticity call (typed, named args)
const elasticity = undefined as any /* Permill — replace with real value */;

const tx = api.tx.BaseFee.set_elasticity({
  elasticity,
});

Events 3

NewBaseFeePerGas

event details

Emitted when the EIP-1559 base fee is updated.

When it fires

  • Block finalization
  • Fee calculation complete

Fields

NameTypeFormatDescription
base_feeU256—New base fee per gas in wei (U256)
Modifies: BaseFeePerGas
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);
  }
});

BaseFeeOverflow

event details

Emitted when base fee calculation would overflow.

When it fires

  • Fee calculation attempted
  • Result exceeds max
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 BaseFeeOverflow events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.BaseFee.BaseFeeOverflow.get(block.hash);
  for (const evt of events) {
    console.log("BaseFeeOverflow:", evt.payload);
  }
});

NewElasticity

event details

Emitted when base fee elasticity parameter is updated.

When it fires

  • Admin call
  • Valid elasticity value

Fields

NameTypeFormatDescription
elasticityPermill—New elasticity value (Permill)
Emitted by: set_elasticity
Modifies: Elasticity
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 NewElasticity events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.BaseFee.NewElasticity.get(block.hash);
  for (const evt of events) {
    console.log("NewElasticity:", evt.payload);
  }
});

Storage 2

BaseFeePerGas

storage details

The current EIP-1559 base fee in wei.

Modifier: Default Keys: 0 Returns: U256
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);

// Query BaseFeePerGas storage (no keys - plain value)
const result = await api.query.BaseFee.BaseFeePerGas.getValue();
console.log("BaseFeePerGas:", result);

Elasticity

storage details

The base fee elasticity multiplier.

Modifier: Default Keys: 0 Returns: Permill
Modified by: set_elasticity
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);

// Query Elasticity storage (no keys - plain value)
const result = await api.query.BaseFee.Elasticity.getValue();
console.log("Elasticity:", result);