Connection
Connect to the Pro API WebSocket endpoint and pass your API key in the query string:Quickstart
This example connects, subscribes to new Ethereum Mainnet blocks, and handles both the subscription response and incoming events.id for each subscription. Reconnect with exponential backoff on close, and resend every subscribe request after reconnecting. The server does not persist subscriptions across connections. See Production guidance below for the full reconnect and delivery model.
Message protocol
Client → server
Server → client (response)
Server → client (event)
type, topic, chain_id) is added by Pro API. data.event and data.payload come directly from the upstream Blockscout instance.
Methods
subscribe
Join a topic on a chain and start receiving events.
Params: topic, chain_id
unsubscribe
Leave a previously subscribed topic.
Params: topic, chain_id
get_subscriptions
List all active subscriptions on this connection. No params required.
Response:
Topics reference
Topics follow Blockscout’s V2 Phoenix Channel naming.blocks:*
blocks:new_block
All new blocks on the chain as they are indexed.
The
block object matches the Blockscout V2 API block response.
blocks:{miner_address}
Blocks produced by a specific miner or validator address.
blocks:indexing
Block indexing progress. Broadcasts periodically until the chain is fully indexed.
blocks:indexing_internal_transactions
Internal transaction indexing progress.
transactions:*
The global topics (
new_transaction, new_pending_transaction) broadcast only a count of new transactions per batch, not full transaction data. For full transaction payloads, subscribe to addresses:{hash} instead.transactions:new_transaction
Fires when new confirmed transactions are indexed.
transactions:new_pending_transaction
Fires when new pending transactions appear in the mempool.
transactions:{tx_hash}
Updates for a specific transaction. Currently fires when the raw internal transaction trace becomes available.
transactions:stats
Transaction-statistics updates.
addresses:*
The richest channel. Receives balance updates, transactions, token transfers, and smart contract verification events for a specific address.
addresses:{address_hash}
tokens:*
tokens:{token_contract_address}
Transfer activity and supply changes for a specific token contract.
token_instances:*
token_instances:{token_contract_address}
NFT metadata fetch results for instances of a token contract.
exchange_rate:*
exchange_rate:new_rate
Native coin fiat exchange rate updates with recent market history.
rewards:*
rewards:{validator_address}
Block reward notifications for a validator. Only available on chains with emission funds enabled.
L2-specific topics
Only available when the upstream Blockscout instance is configured for the corresponding L2 chain type.arbitrum:new_batch
New Arbitrum batches as they are confirmed.
arbitrum:new_messages_to_rollup_amount
optimism:new_batch
New Optimism batches.
optimism:new_deposits
Production guidance
Delivery semantics
Treat delivery as at least once, not exactly once. Live validation observed identical block and transaction events delivered more than once from a single subscription. Recommended deduplication keys:Reconnect and recovery
A production client should:- Reconnect with exponential backoff.
- Restore every subscription after reconnecting. The server does not persist subscriptions across connections.
- Persist the last processed block or timestamp.
- Use REST endpoints to recover activity missed during downtime.
- Treat WebSocket events as real-time notifications, separate from confirmation and finality.
Validation checklist
Before acting on an event, validate:typeisevent.topicmatches an active subscription.chain_idmatches the requested chain.data.eventis expected for that topic.- Required identifiers are present.
- The event has not already been processed (see dedup keys above).
Limits
Billing
Free-tier and admin-managed users are disconnected when credits run out. Paid users may continue into overage.