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.
Calls 1
Sets the current on-chain time; called exactly once per block by validators.
Parameters
| Name | Type | Format | Description |
|---|---|---|---|
now | Compact<u64> | Integer | now: Unix-style timestamp (ms) |
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
Whether the timestamp has been updated in the current block.
bool (Boolean (true/false))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);Current Unix timestamp in milliseconds as set by the block author.
u64 (Integer)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
Minimum time between block timestamps in milliseconds.
u64"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;