This storage item was removed in v385
This storage item is no longer available in the current runtime. Existed from v361 to v385. Shown here for historical reference.
KeyHashByBlock
Storage Removed Map v361 → v385 (removed)Maps block numbers to the hash of CurrentKey at that block .
The Big Picture
Each encrypted submission is bound to a specific key epoch via key_hash. This prevents replay attacks where old encrypted submissions could be re-submitted. By checking KeyHashByBlock, validators verify submissions were encrypted for the correct time window.
Why This Matters
If you get KeyHashMismatch errors, this storage helps debug. It tells you what key hash was expected at each block, so you can verify your encryption used the right epoch.
Example Scenario
Your submission failed with KeyHashMismatch. Query KeyHashByBlock(your_submit_block) to see the expected key hash. Compare with the key you encrypted with. If different, you used a stale key.
Common Questions
- Why hash instead of full key?
- Storage efficiency. Full ML-KEM keys are ~1200 bytes; hashes are 32 bytes. The hash is sufficient to detect key mismatch without storing full keys forever.
- How far back is history kept?
- Depends on chain pruning settings. Recent blocks are always available; very old blocks may be pruned.
Use Cases
- Verify submissions used correct epoch key
- Debug KeyExpired or KeyHashMismatch errors
- Audit key rotation history
From Chain Metadata
Hash(CurrentKey) per block, used to bind `key_hash` to the epoch at submit time.
Purpose & Usage
Purpose
Binds encrypted submissions to specific key epochs for validation.
Common Query Patterns
- Query key hash for a specific block
- Verify submission epoch binding
Notes
- Keyed by block number (u32)
- Value is hash of CurrentKey at that block
- Used internally for epoch validation
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | key1 | u32 | key1 (u32) |
Stored Value
value (H256)
Relationships
Modified By
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 KeyHashByBlock storage
const key1 = 0;
const result = await api.query
[stringCamelCase("MevShield")]
[stringCamelCase("KeyHashByBlock")](
key1
);
console.log("KeyHashByBlock:", result.toHuman());Runtime Info
View Source- Pallet
- MevShield
- Storage Kind
- Map
- First Version
- v361
- Removed In
- v385