state_getStorageAt - Bittensor RPC Method
Read a storage value at a specific block hash on Bittensor.
Returns the SCALE-encoded storage value for a given key at a specific block hash. This is equivalent to state_getStorage with an explicit block hash parameter. Use it to read historical on-chain state at any past block on Bittensor, enabling time-travel queries for analytics, auditing, and debugging.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Hex-encoded storage key to read. |
blockHash | string | Yes | Hex-encoded block hash to read the storage at. |
Response
| Field | Type | Description |
|---|---|---|
result | string or null | Hex-encoded SCALE-encoded value, or null if the key does not exist at the given block. |
Code Examples
Use Cases
- Historical balance queries -- Read account balances, staking positions, or subnet parameters as they existed at a specific block.
- Analytics and reporting -- Build time-series data by reading the same storage key across a range of block hashes.
- Debugging -- Verify what on-chain state looked like at the block where an issue occurred.
- Audit trails -- Prove that a specific value existed on-chain at a given point in time.
Notes
- Requires an archive node. Non-archive nodes only keep recent state (typically the last 256 blocks).
- The returned value is SCALE-encoded. Decode it using the type information from the runtime metadata at the same block.
- The example above uses the well-known
:codekey (0x3a636f6465) at a real Bittensor block hash. Replace it with the storage key you actually want to inspect. - To determine the correct storage key for pallet state, use
state_getMetadataand the Substrate storage key hashing scheme.
Related Methods
state_getStorage-- Read storage at the latest block (or optionally at a given hash)state_getStorageHash-- Get the hash of a storage value instead of the full valuestate_getStorageSize-- Get the byte size of a storage valuestate_queryStorage-- Query storage changes across a range of blocksstate_getKeysPaged-- Enumerate storage keys to discover what to query