voteSubscribe

Subscribe to receive notification anytime a new vote is observed in gossip. These votes are pre-consensus therefore there is no guarantee these votes will enter the ledger.

Parameters

None

No parameters are required for this method.


Result

Returns an <integer> representing the subscription ID. This ID is required to unsubscribe.


Code Sample

Request Example:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "voteSubscribe"
}

Response Example:

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

Notification Format

The notification is an object with the following fields:

  • hash (string): The vote hash.

  • slots (array): The slots covered by the vote, as an array of u64 integers.

  • timestamp (i64 | null): The timestamp of the vote.

  • signature (string): The signature of the transaction containing this vote.

  • votePubkey (string): The public key of the vote account, as a base-58 encoded string.


Example Notification

{
  "jsonrpc": "2.0",
  "method": "voteNotification",
  "params": {
    "result": {
      "hash": "8Rshv2oMkPu5E4opXTRyuyBeZBqQ4S477VG26wUTFxUM",
      "slots": [1, 2],
      "timestamp": null,
      "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv",
      "votePubkey": "Vote111111111111111111111111111111111111111"
    },
    "subscription": 0
  }
}

Last updated