consensus_subscribe - Tempo

WebSocket subscription to consensus events. Emits events when blocks are notarized, finalized, or views are nullified. Available on validator nodes over WebSocket only.

VALIDATOR-NODE-ONLY METHOD. This method is part of the consensus_* namespace and is only available on Tempo validator nodes. It is not available on shared RPC infrastructure such as GetBlock's standard shared endpoints. Calling this method against a non-validator node returns -32601 Method not found. If you need access, contact GetBlock for dedicated validator node access.

Parameters

  • None

Request Example

bash# WebSocket-only method. Use wscat (or similar) to connect first:
wscat -c 'wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/'

# Then send:
{"jsonrpc": "2.0", "method": "consensus_subscribe", "params": [], "id": "getblock.io"}
javascriptimport WebSocket from 'ws';

const ws = new WebSocket('wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

ws.on('open', () => {
    ws.send(JSON.stringify({
    "jsonrpc": "2.0",
    "method": "consensus_subscribe",
    "params": [],
    "id": "getblock.io"
}));
});

ws.on('message', (data) => {
    console.log(JSON.parse(data.toString()));
});
pythonimport asyncio
import json
import websockets

async def main():
    async with websockets.connect('wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/') as ws:
        await ws.send(json.dumps({
    "jsonrpc": "2.0",
    "method": "consensus_subscribe",
    "params": [],
    "id": "getblock.io"
}))
        async for message in ws:
            print(json.loads(message))

asyncio.run(main())
rustuse tokio_tungstenite::connect_async;
use tokio_tungstenite::tungstenite::Message;
use serde_json::json;
use futures_util::{SinkExt, StreamExt};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let (mut ws_stream, _) = connect_async("wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/").await?;

    let payload = json!({
        "jsonrpc": "2.0",
        "method": "consensus_subscribe",
        "params": [],
        "id": "getblock.io"
});
    ws_stream.send(Message::Text(payload.to_string())).await?;

    while let Some(msg) = ws_stream.next().await {
        println!("{:?}", msg?);
    }
    Ok(())
}

Response Example

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "0x9cef478923ff08bf67fde6c64013158d"
}

Response Parameters

FieldTypeDescription
resultstringSubscription ID. Streamed events arrive as separate WebSocket messages with type ∈ notarized | finalized | nullified
(event) typestringOne of notarized, finalized, nullified
(event) epochintegerConsensus epoch
(event) viewintegerConsensus view
(event) digeststringBlock digest (omitted for nullified)
(event) certificatestringBLS certificate (omitted for nullified)
(event) blockobjectFull Tempo block (omitted for nullified)
(event) seenintegerUnix timestamp in milliseconds when the node observed the event

Use Cases

  • Validator-side real-time consensus monitoring
  • Bridge relayers that act immediately on finalization
  • Low-latency notarized-block feeds for advanced UX

Error Handling

Status CodeError MessageCause
403ForbiddenMissing or invalid <ACCESS-TOKEN>
-32602Invalid paramsRequest parameters are missing or malformed
-32601Method not foundMethod does not exist or is not enabled on this node
429Too Many RequestsRate limit exceeded for your plan
-32601Method not foundThis is a validator-only WebSocket method — not exposed on shared infrastructure
-32600Invalid RequestCalled over HTTP instead of WebSocket

SDK Integration

javascriptimport WebSocket from 'ws';

const ws = new WebSocket('wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

ws.on('open', () => {
    ws.send(JSON.stringify({
        jsonrpc: '2.0',
        id: 'getblock.io',
        method: 'consensus_subscribe',
        params: []
    }));
});

ws.on('message', (data) => console.log(JSON.parse(data.toString())));
pythonimport asyncio, json, websockets

async def main():
    async with websockets.connect('wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/') as ws:
        await ws.send(json.dumps({
            'jsonrpc': '2.0', 'id': 'getblock.io',
            'method': 'consensus_subscribe', 'params': []
        }))
        async for msg in ws:
            print(json.loads(msg))

asyncio.run(main())