state_queryStorage - Bittensor RPC Method
Query storage changes for specific keys over a range of blocks on Bittensor.
Returns the storage changes for the specified keys over a range of blocks. For each block in the range where at least one of the queried keys changed, the method returns the block hash and the new values. This is useful for tracking how specific storage entries evolved over time without having to query each block individually.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
keys | array | Yes | Array of hex-encoded storage keys to track. |
fromBlock | string | Yes | Hex-encoded hash of the starting block (inclusive). |
toBlock | string | No | Hex-encoded hash of the ending block (inclusive). Defaults to the best block if omitted. |
Response
| Field | Type | Description |
|---|---|---|
result | array | Array of change sets. Each entry has block (block hash) and changes (array of [key, value] pairs). |
Code Examples
Use Cases
- Balance history -- Track how an account balance changed over a range of blocks.
- Parameter tracking -- Monitor changes to Bittensor subnet parameters, staking rates, or other governance-controlled values over time.
- Event-driven indexing -- Detect which blocks contained changes to specific storage entries, then process only those blocks.
- Debugging -- Identify exactly when a storage value changed during incident investigation.
Notes
- This method can be expensive for large block ranges. The node must replay each block in the range to detect changes. Consider using narrow ranges.
- For single-block queries, prefer
state_queryStorageAtwhich is optimized for that case. - Only blocks where at least one queried key changed are included in the result.
- Requires an archive node for historical block ranges.
- On Dwellir shared public Bittensor endpoints this range query is currently treated as unsafe. Expect
RPC call is unsafe to be called externallyunless you run it on infrastructure that exposes the method.
Related Methods
state_queryStorageAt-- Query storage at a single block (more efficient for point-in-time queries)state_subscribeStorage-- Subscribe to live storage changes via WebSocketstate_getStorageAt-- Read a single storage value at a specific blockarchive_v1_storageDiff-- v2 API for streaming storage changes between blocks