# archive_v1_storageDiff - Bittensor RPC Method

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.

## Code Examples

## Request Parameters

- `hash` (`string, required`): Hex-encoded hash of the target block (the newer block).
- `items` (`array, required`): Array of storage query items specifying which keys or prefixes to watch for changes.
- `previousHash` (`string, optional`): Hex-encoded hash of the previous block to diff against. Defaults to the parent block if omitted.

## Request Example

```json
{
  "jsonrpc": "2.0",
  "method": "archive_v1_storageDiff",
  "params": [
    "<hash>",
    "<items>",
    "<previousHash>"
  ],
  "id": 1
}
```

## Response Fields

- `result` (`OBJECT, required`): 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 |

## Successful Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {}
}
```

## 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_stopStorageDiff` to 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`](https://www.dwellir.com/docs/bittensor/archive_v1_storageDiff_stopStorageDiff) -- Stop an active storage diff stream
- [`archive_v1_body`](https://www.dwellir.com/docs/bittensor/archive_v1_body) -- Get the block body for context around changes
- [`archive_v1_header`](https://www.dwellir.com/docs/bittensor/archive_v1_header) -- Get the block header for the diffed blocks
- [`state_queryStorage`](https://www.dwellir.com/docs/bittensor/state_queryStorage) -- Legacy method to query storage changes over a block range
- [`chainHead_v1_storage`](https://www.dwellir.com/docs/bittensor/chainHead_v1_storage) -- Query storage within a follow subscription
