archive_v1_storageDiff - Bittensor RPC Method
Stream storage key changes between two blocks via the archive RPC on Bittensor using the new JSON-RPC v2 spec.
Streams the differences in storage between two blocks via the new JSON-RPC v2 archive API. This method reports which storage keys were added, modified, or deleted between a previous block and a target block. It is designed for efficient state synchronization and change tracking without downloading full storage snapshots.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
hash | string | Yes | Hex-encoded hash of the target block (the newer block). |
items | array | Yes | Array of storage query items specifying which keys or prefixes to watch for changes. |
previousHash | string | No | Hex-encoded hash of the previous block to diff against. Defaults to the parent block if omitted. |
Each item in the items array specifies a key or prefix to track:
| Field | Type | Description |
|---|---|---|
key | string | Hex-encoded storage key or prefix. |
returnType | string | Type of payload to return for each matching key: "value" or "hash". |
Response
The direct RPC response is a subscription/operation ID string. Results then arrive as archive_v1_storageDiffEvent notifications over the same WebSocket connection:
| Event | Description |
|---|---|
storageDiff | A batch of changed keys and returned values or hashes |
storageDiffError | An error was encountered while streaming diff results |
storageDiffDone | The diff stream has completed |
Code Examples
Use Cases
- Incremental indexing -- Detect only the storage keys that changed between blocks, dramatically reducing the amount of data an indexer needs to process.
- State sync -- Efficiently synchronize a local state mirror by applying only the diffs instead of re-reading entire storage.
- Change auditing -- Track changes to specific storage maps (e.g. Bittensor subnet parameters, staking ledgers) between two points in time.
Notes
- This method is part of the new JSON-RPC v2 specification and requires a WebSocket connection for streaming results.
- Use
archive_v1_storageDiff_stopStorageDiffto cancel an in-progress diff operation. - On public shared RPC endpoints the archive namespace may be disabled or rate-limited.
Related Methods
archive_v1_storageDiff_stopStorageDiff-- Stop an active storage diff streamarchive_v1_body-- Get the block body for context around changesarchive_v1_header-- Get the block header for the diffed blocksstate_queryStorage-- Legacy method to query storage changes over a block rangechainHead_v1_storage-- Query storage within a follow subscription