Encoded Block Subscriptions
Encoded block subscriptions provide real-time notifications with complete block data, including all transactions with their full instruction sets, program logs, account changes, and token balances. This is a streaming implementation of Solana's native getBlock() RPC method, delivering the same comprehensive block data in real-time as blocks are produced.
For applications that only need block metadata (slot, blockhash, rewards, transaction counts) without full transaction payloads, see block subscriptions for a more bandwidth-efficient option.
Methods:
encodedBlocksSubscribe- Subscribe to encoded block notificationsencodedBlockNotification- Notification message typeencodedBlocksUnsubscribe- Unsubscribe from notifications
Common use cases:
- Building block explorers that display complete transaction details
- Archiving full blockchain history with all transaction data
- Transaction indexing and search services requiring complete block contents
- Data analytics requiring detailed instruction-level analysis
- Historical data replication and backup systems
Subscribe Request
Method: encodedBlocksSubscribe
Parameters:
network (string, required)
The Solana network to subscribe to: solana-mainnet or solana-devnet
Encoded block subscriptions do not support the verified parameter or filtering options. You will receive all blocks produced on the network with complete transaction data.
Example Subscribe Request
- Mainnet
- Devnet
{
"jsonrpc": "2.0",
"id": 1,
"method": "encodedBlocksSubscribe",
"params": {
"network": "solana-mainnet"
}
}
{
"jsonrpc": "2.0",
"id": 1,
"method": "encodedBlocksSubscribe",
"params": {
"network": "solana-devnet"
}
}
Example Subscribe Response
Save the subscription ID—you'll need it to unsubscribe later.
{
"jsonrpc": "2.0",
"result": 551423789012345,
"id": 1
}
Notification Structure
{
"jsonrpc": "2.0",
"method": "encodedBlockNotification",
"params": {
"subscription": 551423789012345,
"result": {
"slot": 340268123,
"slotStatus": "processed",
"encodedBlock": "{ ... complete block JSON ... }"
}
}
}
Response Fields
slot (number)
The slot number for this block
slotStatus (string)
The commitment level of this block: processed, confirmed, or finalized
encodedBlock (string)
A JSON string containing the complete block data, equivalent to the response from Solana's getBlock() RPC method. This includes:
blockhash (string) — The blockhash for this block
previousBlockhash (string) — The blockhash of the previous block
parentSlot (number) — The slot number of the parent block
blockTime (number, nullable) — Unix timestamp when the block was produced
blockHeight (number, nullable) — The block height (number of blocks since genesis)
transactions (array) — Array of transaction objects, each containing:
transaction— Base64-encoded transaction data or parsed transaction structuremeta— Transaction metadata including execution results, fees, logs, and balance changesversion— Transaction message version (legacy or versioned)
rewards (array, nullable) — Validator rewards for this block
numPartitions (number, nullable) — Number of partitions (may be null)
entryCount (number, nullable) — Number of entries (may be null)
The encodedBlock field contains a JSON string that must be parsed to access the complete block data structure. This structure matches Solana's getBlock() response format exactly.
Example Notification
{
"jsonrpc": "2.0",
"method": "encodedBlockNotification",
"params": {
"subscription": 551423789012345,
"result": {
"slot": 340268123,
"slotStatus": "processed",
"encodedBlock": "{\"blockhash\":\"4vvb3Wa2NG8NiniyPrk4bKnXDGpAaxkdQmoBUDt2yCgY\",\"previousBlockhash\":\"7tnEf9LauEcVwu9XGZrnu1PSb7AvhphYPyXj1bScmEAw\",\"parentSlot\":340268122,\"blockTime\":1747343131,\"blockHeight\":318487251,\"transactions\":[{\"transaction\":[\"base64-encoded-data...\"],\"meta\":{\"err\":null,\"fee\":5000,\"preBalances\":[21805750,6124800],\"postBalances\":[21800750,6124800],\"logMessages\":[\"Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [1]\",\"Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 success\"],\"computeUnitsConsumed\":28215},\"version\":0}],\"rewards\":[{\"pubkey\":\"BkoS26vBuaXnSowACdChi4WKid8UwmuPNhEJWa8KsLHd\",\"lamports\":40545537,\"postBalance\":95810488820,\"rewardType\":0,\"commission\":null}]}"
}
}
}
Unsubscribe Request
Method: encodedBlocksUnsubscribe
Parameters:
subscriptionId (number, required)
The subscription ID returned from the subscribe response (passed as array parameter).
Example Unsubscribe Request
{
"jsonrpc": "2.0",
"id": 2,
"method": "encodedBlocksUnsubscribe",
"params": [551423789012345]
}
Example Unsubscribe Response
{
"jsonrpc": "2.0",
"result": true,
"id": 2
}
FAQ and Troubleshooting
How do I reduce ChainStream bandwidth usage?
Syndica offers Per-Message Deflate compression (RFC 7692) on every ChainStream endpoint—most clients negotiate it automatically, though some require enabling compression manually or adding an extra dependency to advertise permessage-deflate. For transaction-heavy streams, you can further trim payloads via metadataOnly: true, excludeVotes: true, and targeted accountKeys filters.
Can I filter ChainStream traffic by multiple account keys?
Yes. accountKeys filters support all (transaction must include all keys), oneOf (transaction must include at least one key), and exclude (transaction must not contain listed keys). Filters run in order: exclude, then all, then oneOf. Combine them to target just the transactions you care about. See the ChainStream API documentation for full examples.
Why is my ChainStream connection failing?
Common causes:
- Scale Mode not enabled (ChainStream requires it—upgrade or review plans/pricing).
- ChainStream not enabled on your dashboard’s ChainStream API page.
- No available streams / Error 7429 (
subscription method exceeded limit) (all subscriptions in use). Close unused streams or enable additional streams—see plans/pricing for details. - API key missing ChainStream permissions.
Check the ChainStream API page for subscription status and limits after resolving the above.
What latency should I expect from ChainStream?
Once a validator emitting into ChainStream timestamps an event, it reaches clients co-located in the same AWS region in ≤10 ms (round-trip latency under 10 ms). Across typical public-internet links you should expect roughly 50–100 ms end-to-end latency, depending on your network path and geography. To measure your actual performance, compare the nodeTime field in each ChainStream message with your local clock and log the delta over time.
How do I use ChainStream with devnet?
Connect to wss://solana-devnet.chainstream.syndica.io/api-key/YOUR_API_KEY and set network: "solana-devnet" in your transactionsSubscribe (or other) params. The rest of the request shape matches mainnet usage, including verified, commitment, and filter objects.
What You Can Do Next
- Block Subscriptions - Monitor block metadata without full transaction data
- Transaction Subscriptions - Stream specific transactions with account filtering
- Slot Subscriptions - Track slot status changes and commitment levels
- Connection Guide - WebSocket setup and error handling patterns