---
title: voteSubscribe
description: Subscribe to gossip vote notifications.
url: /docs/rpc/websocket/votesubscribe
type: reference
hideTableOfContents: true
---

Subscribe to notifications when a new vote is observed in gossip. These votes
are pre-consensus, so there is no guarantee they will enter the ledger.

<Callout type="info" title="Source">
  [`vote_subscribe`](https://github.com/anza-xyz/agave/blob/v3.1.8/rpc/src/rpc_pubsub.rs#L582)
</Callout>

<Callout type="warn" title="Unstable Method">
  Agave documents this as an [unstable RPC PubSub `voteSubscribe`
  subscription](https://github.com/anza-xyz/agave/blob/v3.1.8/validator/src/commands/run/args/pub_sub_config.rs#L87-L90).
  It is only available if the validator was started with
  `--rpc-pubsub-enable-vote-subscription`.
</Callout>

<APIMethod>

```jsonc !!request curl
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "voteSubscribe"
}
```

```rs !!request title="Rust"
use anyhow::Result;
use futures::StreamExt;
use solana_client::nonblocking::pubsub_client::PubsubClient;

#[tokio::main]
async fn main() -> Result<()> {
    let pubsub_client = PubsubClient::new("wss://api.devnet.solana.com/").await?;

    let (mut notifications, unsubscribe) = pubsub_client.vote_subscribe().await?;

    while let Some(notification) = notifications.next().await {
        println!("{:?}", notification);
    }

    unsubscribe().await;

    Ok(())
}
```

### !params

**None**

### !!result

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover result
  "result": 0,
  "id": 1
}
```

!type integer

Subscription id. Pass this to
[voteUnsubscribe](/docs/rpc/websocket/voteunsubscribe).

</APIMethod>

### Notification format

Notifications are delivered as `voteNotification`.

<CodeReference>

```jsonc !!
{
  // !hover jsonrpc
  "jsonrpc": "2.0",
  // !hover method
  "method": "voteNotification",
  // !hover(1:14) params
  "params": {
    // !hover(1:11) params.result
    "result": {
      // !hover params.result.votePubkey
      "votePubkey": "Dsw9gS3HhFZKtdRETYxZEDfxnhvybP65seF9BJTFnLTZ",
      // !hover params.result.slots
      "slots": [
        326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339,
        340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353,
        354, 355, 356
      ],
      // !hover params.result.hash
      "hash": "AdU6NQBUhCpLGzsbV9Kn2vBG8pmedvnnSkxuctFQC9Du",
      // !hover params.result.timestamp
      "timestamp": 1774643712,
      // !hover params.result.signature
      "signature": "5Scozdcb2WM3tsEJtQYYYtKR2DbE7nNKsNVo2qQJm1XQ5K97pJnbgkGSiGh5YKWxMzQzDBUmw7A57gwsnqLceR2Q"
    },
    // !hover params.subscription
    "subscription": 1
  }
}
```

## !reference

### !! jsonrpc

!type string

Always `"2.0"`.

### !! method

!type string

Always `"voteNotification"`.

### !! params

!type object

Notification wrapper with the vote payload and the subscription id.

#### !! result

!type object

Vote payload observed in gossip. This notification is serialized directly and
does not include `context` and `value`.

##### !! votePubkey

!type string

Vote account that produced the vote, as a base-58 encoded string.

##### !! slots

!type array[u64]

Slots covered by the vote.

##### !! hash

!type string

Vote hash for the observed vote transaction.

##### !! timestamp

!type i64 | null

Vote timestamp, if one was present in the vote.

##### !! signature

!type string

Transaction signature that carried the vote.

#### !! subscription

!type integer

Subscription id that produced this notification.

</CodeReference>
