Queried by: developersanalyticsvalidators
The Big Picture
Only keeps last BlockHashCount hashes. For older history, use archive nodes.
Use Cases
- Verify transactions in specific blocks
- Build historical proofs
From Chain Metadata
Map of block numbers to block hashes.
Purpose & Usage
Purpose
Historical block lookup within retention window.
Common Query Patterns
- Query hash by block number
- Verify block inclusion
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | blockNumber block raw: key1 | u32 | Past block number to look up the hash for (u32). The block must already exist on chain. |
Stored Value
32-byte block hash
Code Examples
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 BlockHash storage
const key1 = 0;
const result = await api.query.System.BlockHash.getValue(key1);
console.log("BlockHash:", result);Version History
v101 block 1 Added
v149 block 3,014,339 Internal re-bind
v151 block 3,157,274 Internal re-bind Current
Runtime Info
- Pallet
- System
- Storage Kind
- Map
- First Version
- v101
- Current Version
- v411