Docs

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

ParameterTypeRequiredDescription
followSubscriptionstringYesThe subscription ID from chainHead_v1_follow.
hashstringYesHex-encoded block hash. Must be pinned by the follow subscription.
itemsarrayYesArray of storage query items.
childTriestringNoHex-encoded child trie key if querying child storage. Omit for main state trie.

Each item in the items array:

FieldTypeDescription
keystringHex-encoded storage key.
typestring"value", "hash", "closestDescendantMerkleValue", "descendantsValues", or "descendantsHashes".

Response

The direct RPC response returns a MethodResponse object:

FieldTypeDescription
result.result"started" or "limitReached""started" includes an operationId; "limitReached" means the node refused to start another operation
result.operationIdstringOperation ID used to correlate follow-up events when the response is "started"
result.discardedItemsnumberNumber of requested items the node discarded before starting, when applicable

After the method starts, results are streamed as notifications:

EventDescription
operationStorageItemsA batch of key-value results.
operationWaitingForContinueThe node has paused. Call chainHead_v1_continue to receive the next batch.
operationStorageDoneAll 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 descendantsValues to retrieve all entries under a storage prefix for a given block.
  • Merkle proof generation -- Use closestDescendantMerkleValue for light-client or bridge verification.

Notes

  • Large result sets are paginated with operationWaitingForContinue events. Call chainHead_v1_continue to get more.
  • Use chainHead_v1_stopOperation to cancel a slow or unnecessary storage query.
  • This method is experimental and may not be enabled on public shared RPC endpoints.