Pulses
Storage Map v216 → currentVerified randomness pulses from the Drand beacon, keyed by round number.
Explore chainThe Big Picture
This is the randomness everyone consumes. Each pulse is cryptographically verified randomness from Drand's distributed beacon. No one - not miners, validators, or users - can predict or manipulate this value. Use it anywhere you need provably fair, unpredictable outcomes.
Why This Matters
Need randomness? Use Drand pulses. Block hashes can be manipulated, timestamps are predictable. Drand randomness is generated by threshold BLS across many independent parties - truly unpredictable and verifiable.
Example Scenario
Query LastStoredRound() returns 12345678. Query Pulses(12345678) returns {round: 12345678, randomness: 0x...32bytes...}. Use those 32 bytes to seed your fair selection, shuffle UIDs, or determine random outcomes.
Common Questions
- How do I get the latest randomness?
- Query LastStoredRound() for the newest round, then Pulses(that_round) for the data. Don't assume rounds - new pulses are added regularly.
- Is the randomness truly unpredictable?
- Yes - Drand uses threshold BLS signatures. Multiple independent parties must contribute, and no subset can predict the output. It's cryptographically guaranteed unpredictable.
- What if I need randomness for a past event?
- Pulses are stored historically (within OldestStoredRound..LastStoredRound). You can query any round in that range. For audit/replay, this provides deterministic randomness.
Use Cases
- Get verifiable randomness for fair selection mechanisms
- Build lottery or random ordering systems
- Implement unpredictable outcomes for games or auctions
- Seed random number generators with verified entropy
From Chain Metadata
map round number to pulse
Purpose & Usage
Purpose
Store verifiable randomness for on-chain consumption by any pallet or contract.
Common Query Patterns
- Query by round number for specific randomness
- Get latest round via LastStoredRound then query
- Iterate range for historical randomness analysis
Notes
- Each pulse contains round number and randomness bytes
- Randomness is 32 bytes of verifiable unpredictable data
- Old pulses may be pruned based on OldestStoredRound
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | key1 | u64 | key1 (u64) |
Stored Value
value (Pulse)
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 Pulses storage
const key1 = 0;
const result = await api.query
[stringCamelCase("Drand")]
[stringCamelCase("Pulses")](
key1
);
console.log("Pulses:", result.toHuman());On-Chain Activity
1M–10M estimated writes
#18 most written storage item
Modified via user-submitted extrinsics
As of block 7,429,232
Runtime Info
View Source- Pallet
- Drand
- Storage Kind
- Map
- First Version
- v216
- Current Version
- v393