Skip to content

Solana Websocket methods

Solana WebSocket methods empower developers with real-time blockchain updates, enabling instant notifications for account changes, transactions, and events. By leveraging push-based data streaming, these methods eliminate the need for constant polling, ensuring efficient and seamless interaction with the Solana network. This technology is essential for building dynamic, high-performance DApps that require live updates and scalable integrations. Stay ahead in the blockchain space with Solana's lightning-fast WebSocket API's.

Connect to the WebSocket:

Before calling any method, make sure to establish a WebSocket connection using the following command:

bash
wscat -c "wss://api.nolimitnodes.com/solana?api_key=<your-api-key>"

accountSubscribe ()

accountSubscribe

Description

Subscribe to an account to receive notifications when the lamports or data for a given account public key changes.

Parameters

  • string (required)
    Account Pubkey, as a base-58 encoded string.

  • object (optional)
    Configuration object containing the following fields:

    • commitment (string, optional)
      Specifies the desired state of confirmation.
    • encoding (string, optional)
      Encoding format for account data.
      Values: base58, base64, base64+zstd, jsonParsed.

Result

  • number Subscription ID.

Request

bash
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "accountSubscribe",
  "params": [
    "CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",
    {
      "encoding": "jsonParsed",
      "commitment": "finalized"
    }
  ]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": 23784,
  "id": 1
}

Notification Format

The notification format matches the getAccountInfo RPC HTTP method.

Base58 Encoding

json
{
  "jsonrpc": "2.0",
  "method": "accountNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5199307
      },
      "value": {
        "data": [
          "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR",
          "base58"
        ],
        "executable": false,
        "lamports": 33594,
        "owner": "11111111111111111111111111111111",
        "rentEpoch": 635,
        "space": 80
      }
    },
    "subscription": 23784
  }
}

Parsed-JSON Encoding:

json
{
  "jsonrpc": "2.0",
  "method": "accountNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5199307
      },
      "value": {
        "data": {
          "program": "nonce",
          "parsed": {
            "type": "initialized",
            "info": {
              "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX",
              "blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k",
              "feeCalculator": {
                "lamportsPerSignature": 5000
              }
            }
          }
        },
        "executable": false,
        "lamports": 33594,
        "owner": "11111111111111111111111111111111",
        "rentEpoch": 635,
        "space": 80
      }
    },
    "subscription": 23784
  }
}

accountUnsubscribe ()

accountUnsubscribe

Description

Unsubscribe from account change notifications by canceling the subscription associated with a given subscription ID.

Parameters

  • number (required)
    id of the account Subscription to cancel

Result

  • bool unsubscribe success message

Connect to the WebSocket:

bash
wscat -c "wss://api.nolimitnodes.com/solana?api_key=161fcee8-78a4-461a-bc8a-b28a1e0dc4aa"

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountUnsubscribe",
  "params": [23784]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}

blockSubscribe ()

blockSubscribe

Description

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

Unstable Method:
This subscription is considered unstable and is only available if the validator was started with the --rpc-pubsub-enable-block-subscription flag. The format of this subscription may change in the future.

Parameters

  • filter (required)
    Criteria for filtering the logs to receive results by account type. Currently supported values:

    • string:
      • all – Include all transactions in a block.
    • object:
      • mentionsAccountOrProgram (string): Return only transactions that mention the provided public key (as a base-58 encoded string). If no mentions in a given block, no notification will be sent.
  • configuration (optional)
    A JSON object containing the following fields:

    • commitment (string, optional): Default is finalized. Defines the commitment level for the block. processed is not supported.
    • encoding (string, optional): Default is json. Specifies the encoding format for each returned transaction.
      Supported values: json, jsonParsed, base58, base64.
    • transactionDetails (string, optional): Default is full. Defines the level of transaction detail to return.
      Supported values: full, accounts, signatures, none.
    • maxSupportedTransactionVersion (number, optional): Defines the max transaction version to return in responses.
    • showRewards (boolean, optional): If true, populates the rewards array in the response. Defaults to including rewards.

Result

  • integer
    Subscription ID (needed to unsubscribe).

Request

bash
{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "blockSubscribe",
  "params": ["all"]
}

{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "blockSubscribe",
  "params": [
    {
      "mentionsAccountOrProgram": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op"
    },
    {
      "commitment": "confirmed",
      "encoding": "base64",
      "showRewards": true,
      "transactionDetails": "full"
    }
  ]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": 0,
  "id": 1
}

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.

Example

json
{
  "jsonrpc": "2.0",
  "method": "blockNotification",
  "params": {
    "result": {
      "context": {
        "slot": 112301554
      },
      "value": {
        "slot": 112301554,
        "block": {
          "previousBlockhash": "GJp125YAN4ufCSUvZJVdCyWQJ7RPWMmwxoyUQySydZA",
          "blockhash": "6ojMHjctdqfB55JDpEpqfHnP96fiaHEcvzEQ2NNcxzHP",
          "parentSlot": 112301553,
          "transactions": [
            {
              "transaction": [
                "OpltwoUvWxYi1P2U8vbIdE/aPntjYo5Aa0VQ2JJyeJE2g9Vvxk8dDGgFMruYfDu8/IfUWb0REppTe7IpAuuLRgIBAAkWnj4KHRpEWWW7gvO1c0BHy06wZi2g7/DLqpEtkRsThAXIdBbhXCLvltw50ZnjDx2hzw74NVn49kmpYj2VZHQJoeJoYJqaKcvuxCi/2i4yywedcVNDWkM84Iuw+cEn9/ROCrXY4qBFI9dveEERQ1c4kdU46xjxj9Vi+QXkb2Kx45QFVkG4Y7HHsoS6WNUiw2m4ffnMNnOVdF9tJht7oeuEfDMuUEaO7l9JeUxppCvrGk3CP45saO51gkwVYEgKzhpKjCx3rgsYxNR81fY4hnUQXSbbc2Y55FkwgRBpVvQK7/+clR4Gjhd3L4y+OtPl7QF93Akg1LaU9wRMs5nvfDFlggqI9PqJl+IvVWrNRdBbPS8LIIhcwbRTkSbqlJQWxYg3Bo2CTVbw7rt1ZubuHWWp0mD/UJpLXGm2JprWTePNULzHu67sfqaWF99LwmwjTyYEkqkRt1T0Je5VzHgJs0N5jY4iIU9K3lMqvrKOIn/2zEMZ+ol2gdgjshx+sphIyhw65F3J/Dbzk04LLkK+CULmN571Y+hFlXF2ke0BIuUG6AUF+4214Cu7FXnqo3rkxEHDZAk0lRrAJ8X/Z+iwuwI5cgbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpDLAp8axcEkaQkLDKRoWxqp8XLNZSKial7Rk+ELAVVKWoWLRXRZ+OIggu0OzMExvVLE5VHqy71FNHq4gGitkiKYNFWSLIE4qGfdFLZXy/6hwS+wq9ewjikCpd//C9BcCL7Wl0iQdUslxNVCBZHnCoPYih9JXvGefOb9WWnjGy14sG9j70+RSVx6BlkFELWwFvIlWR/tHn3EhHAuL0inS2pwX7ZQTAU6gDVaoqbR2EiJ47cKoPycBNvHLoKxoY9AZaBjPl6q8SKQJSFyFd9n44opAgI6zMTjYF/8Ok4VpXEESp3QaoUyTI9sOJ6oFP6f4dwnvQelgXS+AEfAsHsKXxGAIUDQENAgMEBQAGBwgIDg8IBJCER3QXl1AVDBADCQoOAAQLERITDAjb7ugh3gOuTy==",
                "base64"
              ],
              "meta": {
                "err": null,
                "status": {
                  "Ok": null
                },
                "fee": 5000,
                "preBalances": [
                  1758510880, 2067120, 1566000, 1461600, 2039280, 2039280,
                  1900080, 1865280, 0, 3680844220, 2039280
                ],
                "postBalances": [
                  1758505880, 2067120, 1566000, 1461600, 2039280, 2039280,
                  1900080, 1865280, 0, 3680844220, 2039280
                ],
                "innerInstructions": [
                  {
                    "index": 0,
                    "instructions": [
                      {
                        "programIdIndex": 13,
                        "accounts": [1, 15, 3, 4, 2, 14],
                        "data": "21TeLgZXNbtHXVBzCaiRmH"
                      },
                      {
                        "programIdIndex": 14,
                        "accounts": [3, 4, 1],
                        "data": "6qfC8ic7Aq99"
                      },
                      {
                        "programIdIndex": 13,
                        "accounts": [1, 15, 3, 5, 2, 14],
                        "data": "21TeLgZXNbsn4QEpaSEr3q"
                      },
                      {
                        "programIdIndex": 14,
                        "accounts": [3, 5, 1],
                        "data": "6LC7BYyxhFRh"
                      }
                    ]
                  },
                  {
                    "index": 1,
                    "instructions": [
                      {
                        "programIdIndex": 14,
                        "accounts": [4, 3, 0],
                        "data": "7aUiLHFjSVdZ"
                      },
                      {
                        "programIdIndex": 19,
                        "accounts": [17, 18, 16, 9, 11, 12, 14],
                        "data": "8kvZyjATKQWYxaKR1qD53V"
                      },
                      {
                        "programIdIndex": 14,
                        "accounts": [9, 11, 18],
                        "data": "6qfC8ic7Aq99"
                      }
                    ]
                  }
                ],
                "logMessages": [
                  "Program QMNeHCGYnLVDn1icRAfQZpjPLBNkfGbSKRB83G5d8KB invoke [1]",
                  "Program QMWoBmAyJLAsA1Lh9ugMTw2gciTihncciphzdNzdZYV invoke [2]"
                ],
                "preTokenBalances": [
                  {
                    "accountIndex": 4,
                    "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u",
                    "uiTokenAmount": {
                      "uiAmount": null,
                      "decimals": 6,
                      "amount": "0",
                      "uiAmountString": "0"
                    },
                    "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op",
                    "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
                  },
                  {
                    "accountIndex": 5,
                    "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u",
                    "uiTokenAmount": {
                      "uiAmount": 11513.0679,
                      "decimals": 6,
                      "amount": "11513067900",
                      "uiAmountString": "11513.0679"
                    },
                    "owner": "rXhAofQCT7NN9TUqigyEAUzV1uLL4boeD8CRkNBSkYk",
                    "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
                  },
                  {
                    "accountIndex": 10,
                    "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1",
                    "uiTokenAmount": {
                      "uiAmount": null,
                      "decimals": 6,
                      "amount": "0",
                      "uiAmountString": "0"
                    },
                    "owner": "CL9wkGFT3SZRRNa9dgaovuRV7jrVVigBUZ6DjcgySsCU",
                    "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
                  },
                  {
                    "accountIndex": 11,
                    "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1",
                    "uiTokenAmount": {
                      "uiAmount": 15138.514093,
                      "decimals": 6,
                      "amount": "15138514093",
                      "uiAmountString": "15138.514093"
                    },
                    "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op",
                    "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
                  }
                ],
                "postTokenBalances": [
                  {
                    "accountIndex": 4,
                    "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u",
                    "uiTokenAmount": {
                      "uiAmount": null,
                      "decimals": 6,
                      "amount": "0",
                      "uiAmountString": "0"
                    },
                    "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op",
                    "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
                  },
                  {
                    "accountIndex": 5,
                    "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u",
                    "uiTokenAmount": {
                      "uiAmount": 11513.103028,
                      "decimals": 6,
                      "amount": "11513103028",
                      "uiAmountString": "11513.103028"
                    },
                    "owner": "rXhAofQCT7NN9TUqigyEAUzV1uLL4boeD8CRkNBSkYk",
                    "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
                  },
                  {
                    "accountIndex": 10,
                    "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1",
                    "uiTokenAmount": {
                      "uiAmount": null,
                      "decimals": 6,
                      "amount": "0",
                      "uiAmountString": "0"
                    },
                    "owner": "CL9wkGFT3SZRRNa9dgaovuRV7jrVVigBUZ6DjcgySsCU",
                    "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
                  },
                  {
                    "accountIndex": 11,
                    "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1",
                    "uiTokenAmount": {
                      "uiAmount": 15489.767829,
                      "decimals": 6,
                      "amount": "15489767829",
                      "uiAmountString": "15489.767829"
                    },
                    "owner": "BeiHVPRE8XeX3Y2xVNrSsTpAScH94nYySBVQ4HqgN9at",
                    "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
                  }
                ],
                "rewards": []
              }
            }
          ],
          "blockTime": 1639926816,
          "blockHeight": 101210751
        },
        "err": null
      }
    },
    "subscription": 14
  }
}

blockUnsubscribe ()

blockUnsubscribe

Description

Unsubscribe from block notifications.

Parameters

  • integer (required)
    Subscription ID to cancel.

Result

  • bool
    Unsubscribe success message.

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "blockUnsubscribe",
  "params": [0]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}

logsSubscribe ()

logsSubscribe

Description

Subscribe to transaction logging.

Parameters

  • filter (required)
    Criteria for filtering the logs to receive results by account type. The following filter types are currently supported:

    • string:

      • all – Subscribe to all transactions except for simple vote transactions.
      • allWithVotes – Subscribe to all transactions, including simple vote transactions.
    • object:

      • mentions (array of strings): A single Pubkey (as a base-58 encoded string). If present, subscribe to only transactions mentioning this address.
        The mentions field currently supports only one Pubkey string per method call. Listing additional addresses will result in an error.
  • configuration (optional)
    A JSON object containing the following fields:

    • commitment (string, optional).

Result

  • integer
    Subscription ID (needed to unsubscribe).

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "logsSubscribe",
  "params": [
    {
      "mentions": [ "11111111111111111111111111111111" ]
    },
    {
      "commitment": "finalized"
    }
  ]
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "logsSubscribe",
  "params": [ "all" ]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": 24040,
  "id": 1
}

Notification Format

The notification will be an RpcResponse JSON object with the following fields:

  • signature: <string> – The transaction signature, base58 encoded.
  • err: <object|null> – Error if the transaction failed, null if the transaction succeeded.
  • logs: <array|null> – Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction could execute (e.g., due to an invalid blockhash or signature verification failure).

Example

json
{
  "jsonrpc": "2.0",
  "method": "logsNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5208469
      },
      "value": {
        "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv",
        "err": null,
        "logs": [
          "SBF program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success"
        ]
      }
    },
    "subscription": 24040
  }
}

logsUnsubscribe ()

logsUnsubscribe

Description

Unsubscribe from transaction logging.

Parameters

  • integer (required)
    Subscription ID to cancel.

Result

  • bool
    Unsubscribe success message.

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "logsUnsubscribe",
  "params": [0]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}

programSubscribe ()

programSubscribe

Description

Subscribe to a program to receive notifications when the lamports or data for an account owned by the given program changes.

Parameters

  • string (required)
    Pubkey of the program_id, as a base-58 encoded string.

  • object (optional)
    Configuration object containing the following fields:

    • commitment (string, optional)
    • filters (array, optional)
      Filter results using various filter objects. The resultant account must meet ALL filter criteria to be included in the returned results.
    • encoding (string, optional)
      Encoding format for Account data.
      Values: base58, base64, base64+zstd, jsonParsed.

Result

  • integer
    Subscription ID (needed to unsubscribe).

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programSubscribe",
  "params": [
    "11111111111111111111111111111111",
    {
      "encoding": "base64",
      "commitment": "finalized"
    }
  ]
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programSubscribe",
  "params": [
    "11111111111111111111111111111111",
    {
      "encoding": "jsonParsed"
    }
  ]
}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programSubscribe",
  "params": [
    "11111111111111111111111111111111",
    {
      "encoding": "base64",
      "filters": [
        {
          "dataSize": 80
        }
      ]
    }
  ]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": 24040,
  "id": 1
}

Notification Format

The notification format is a single program account object as seen in the getProgramAccounts RPC HTTP method.

Base58 encoding

json
{
  "jsonrpc": "2.0",
  "method": "programNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5208469
      },
      "value": {
        "pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq",
        "account": {
          "data": [
            "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR",
            "base58"
          ],
          "executable": false,
          "lamports": 33594,
          "owner": "11111111111111111111111111111111",
          "rentEpoch": 636,
          "space": 80
        }
      }
    },
    "subscription": 24040
  }
}

Parsed-JSON encoding

json
{
  "jsonrpc": "2.0",
  "method": "programNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5208469
      },
      "value": {
        "pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq",
        "account": {
          "data": {
            "program": "nonce",
            "parsed": {
              "type": "initialized",
              "info": {
                "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX",
                "blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k",
                "feeCalculator": {
                  "lamportsPerSignature": 5000
                }
              }
            }
          },
          "executable": false,
          "lamports": 33594,
          "owner": "11111111111111111111111111111111",
          "rentEpoch": 636,
          "space": 80
        }
      }
    },
    "subscription": 24040
  }
}

programUnsubscribe ()

programUnsubscribe

Description

Unsubscribe from program-owned account change notifications.

Parameters

  • number (required)
    ID of the account subscription to cancel.

Result

  • bool
    Unsubscribe success message.

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "programUnsubscribe",
  "params": [0]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}

rootSubscribe ()

rootSubscribe

Description

Subscribe to receive notifications anytime a new root is set by the validator.

Parameters

  • None

Result

  • integer
    Subscription ID (needed to unsubscribe).

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "rootSubscribe"
}

Response

json
{
  "jsonrpc": "2.0",
  "result": 0,
  "id": 1
}

Notification Format

The result is the latest root slot number.

json
{
  "jsonrpc": "2.0",
  "method": "rootNotification",
  "params": {
    "result": 42,
    "subscription": 0
  }
}

rootUnsubscribe ()

rootUnsubscribe

Description

Unsubscribe from root notifications.

Parameters

  • number (required)
    Subscription ID to cancel.

Result

  • bool
    Unsubscribe success message.

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "rootUnsubscribe",
  "params": [0]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}

signatureSubscribe ()

signatureSubscribe

Description

Subscribe to receive a notification when the transaction with the given signature reaches the specified commitment level.
Caution: This is a subscription to a single notification. It is automatically cancelled by the server once the notification, signatureNotification, is sent by the RPC.

Parameters

  • string (required)
    Transaction signature, as base-58 encoded string.
    The transaction signature must be the first signature from the transaction (see transaction ID for more details).

  • object (optional)
    Configuration object containing the following fields:

    • commitment (string, optional)
      The commitment level for the notification. Default: finalized
    • enableReceivedNotification (bool, optional)
      Whether or not to subscribe for notifications when signatures are received by the RPC, in addition to when they are processed.

Result

  • integer
    Subscription ID (needed to unsubscribe).

Request

bash
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "signatureSubscribe",
  "params": [
    "2EBVM6cB8vAAD93Ktr6Vd8p67XPbQzCJX47MpReuiCXJAtcjaxpvWpcg9Ege1Nr5Tk3a2GFrByT7WPBjdsTycY9b",
    {
      "commitment": "finalized",
      "enableReceivedNotification": false
    }
  ]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": 0,
  "id": 1
}

Notification Format

The notification will be an RpcResponse JSON object containing the following fields:

  • slot: <u64> – The corresponding slot.
  • value: <object|string> – A notification value of RpcSignatureResult, resulting in either:
    • When enableReceivedNotification is true and the signature is received: the literal string "receivedSignature".
    • When the signature is processed:
      • err: <object|null>
        null if the transaction succeeded in being processed at the specified commitment level, or a TransactionError if the transaction failed.

Example Responses

Successful Transaction Processed:

json
{
  "jsonrpc": "2.0",
  "method": "signatureNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5207624
      },
      "value": {
        "err": null
      }
    },
    "subscription": 24006
  }
}

Successful Received Transaction:

json
{
  "jsonrpc": "2.0",
  "method": "signatureNotification",
  "params": {
    "result": {
      "context": {
        "slot": 5207624
      },
      "value": "receivedSignature"
    },
    "subscription": 24006
  }
}

signatureUnsubscribe ()

Description
Unsubscribe from signature confirmation notifications.

Parameters

  • number (required)
    Subscription id to cancel.

Result

  • bool – Unsubscribe success message.

Request

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "signatureUnsubscribe",
  "params": [0]
}

Response

json
{
  "jsonrpc": "2.0",
  "result": true,
  "id": 1
}

slotSubscribe ()

Description
Subscribe to receive notifications whenever a slot is processed by the validator.

Parameters

  • None

Result

  • integer – Subscription id (needed to unsubscribe).

Request

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotSubscribe"
}

Response

json
{
  "jsonrpc": "2.0",
  "result": 0,
  "id": 1
}

Notification Format

The notification will be an object with the following fields:

  • parent: <u64> – The parent slot.
  • root: <u64> – The current root slot.
  • slot: <u64> – The newly set slot value.

Example

json
{
  "jsonrpc": "2.0",
  "method": "slotNotification",
  "params": {
    "result": {
      "parent": 75,
      "root": 44,
      "slot": 76
    },
    "subscription": 0
  }
}

slotUnsubscribe ()

Unsubscribe from slot notifications

Parameters

  • integer (required): Subscription id to cancel.

Result

  • bool: Unsubscribe success message.

Request

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotUnsubscribe",
  "params": [0]
}

Response

json
{ "jsonrpc": "2.0", "result": true, "id": 1 }

slotsUpdatesSubscribe ()

Subscribe to receive a notification from the validator on a variety of updates on every slot

Caution
This subscription is unstable. The format of this subscription may change in the future, and may not always be supported.

Parameters

  • None

Result

  • integer: Subscription id (needed to unsubscribe).

Request

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotsUpdatesSubscribe"
}

Response

json
{ "jsonrpc": "2.0", "result": 0, "id": 1 }

Notification Format

The notification will be an object with the following fields:

  • err: <string|undefined> – The error message. Only present if the update is of type "dead".
  • parent: <u64|undefined> – The parent slot. Only present if the update is of type "createdBank".
  • slot: <u64> – The newly updated slot.
  • stats: <object|undefined> – The error message. Only present if the update is of type "frozen". An object with the following fields:
    • maxTransactionsPerEntry: <u64>
    • numFailedTransactions: <u64>
    • numSuccessfulTransactions: <u64>
    • numTransactionEntries: <u64>
    • timestamp: <i64> – The Unix timestamp of the update in milliseconds.
  • type: <string> – The update type, one of:
    • "firstShredReceived"
    • "completed"
    • "createdBank"
    • "frozen"
    • "dead"
    • "optimisticConfirmation"
    • "root"
json
{
  "jsonrpc": "2.0",
  "method": "slotsUpdatesNotification",
  "params": {
    "result": {
      "parent": 75,
      "slot": 76,
      "timestamp": 1625081266243,
      "type": "optimisticConfirmation"
    },
    "subscription": 0
  }
}

slotsUpdatesUnsubscribe RPC Method

Description

Unsubscribe from slot-update notifications.

Parameters

  • number (required): Subscription ID to cancel.

Result

  • bool: Unsubscribe success message.

Request

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "slotsUpdatesUnsubscribe",
  "params": [0]
}

Response

json
{ 
  "jsonrpc": "2.0", 
  "result": true, 
  "id": 1 
}