blockSubscribe

All the specifications for blockSubscribe Websocket Method on Solana

Subscribe to receive notification anytime a new block is confirmed or finalized.

Parameters required for this RPC call

  • filter criteria for the logs to receive results by account type; currently supported:

    • all - include all transactions in block

    • A JSON object with the following field:

      • mentionsAccountOrProgram: <string> - return only transactions that mention the provided public key (as base-58 encoded string). If no mentions in a given block, then no notification will be sent.

  • configuration object: This contains the following parameters, all are optional fields.

    • commitment: The commitment describes how finalized a block is at that point in time. Commitment levels processed, confirmed and finalized are supported, defaults to finalized.

    • encoding: Encoding format for Account data

      • base58 is slow.

      • jsonParsed encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data

      • If jsonParsed is requested but a parser cannot be found, the field falls back to binary encoding, detectable when the data field is type string.

      • Supports: base58 , base64 , base64+zstd , jsonParsed

    • transactionDetails: The level of transaction detail to return

      • If accounts are requested, transaction details only include signatures and an annotated list of accounts in each transaction.

      • Transaction metadata is limited to only: fee, err, pre_balances, post_balances, pre_token_balances, and post_token_balances.

    • maxSupportedTransactionVersion: Currently, the only valid value for this parameter is 0. Setting it to 0 allows you to fetch all transactions, including both Versioned and legacy transactions.

      This parameter determines the maximum transaction version that will be returned in the response. If you request a transaction with a higher version than this value, an error will be returned. If you omit this parameter, only legacy transactions will be returned—any versioned transaction will result in an error.

    • showRewards: Whether to populate the rewards array. If parameter not provided, the default includes rewards. This is a boolean field.

Notification Format:

The notification will be an object with the following fields:

  • slot: <u64> - The corresponding slot.

  • err: <object|null> - Error if something went wrong publishing the notification otherwise null.

  • block: <object|null> - A block object as seen in the getBlock RPC HTTP method.

Last updated

Was this helpful?