Queries

blocks-until-next-epoch

Blocks until the subnet's next epoch fires, or None if tempo is 0.

View as Markdown

Derived from the chain's own next_epoch_start_block at one pinned block. The actual fire can shift by a few blocks (per-block epoch cap defers, owner triggers pull earlier) — to act on the epoch itself, use client.wait_for_epoch().

Category: Epochs & timing

Parameters

ParameterTypeDescription
netuidintegerSubnet to query.

CLI

btcli query blocks-until-next-epoch --netuid <integer> --json

Python

Namespace method (autocomplete, signature help):

import bittensor as bt

sub = bt.Subtensor()
result = sub.epochs.blocks_until_next_epoch(netuid=1)

Or dispatch by name, as an agent would:

result = sub.read("blocks_until_next_epoch", netuid=1)

Async is the same surface awaited: async with bt.Subtensor() as client:.

On-chain implementation

Every file is browsable under /code exactly as built into the runtime.