BlockHash

Storage Map v101 → current

Maps block numbers to their hashes.

Explore chain
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

#NameTypeDescription
1
key1
→ block_number
u32 Block number

Stored Value

32-byte block hash

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 BlockHash storage
const key1 = 0;

const result = await api.query
  [stringCamelCase("System")]
  [stringCamelCase("BlockHash")](
  key1
);

console.log("BlockHash:", result.toHuman());

Runtime Info

Pallet
System
Storage Kind
Map
First Version
v101
Current Version
v393