chainHead_v1_storage - Bittensor RPC Method
Query storage keys and values at a block within a chain head follow subscription on Bittensor using the new JSON-RPC v2 spec.
Queries on-chain storage at a block that is pinned by an active chainHead_v1_follow subscription. You can request values, hashes, closest descendant Merkle values, or enumerate descendants for one or more storage keys. Results are streamed via the follow subscription and may be paginated (requiring chainHead_v1_continue calls).
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
followSubscription | string | Yes | The subscription ID from chainHead_v1_follow. |
hash | string | Yes | Hex-encoded block hash. Must be pinned by the follow subscription. |
items | array | Yes | Array of storage query items. |
childTrie | string | No | Hex-encoded child trie key if querying child storage. Omit for main state trie. |
Each item in the items array:
| Field | Type | Description |
|---|---|---|
key | string | Hex-encoded storage key. |
type | string | "value", "hash", "closestDescendantMerkleValue", "descendantsValues", or "descendantsHashes". |
Response
The direct RPC response returns a MethodResponse object:
| Field | Type | Description |
|---|---|---|
result.result | "started" or "limitReached" | "started" includes an operationId; "limitReached" means the node refused to start another operation |
result.operationId | string | Operation ID used to correlate follow-up events when the response is "started" |
result.discardedItems | number | Number of requested items the node discarded before starting, when applicable |
After the method starts, results are streamed as notifications:
| Event | Description |
|---|---|
operationStorageItems | A batch of key-value results. |
operationWaitingForContinue | The node has paused. Call chainHead_v1_continue to receive the next batch. |
operationStorageDone | All items have been delivered. |
Code Examples
Use Cases
- Live state reads -- Query account balances, staking state, or Bittensor subnet parameters at the latest finalized block.
- Bulk key enumeration -- Use
descendantsValuesto retrieve all entries under a storage prefix for a given block. - Merkle proof generation -- Use
closestDescendantMerkleValuefor light-client or bridge verification.
Notes
- Large result sets are paginated with
operationWaitingForContinueevents. CallchainHead_v1_continueto get more. - Use
chainHead_v1_stopOperationto cancel a slow or unnecessary storage query. - This method is experimental and may not be enabled on public shared RPC endpoints.
Related Methods
chainHead_v1_follow-- Start the follow subscription (required first)chainHead_v1_continue-- Resume paginated storage resultschainHead_v1_call-- Runtime call at a followed blockstate_getStorage-- Legacy storage readstate_getKeysPaged-- Legacy paginated key enumeration
chainHead_v1_stopOperation - Bittensor RPC Method
Cancel an in-progress operation within a chain head follow subscription on Bittensor using the new JSON-RPC v2 spec.
chainHead_v1_unfollow - Bittensor RPC Method
Stop following the chain head and clean up a follow subscription on Bittensor using the new JSON-RPC v2 spec.