Docs

chain_unsubscribeAllHeads - Bittensor RPC Method

Cancel a chain_subscribeAllHeads subscription on Bittensor. WebSocket-only.

Cancels a WebSocket subscription that was started with chain_subscribeAllHeads. Provide the numeric subscription ID that was returned when the subscription was created. After calling this method, no further block header notifications will be delivered for that subscription.

Code Examples

This method requires a WebSocket connection and is not available over HTTP.

WebSocket (wscat)

Bash
wscat -c wss://api-bittensor-mainnet.n.dwellir.com/YOUR_API_KEY \
  -x '{
    "jsonrpc": "2.0",
    "method": "chain_unsubscribeAllHeads",
    "params": ["SUBSCRIPTION_ID"],
    "id": 1
  }'

Use Cases

  • Subscription cleanup -- Cancel the all-heads subscription when your application no longer needs to track every imported block header.
  • Resource management -- Prevent server-side resource leaks by unsubscribing before disconnecting from the WebSocket.
  • Subscription rotation -- Stop an existing subscription before starting a new one with different parameters.

Notes

  • Always unsubscribe when you are done to free server-side resources. This is especially important for long-running applications.
  • If the WebSocket connection is dropped, the server automatically cleans up subscriptions, but explicit unsubscription is still best practice.
  • This is a WebSocket-only method; it cannot be called over HTTP.
  • In Dwellir-hosted Bittensor environments, this call path currently returns -32603 Internal error when called directly; close and re-establish the WebSocket session to clear stale subscriptions when needed.