blockSubscribe

WSSSubscriptionsNexus only

Streams full block contents as each block reaches the requested commitment (unstable upstream).

WSSwss://ws-newyork.constant-k.com:1337/ws?api-key=YOUR_API_KEY

blockSubscribe pushes block data as it is produced, either for every block ("all") or only blocks containing a transaction that mentions a given account or program ({"mentionsAccountOrProgram": "<pubkey>"}). Each notification's value.block is shaped like the block object getBlock would return for that slot, with the level of transaction detail controlled by transactionDetails. The config object must set maxSupportedTransactionVersion, currently 1; see Transaction v1.

Upstream Agave marks blockSubscribe unstable and ships it disabled by default, gated behind --rpc-pubsub-enable-block-subscription plus --enable-rpc-transaction-history; constant-k runs both flags, so the subscription works normally here even though many public RPC providers don't expose it. Because it ships whole blocks, it is the heaviest of the subscription methods; logsSubscribe or a filtered programSubscribe cover cases needing only confirmation that something happened, not full transaction payloads.

PlansNexus only
FreeNot included
OperatorNot included
Blade RunnerNot included
NexusIncluded

Parameters

params is a JSON array, with values in this order: filter, config.

1filterstring | objectrequired

Which blocks to receive.

Show one ofOne of
Option 1string

Every block.

Allowed values:all
Option 2object

Only blocks containing a transaction that references this address.

Show propertiesProperties
mentionsAccountOrProgramstringrequired

Base58 account or program id.

2configobjectrequired

Subscription settings. Required here, because maxSupportedTransactionVersion must be set. Every other field in it is optional.

Show propertiesProperties
commitmentstringdefault: "finalized"

processed is not accepted for blockSubscribe; only confirmed and finalized blocks can be streamed.

Allowed values:confirmedfinalized
encodingstringdefault: "base64"

Format for each transaction's message bytes inside the block payload (irrelevant when transactionDetails is signatures or none, since no transaction bodies are returned).

Allowed values:jsonjsonParsedbase58base64base64+zstd
transactionDetailsstringdefault: "full"

How much per-transaction detail to include: full transactions, an accounts-only summary, bare signatures, or nothing beyond the block's own metadata.

Allowed values:fullaccountssignaturesnone
showRewardsbooleandefault: false

Whether to populate the block's rewards array.

maxSupportedTransactionVersionintegerrequired

Highest transaction version the caller can decode. Required on constant-k: blockSubscribe is refused with -32602 at subscribe time if it is missing. It is a ceiling, not a filter — 1 streams a block's legacy, version 0 and version 1 transactions alike, sent as the JSON integer 1 rather than the string "1". See Transaction v1.

Minimum: 0Maximum: 1
Example:1

Result

resultinteger

The subscription id, returned once in the initial RPC response. Passed to blockUnsubscribe, it cancels the stream.

Notifications

Updates arrive as blockNotification messages on the same socket. result.context.slot and result.value.slot both name the block's slot; result.value.err is null on success or an error object if the node failed to fully replay the block (in which case block is null); result.value.block is the block payload itself, shaped by transactionDetails/encoding/showRewards.

params.resultobject

Notification payload.

Show propertiesProperties
contextobject

Response context, including the slot the data was read at.

Show propertiesProperties
slotinteger

Slot number this applies to.

valueobject

The requested data; see the fields below.

Show propertiesProperties
slotinteger

Slot number this applies to.

errobject | null

Null on success, or an error object/string describing the failure.

blockobject | null

The block payload, or null when err is set.

Show propertiesProperties
blockhashstring

Base58 hash identifying this block.

previousBlockhashstring

Base58 hash of this block's parent.

parentSlotinteger

Slot of this block's parent.

blockTimeinteger | null

Estimated production time as a Unix timestamp, or null if unavailable.

blockHeightinteger | null

Number of blocks beneath this one, or null if unavailable.

signaturesstring[]

Present only when transactionDetails is signatures.

transactionsarray

Present only when transactionDetails is full or accounts. Each entry matches a getBlock transaction, including meta.costUnits and, on version 1 transactions, transaction.message.transactionConfig.

rewardsarray

Present only when showRewards is true.

Unsubscribe

blockUnsubscribe, called with the subscription id, stops the notifications and returns true once the subscription is removed.

blockUnsubscribe request
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "blockUnsubscribe",
  "params": [78915]
}

Notes

  • blockSubscribe is on the Nexus plan only. The other subscriptions start at Operator.
  • WebSocket access is included on the Operator plan and above; it is not available on Free.
  • Concurrent connections are capped per API key: 10 on Operator, 50 on Blade Runner, 100 on Nexus.
  • Subscribe and unsubscribe calls draw from the same global per-plan request-rate limit as HTTP calls: 50 req/s on Operator, 200 req/s on Blade Runner, 500 req/s on Nexus.
  • Only subscription methods (the *Subscribe / *Unsubscribe family) are accepted on the WebSocket endpoint; standard request/response RPC methods must go over HTTPS instead.
  • A getHealth request sent over the open socket on a regular interval serves as a keepalive; connections that go quiet can be dropped by intermediate load balancers.
  • Each region has its own WebSocket hostname, for example wss://ws-newyork.constant-k.com:1337/ws?api-key=YOUR_API_KEY; every region is listed on the Endpoints page.
  • Hand-built rather than captured live, since mainnet-beta's public endpoint does not accept blockSubscribe.
  • blockSubscribe is on Agave's own unstable list; the notification's field names have changed before and may again without a deprecation cycle.
  • maxSupportedTransactionVersion is checked at subscribe time, not when a block arrives; a missing value, or the string "1" instead of the integer 1, fails the subscribe call with -32602 before any block is streamed.