state_getStorageHash - Bittensor RPC Method
Get the hash of a storage value for a given key on Bittensor.
Returns the hash (blake2b-256) of the storage value for a given key at the best block (or at a specific block hash if provided). This is a lightweight alternative to state_getStorage when you only need to detect whether a value has changed, without downloading the full value.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Hex-encoded storage key. |
blockHash | string | No | Hex-encoded block hash. Defaults to the best block if omitted. |
Response
| Field | Type | Description |
|---|---|---|
result | string or null | Hex-encoded blake2b-256 hash of the storage value, or null if the key does not exist. |
Code Examples
Use Cases
- Change detection -- Compare storage hashes across blocks to determine whether a value has changed without downloading the full (potentially large) value.
- Caching optimization -- Cache storage values locally and use the hash to determine if the cache is stale, avoiding unnecessary bandwidth for large values like the Wasm runtime blob.
- Integrity verification -- Confirm that a locally stored value matches the on-chain value by comparing hashes.
Notes
- The hash is computed over the raw SCALE-encoded storage value.
- Returns
nullfor non-existent keys, which is distinct from a key that exists with an empty value. - Requires an archive node for historical block hashes.
Related Methods
state_getStorage-- Read the full storage valuestate_getStorageAt-- Read storage at a specific block hashstate_getStorageSize-- Get the byte size of a storage valuestate_queryStorage-- Track storage changes over a block range