state_getReadProof - Bittensor RPC Method
Generate a Merkle read proof for storage keys at a given block on Bittensor.
Returns a Merkle proof for one or more storage keys at a given block. The proof consists of trie nodes that, together with the state root from a trusted block header, allow a verifier to confirm the values of the specified keys without trusting the RPC provider. This is essential for light clients, cross-chain bridges, and trust-minimized applications.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
keys | array | Yes | Array of hex-encoded storage keys to generate proofs for. |
blockHash | string | No | Hex-encoded block hash. Defaults to the best block if omitted. |
Response
| Field | Type | Description |
|---|---|---|
at | string | Block hash at which the proof was generated. |
proof | array | Array of hex-encoded trie nodes forming the Merkle proof. |
Code Examples
Use Cases
- Trust-minimized verification -- Verify storage values off-chain using only the state root from a trusted (finalized) block header.
- Cross-chain bridges -- Generate proofs that another chain can verify to confirm Bittensor on-chain state (e.g. account balances, subnet parameters).
- Light clients -- Provide state proofs to light clients that verify on-chain data without storing the full state trie.
- Audit and compliance -- Prove that specific on-chain values existed at a given block without requiring the verifier to run a full node.
Notes
- The proof is generated against the state trie at the specified block. The verifier needs the
stateRootfrom that block's header. - Proof verification can be performed using the
@polkadot/trie-hashorsp-trielibraries. - Requires an archive node for proofs at historical block hashes.
Related Methods
state_getChildReadProof-- Generate proofs for child storage keysstate_getStorage-- Read storage values (without proofs)chain_getHeader-- Get the block header containing the state rootstate_getStorageAt-- Read storage at a specific block