LastStoredRound

Storage Plain v216 → current

The most recent Drand round number stored on-chain.

Explore chain
Queried by: validatorsdevelopersanalytics

The Big Picture

Applications consuming randomness need to know what's available. This tells you the newest round - query Pulses(LastStoredRound) to get the freshest randomness. Also useful for monitoring: if this isn't incrementing, pulse submission has stalled.

Why This Matters

Always check LastStoredRound before using randomness. Don't assume a round exists - verify it's <= LastStoredRound. This is also your health metric: stale LastStoredRound means randomness infrastructure may be failing.

Example Scenario

Query LastStoredRound() returns 12345678. This is the newest round. Query Pulses(12345678) for the latest randomness. If LastStoredRound hasn't changed in hours, investigate - pulses should come every ~30 seconds.

Common Questions

Why might this stop incrementing?
Offchain worker failure, Drand beacon issues, or network problems. Check offchain worker logs and Drand beacon status (https://api.drand.sh/health).
Can rounds be skipped?
Yes - if a pulse isn't submitted, its round may be missing. The chain doesn't require sequential rounds, just valid signatures for whatever rounds are submitted.

Use Cases

  • Find the latest available randomness
  • Monitor Drand pulse submission health
  • Verify offchain workers are functioning
  • Build liveness dashboards for randomness infrastructure

Purpose & Usage

Purpose

Track the newest available randomness - queries should use this to find latest data.

Common Query Patterns

  • Query for the newest available round number
  • Combined with Pulses query to get latest randomness
  • Monitor to verify pulses are being submitted regularly
Part of: Distributed Randomness

Stored Value

Value in RAO (÷10⁹ for TAO)

RAO -> TAO (/ 10^9)

Relationships

Modified By

Related Events

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query LastStoredRound storage (no keys - plain value)
const result = await api.query
  [stringCamelCase("Drand")]
  [stringCamelCase("LastStoredRound")]();
console.log("LastStoredRound:", result.toHuman());

Runtime Info

View Source
Pallet
Drand
Storage Kind
Plain
First Version
v216
Current Version
v393