Docs

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

ParameterTypeRequiredDescription
keysarrayYesArray of hex-encoded storage keys to track.
fromBlockstringYesHex-encoded hash of the starting block (inclusive).
toBlockstringNoHex-encoded hash of the ending block (inclusive). Defaults to the best block if omitted.

Response

FieldTypeDescription
resultarrayArray 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_queryStorageAt which 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 externally unless you run it on infrastructure that exposes the method.