Skip to main content

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:

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

info

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

{
"jsonrpc": "2.0",
"id": 1,
"method": "encodedBlocksSubscribe",
"params": {
"network": "solana-mainnet"
}
}

Example Subscribe Response

tip

Save the subscription ID if you need to explicitly unsubscribe before disconnecting. Disconnecting the WebSocket automatically unsubscribes all active subscriptions.

{
"jsonrpc": "2.0",
"result": 551423789012345,
"id": 1
}

Notification Structure

{
"jsonrpc": "2.0",
"method": "encodedBlockNotification",
"params": {
"subscription": 551423789012345,
"result": {
"slot": 340268123,
"block": {
"previousBlockhash": "7tnEf9LauEcVwu9XGZrnu1PSb7AvhphYPyXj1bScmEAw",
"blockhash": "4vvb3Wa2NG8NiniyPrk4bKnXDGpAaxkdQmoBUDt2yCgY",
"parentSlot": 340268122,
"transactions": [
{
"transaction": ["base64-encoded-data...", "base64"],
"meta": {
"err": null,
"fee": 5000,
"preBalances": [21805750, 6124800],
"postBalances": [21800750, 6124800],
"innerInstructions": [],
"logMessages": ["Program invoke...", "Program success"],
"preTokenBalances": [],
"postTokenBalances": [],
"rewards": [],
"loadedAddresses": { "writable": [], "readonly": [] },
"computeUnitsConsumed": 28215
},
"version": "legacy"
}
],
"rewards": [{
"pubkey": "BkoS26vBuaXnSowACdChi4WKid8UwmuPNhEJWa8KsLHd",
"lamports": 40545537,
"postBalance": 95810488820,
"rewardType": 0,
"commission": null
}],
"blockTime": 1747343131,
"blockHeight": 318487251
}
}
}
}

Response Fields

slot (number)

The slot number for this block

block (object)

A nested object containing the complete block data, equivalent to the response from Solana's getBlock() RPC method. The block object contains:

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 (array with data and encoding type)
  • meta — Transaction metadata including execution results, fees, logs, balance changes, and token balances
  • version — Transaction message version ("legacy" or versioned transaction number)

rewards (array, nullable) — Validator rewards for this block with pubkey, lamports, postBalance, rewardType, and commission

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 automatically offers Per-Message Deflate compression (RFC 7692) on every WebSocket endpoint, typically reducing bandwidth by 70-90%. Most client libraries negotiate this extension automatically, but some require you to enable compression explicitly or install an additional dependency—check your client's docs to confirm it advertises permessage-deflate during the handshake.

For transaction-heavy streams you can further trim payloads by:

  • Setting metadataOnly: true to receive signatures, slots, and metadata without full transaction data.
  • Using excludeVotes: true to drop validator vote transactions.
  • Applying accountKeys filters to limit events to the accounts you care about.
What happens if a validator goes offline when using ChainStream?

ChainStream aggregates data from multiple validators and automatically routes around node failures, so you keep receiving events from healthy validators without interruption—one of the primary benefits over single-node WebSocket connections.

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 feeding ChainStream timestamps an event at the geyser interface, 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 (UTC timestamp) 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