Docs

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

ParameterTypeRequiredDescription
keystringYesHex-encoded storage key.
blockHashstringNoHex-encoded block hash. Defaults to the best block if omitted.

Response

FieldTypeDescription
resultstring or nullHex-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 null for non-existent keys, which is distinct from a key that exists with an empty value.
  • Requires an archive node for historical block hashes.