chainHead_v1_call - Bittensor RPC Method
Execute a runtime API call on a block within a chain head follow subscription on Bittensor using the new JSON-RPC v2 spec.
Executes a runtime API function against the state of a block that is pinned by an active chainHead_v1_follow subscription. This allows you to call any runtime API (such as Metadata_metadata, AccountNonceApi_account_nonce, or custom Bittensor runtime APIs) at a specific block known to the follow subscription.
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. |
function | string | Yes | Runtime API function name (e.g. "Metadata_metadata"). |
callParameters | string | Yes | Hex-encoded SCALE-encoded input parameters. Use "0x" for no arguments. |
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" |
Once started, the follow subscription emits operationCallDone with the SCALE-encoded output.
Code Examples
Use Cases
- Live metadata tracking -- Fetch runtime metadata at each new block to detect runtime upgrades on Bittensor in real time.
- Nonce resolution -- Call
AccountNonceApi_account_nonceat the latest block to get the correct nonce for transaction submission. - Custom runtime queries -- Invoke Bittensor-specific runtime APIs to query subnet information, neuron data, or stake details at a known block.
Notes
- Requires an active
chainHead_v1_followsubscription with the block hash pinned. - The
callParametersmust be SCALE-encoded. Use a codec library to encode them. - This method is experimental and may not be enabled on public shared RPC endpoints.
- Use
chainHead_v1_stopOperationto cancel an in-progress call.
Related Methods
chainHead_v1_follow-- Start the follow subscription (required first)chainHead_v1_storage-- Query storage on a followed blockchainHead_v1_header-- Get header for a followed blockarchive_v1_call-- Runtime call on historical archive blocksstate_call-- Legacy runtime API call method