Overview
BlockDB WebSocket (WSS) streams provide low-latency, push-based access to real-time blockchain events. Unlike REST APIs that require polling, WSS streams deliver data as soon as it is processed by our ingestion engine—typically under 150 ms from the block being seen on the P2P network.BlockDB’s WebSocket delivery is currently in the development and testing phase. If you encounter issues or have specific throughput requirements, please contact us at [email protected].
Endpoints
We provide a unified streaming endpoint for all EVM datasets.| Environment | Protocol | Endpoint |
|---|---|---|
| Production | WSS | wss://stream.blockdb.io/v1/evm/ |
Authentication
Authentication is performed during the WebSocket handshake using a Bearer token in theAuthorization header.
api_key query parameter:
wss://stream.blockdb.io/v1/evm/?api_key=YOUR_API_KEY
Subscription Lifecycle
Once connected, you must send a JSON message to subscribe to specific datasets. The server will acknowledge your request with a status message.1. Subscribe
To start receiving data, send asubscribe action with the target chain_id, dataset_id, and any optional filters in params.
2. Unsubscribe
To stop receiving data from a stream without closing the connection:Message Format
Every data message delivered by the stream follows a consistent envelope:The identifier of the EVM network.
The identifier of the dataset (e.g.,
0101 for Blocks).The payload containing the actual record. See specific stream pages for schema details.
Connection Management
- Heartbeats: The server sends periodic
pingframes. Clients must respond withpongframes to keep the connection alive. Most WebSocket libraries handle this automatically. - Idle Timeout: Connections with no active subscriptions or heartbeat responses for more than 60 seconds may be terminated.
- Reconnection: In the event of a disconnect, clients should implement exponential backoff.
Reliability & Reorgs
- Ordering: Messages within a single stream are delivered in the order they are processed.
- Reorganizations: BlockDB is reorg-aware. When a chain reorganization occurs, the stream will emit messages with the
_is_reorg: trueflag to indicate that a block is being re-submitted or updated in the canonical record. - Lineage: Every message includes a
_tracing_id, which can be used to correlate real-time events with historical archive data.