blockSubscribe - Solana

blockSubscribe. Allows developers to subscribe to updates for changes in the block of the blockchain

blockSubscribe - solana [Value: 10CU]
Allows to subscribe to updates for changes in the block of the blockchain
Use cases

Use cases

  • Subscribe to real-time block updates
  • Monitor all block data as it's processed
  • Receive notifications for each new block
Constraints

Constraints

  • Requires stable WebSocket connection for data flow
  • High data flow could impact performance
  • Unsubscription needed to stop receiving block updates
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
wscat -c wss://solana.drpc.org \
# wait for connection
{"id":1,"jsonrpc":"2.0","method":"blockSubscribe","params":["all"]}
Copy
Response
200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "subscription_id"
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersobject
object
filterstring
Defines the criteria for filtering logs based on account type. This determines which transactions in a block will trigger notifications.
object
stringstring
If set to 'all', the subscription will include all transactions in a block.
objectobject
A JSON object used to filter transactions based on whether they reference a specific public key.
object
mentionsAccountOrProgramstring
Retrieves only transactions that reference the specified public key (encoded as a base-58 string). If a block contains no such references, no notifications will be generated.
commitmentstring
Specifies the level of finality required for the block data returned by the subscription. Options include 'finalized', 'confirmed', and 'processed'.
  • finalized - The subscription will return blocks confirmed by the supermajority of the cluster and recognized as finalized.
  • confirmed - The subscription will return blocks that have been voted on by the supermajority of the cluster but may not yet be finalized.
  • processed - The subscription will return the most recent block processed by the node, which may not be finalized or confirmed.
transactionDetailsstring
Specifies the level of detail to include for transactions within the block. Options include 'full' (complete transaction data), 'signatures' (only transaction signatures), or 'none' (no transaction details).
showRewardsboolean
Indicates whether to include the 'rewards' array in the block data, detailing any rewards distributed as part of the block.
encodingstring
Specifies the encoding format for the block data returned by the subscription. Options include 'base58', 'base64', 'base64+zstd', and 'jsonParsed'.
  • base58 - Returns data in base58 encoding, typically used for smaller datasets.
  • base64 - Returns data in base64 encoding, suitable for larger datasets.
  • base64+zstd - Returns data in base64 encoding with Zstandard compression for efficiency.
  • jsonParsed - Returns data in a parsed JSON format, useful for human-readable output.

Response

200
The result object returned by the subscription

Response params

object
idinteger
jsonrpcstring
resultobject
object
blockobject
The block data including all transactions, signatures, and metadata associated with the block.
slotinteger
The corresponding slot
errobject
Error if something went wrong publishing the notification otherwise null