All pallets

Timestamp docs

Look up any call, event, or storage item with code examples. Runtime v490 · Block #9,478,217

Developer documentation for the Timestamp 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.

Timestamp

Set the current time.

Index: 2 4 items

Calls 1

set

call details

Sets the current on-chain time; called exactly once per block by validators.

Parameters

NameTypeFormatDescription
nowCompact<u64>Integernow: Unix-style timestamp (ms)
Modifies: Now/ DidUpdate
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 call (typed, named args)
const timestamp = 0n;

const tx = api.tx.Timestamp.set({
  now: timestamp,
});

Storage 2

DidUpdate

storage details

Whether the timestamp has been updated in the current block.

Modifier: Default Keys: 0 Returns: bool (Boolean (true/false))
Modified by: set
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 DidUpdate storage (no keys - plain value)
const result = await api.query.Timestamp.DidUpdate.getValue();
console.log("DidUpdate:", result);

Now

storage details

Current Unix timestamp in milliseconds as set by the block author.

Modifier: Default Keys: 0 Returns: u64 (Integer)
Modified by: set
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 Now storage (no keys - plain value)
const result = await api.query.Timestamp.Now.getValue();
console.log("Now:", result);

Constants 1

MinimumPeriod

constant details

Minimum time between block timestamps in milliseconds.

Type: u64
Value: "6000"
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 MinimumPeriod constant
const value = await api.constants.Timestamp.MinimumPeriod();
console.log("MinimumPeriod:", value);
// Balance: divide by 10^9 for TAO
const tao = value / 1_000_000_000n;