BlocksSinceLastStep

Storage Map v101 → v411

Blocks since last emission step.

Explore chain
Queried by: validatorsminersdevelopersanalytics

The Big Picture

A convenience counter showing how far into the current epoch we are. When this equals Tempo, the next emission step triggers. It's the 'time remaining' display for emission cycles.

Why This Matters

How close are we to the next epoch? BlocksSinceLastStep / Tempo = progress through epoch. At 80% through, weights set now will matter for the upcoming distribution.

Example Scenario

Query BlocksSinceLastStep(netuid=1) returns 75. Tempo is 100. You're 75% through the epoch. 25 more blocks until next emission step.

Common Questions

Why does this matter for validators?
Weight updates close to epoch end count toward that epoch. Updates right after a step have more time to affect miner behavior before evaluation.
Is this exactly Tempo - BlocksSinceLastStep to next step?
Yes, next step at (Tempo - BlocksSinceLastStep) blocks. Though exact timing depends on block production, which can vary slightly.

Use Cases

  • Show countdown to next emission cycle
  • Calculate progress through current epoch
  • Build emission timing dashboards
  • Plan weight updates relative to epoch
  • Monitor subnet activity cycles

From Chain Metadata

MAP ( netuid ) --> blocks_since_last_step

Purpose & Usage

Purpose

Track time since last distribution - countdown to next epoch.

Common Query Patterns

  • Query by netuid
  • Build epoch countdown displays
  • Monitor emission timing
Part of: Epoch Processing

Query Keys

#NameTypeDescription
1
netuid
u16 netuid (u16, hashed key component)

Stored Value

blocks_since_last_step (u64)

RAO -> TAO (/ 10^9)

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);

// Query BlocksSinceLastStep storage
const netuid = 1;

const result = await api.query.SubtensorModule.BlocksSinceLastStep.getValue(netuid);
console.log("BlocksSinceLastStep:", result);

On-Chain Activity

Write Source Runtime Hook

Modified by runtime hooks (e.g., epoch transitions), not directly by user extrinsics

As of block 7,429,232

Version History

v101 block 1 Added
v123 block 720,235 Internal re-bind
v149 block 3,014,339 Internal re-bind
v166–v194 · runtime versions skipped on chain (never deployed)
v195 block 3,791,350 Internal re-bind
v278–v289 · runtime versions skipped on chain (never deployed)
v290 block 5,947,548 Internal re-bind Current

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Map
First Version
v101
Current Version
v411