blockSubscribe — Solana WebSocket Method
blockSubscribe sends a notification every time a new block is confirmed or finalized. You can filter blocks to only receive those that mention a specific account or program.
Subscribe request
Subscribe to all blocks:
{
"jsonrpc": "2.0",
"id": 1,
"method": "blockSubscribe",
"params": ["all"]
}
Subscribe only to blocks mentioning a specific program:
{
"jsonrpc": "2.0",
"id": 1,
"method": "blockSubscribe",
"params": [
{"mentionsAccountOrProgram": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"},
{
"commitment": "confirmed",
"encoding": "json",
"transactionDetails": "signatures",
"maxSupportedTransactionVersion": 0
}
]
}
Notification format
{
"jsonrpc": "2.0",
"method": "blockNotification",
"params": {
"result": {
"context": { "slot": 123456789 },
"value": {
"slot": 123456789,
"block": {
"blockhash": "...",
"previousBlockhash": "...",
"parentSlot": 123456788,
"transactions": ["..."],
"rewards": [],
"blockTime": 1700000000,
"blockHeight": 200000000
}
}
},
"subscription": 42
}
}
Important notes
blockSubscribeis an unstable method and may not be available on all providers. Check with your RPC provider before relying on it.- Subscribing to “all” blocks without filtering generates very high data volume. Use filters or consider gRPC streaming for production workloads with high throughput needs.
- The
transactionDetailsparameter controls how much transaction data each notification includes. Use"signatures"to reduce payload size.
FAQ
Why is blockSubscribe marked unstable? The method is not yet part of the stable RPC specification. Its behavior and availability may change between validator versions. Providers may disable it due to the high resource cost.
What is the difference between blockSubscribe and slotSubscribe?
slotSubscribe only tells you that a slot was processed — it does not include block data. blockSubscribe sends the actual block content (transactions, rewards, etc.).
How much bandwidth does blockSubscribe use?
With "all" filter and full transaction details, expect 10-50 MB/minute depending on network activity. Use transactionDetails: "signatures" to reduce this significantly.
Parameters
| Parameter | Type | Required | Description | Default |
|---|---|---|---|---|
filter | string | object | Yes | Filter type: "all" for all transactions, or {"mentionsAccountOrProgram": "<pubkey>"} to filter by account | — |
config | object | No | Configuration object with commitment, encoding, transactionDetails, showRewards, maxSupportedTransactionVersion | — |
Updated: