Queried by: developers
The Big Picture
Allows contracts to access historical block hashes (limited history, typically 256 blocks).
Use Cases
- Access historical block hashes
- Implement BLOCKHASH opcode
Purpose & Usage
Purpose
Historical block hash lookup for EVM opcode BLOCKHASH.
Common Query Patterns
- Query hash by block number
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | key1 | U256 | key1 (U256) |
Stored Value
value (H256)
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 as any /* U256 */;
const result = await api.query
[stringCamelCase("Ethereum")]
[stringCamelCase("BlockHash")](
key1
);
console.log("BlockHash:", result.toHuman());Runtime Info
- Pallet
- Ethereum
- Storage Kind
- Map
- First Version
- v210
- Current Version
- v393