---
updatedAt: 2026-05-20T16:32:55.000Z
---

Fetch the complete documentation index at: https://docs.blockdaemon.com/llms.txt. Use this file to discover all available pages before exploring further. Append .md to any documentation page URL to get its markdown version.

# RPC WebSocket Support (BETA)

> ❗️ Compute Unit (CU) values are subject to change as we assess and adjust our pricing to better reflect usage and associated costs.

Blockdaemon's RPC API supports WebSocket connections for real-time blockchain data on supported chains. This guide covers how to connect, which methods are available, and how Compute Units (CUs) are calculated.

## Supported Chains

| Chain Group         | Chains                                                 |
| ------------------- | ------------------------------------------------------ |
| Ethereum-Compatible | Ethereum, Base, Polygon, Arbitrum, Avalanche, Optimism |
| Solana              | Solana                                                 |
| Polkadot            | Polkadot, Kusama                                       |

## WebSocket Methods & Compute Units

> 📘 Non-subscription RPC methods over web-socket connection are billed the same as regular RPC methods over HTTP.
>
> * [Ethereum](https://docs.blockdaemon.com/reference/ethereum-compute-units)
> * [Polkadot](https://docs.blockdaemon.com/reference/polkadot-compute-units)

<span style={{fontWeight: "bold", display: "inline-flex", alignItems: "center" }}>
  <img src="https://files.readme.io/6d14cffbc53b60a44b3687e79dc2cd2d7bbe150173487d5222dd8b66acca27f6-65fdb12381e6b44a827173fe_Protocol_Icon_1.svg" alt="Ethereum" width="26" style={{ marginRight: "6px" }} />

  <h3>Ethereum-Compatible Chains</h3>
</span>

<HTMLBlock>{`
<table style={{ width: "100%", borderCollapse: "collapse" }}>
<thead>
<tr>
  <th style={{ border: "1px solid #ddd", padding: "8px" }}> Supported Methods</th>
  <th style={{ border: "1px solid #ddd", padding: "8px" }}>Event Types</th>
	<th style={{ border: "1px solid #ddd", padding: "8px" }}>Compute Units</th>
</tr>
</thead>
<tbody>
<tr>
  <td rowSpan=3 style={{ border: "1px solid #ddd", padding: "8px" }}><p><a href="https://geth.ethereum.org/docs/interacting-with-geth/rpc/pubsub#create-subscriptions"><code>eth_subscribe</code></a></p>
</td>
  <td style={{ border: "1px solid #ddd", padding: "8px" }}><code>logs</code>
  </td>
	<td>30 CU per block</td>
  </tr>
  <tr>
    <td>
      <code>newHeads</code>
    </td>
    <td>5 CU per message</td>
  </tr>
  <tr>
    <td>
      <code>newPendingTransactions</code>
    </td>
    <td>20 CU per second</td>
  </tr>
<tr>
  <td style={{ border: "1px solid #ddd", padding: "8px" }}><p><a href="https://geth.ethereum.org/docs/interacting-with-geth/rpc/pubsub#cancel-subscriptions"><code>eth_unsubscribe</code></a></p>
</td>
  <td style={{ border: "1px solid #ddd", padding: "8px" }}></td>
	<td style={{ border: "1px solid #ddd", padding: "8px" }}></td>
</tr>
</tbody>
</table>
`}</HTMLBlock>

<HTMLBlock>{`
  <style>
    .cu-badge {
      padding: 4px 8px;
      border-radius: 6px;
      display: inline-block;
      font-weight: 500;
    }

    /* Light Mode */
    @media (prefers-color-scheme: light) {
      .cu-subscribe     { background-color: #d1c4e9; color: #384248; }
      .cu-confirm       { background-color: #d1c4e9; color: #384248; }
      .cu-event         { background-color: #d1c4e9; color: #384248; }
      .cu-notification  { background-color: #d1c4e9; color: #384248; }
    }

    /* Dark Mode */
    @media (prefers-color-scheme: dark) {
      .cu-subscribe     { background-color: #7e57c2; color: #ffffff; }
      .cu-confirm       { background-color: #7e57c2; color: #ffffff; }
      .cu-event         { background-color: #7e57c2; color: #ffffff; }
      .cu-notification  { background-color: #7e57c2; color: #ffffff; }
    }
  </style>

  <ul style={{ listStyleType: 'none', paddingLeft: 0 }}>
    <li>
      <strong>Subscribe / Unsubscribe request:</strong>
      <span className="cu-badge cu-notification">1 CU per request</span>
    </li>
    <li>
      <strong>Confirmation responses:</strong>
      <span className="cu-badge cu-notification">1 CU</span>
    </li>
    <li>
      <strong>Event messages (e.g., <code>newHeads</code>):</strong>
      <span className="cu-badge cu-notification">CU varies by event type</span>
    </li>
  </ul>
`}</HTMLBlock>

<Callout icon="🚧" theme="warn">
  The minimum charge is **1 CU** per action.
</Callout>

<HTMLBlock>{`
  <style>
    .cu-container {
      border: 2px solid;
      border-radius: 8px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
      padding: 16px;
      margin-top: 16px;
    }

    .cu-table {
      width: 100%;
      border-collapse: collapse;
      font-family: Arial, sans-serif;
      text-align: left;
    }

    .cu-table th,
    .cu-table td {
      padding: 12px;
    }

    /* Light mode */
    @media (prefers-color-scheme: light) {
      .cu-container {
        border-color: #e1e7ec;
      }

      .cu-table thead {
        background-color: #f0f4f8;
      }

      .cu-table tfoot {
        background-color: #f9fafb;
      }
    }

    /* Dark mode */
    @media (prefers-color-scheme: dark) {
      .cu-container {
        border-color: #3a3a3a;
      }

      .cu-table thead {
        background-color: #2a2a2a;
      }

      .cu-table tfoot {
        background-color: #2e2e2e;
      }

      .cu-table th,
      .cu-table td {
        color: #f0f0f0;
      }
    }
  </style>

  <details className="cu-container">
    <summary style={{ fontWeight: 'bold', cursor: 'pointer' }}>
      💡 <strong>Billing Example</strong> – Subscribe to <code>eth_subscribe</code> with <code>newHeads</code>
    </summary>
    <br />
    <table className="cu-table">
      <thead>
        <tr>
          <th>Description</th>
          <th>Count</th>
          <th>CU per Action</th>
          <th>Total CU</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>🔼 Open WebSocket connection</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔼 Send <code>eth_subscribe</code> request</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive confirmation from node</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive <code>newHeads</code> messages</td>
          <td>5</td>
          <td>10 CU</td>
          <td>50</td>
        </tr>
        <tr>
          <td>🔼 Send <code>eth_unsubscribe</code> request</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive unsubscribe confirmation</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <td colSpan="3"><strong>Total Compute Units</strong></td>
          <td>55 CU</td>
        </tr>
      </tfoot>
    </table>
  </details>
`}</HTMLBlock>

***

<span style={{fontWeight: "bold", display: "inline-flex", alignItems: "center" }}>
  <img src="https://files.readme.io/2379585cce92e25ac1c9ff78f8dfaf113c0d6f721610d1cdae56c2fbf8ce8b07-65fe065f0f6a89690a3510f7_Solana_1.svg" alt="Solana" width="26" style={{ marginRight: "6px" }} />

  <h3>Solana</h3>
</span>

| Supported Methods                                                                          | CU per Subscription | Subscribes To              | CU per Message |
| ------------------------------------------------------------------------------------------ | ------------------- | -------------------------- | -------------- |
| [`accountSubscribe`](https://solana.com/docs/rpc/websocket/accountsubscribe)               | 1 CU                | `accountNotification`      | 5 CU           |
| [`accountUnsubscribe`](https://solana.com/docs/rpc/websocket/accountunsubscribe)           | 1 CU                |                            |                |
|                                                                                            |                     |                            |                |
| [`logsSubscribe`](https://solana.com/docs/rpc/websocket/logssubscribe)                     | 1 CU                | `logsNotification`         | 5 CU           |
| [`logsUnsubscribe`](https://solana.com/docs/rpc/websocket/logsunsubscribe)                 | 1 CU                |                            |                |
|                                                                                            |                     |                            |                |
| [`programSubscribe`](https://solana.com/docs/rpc/websocket/programsubscribe)               | 1 CU                | `programNotification`      | 10 CU          |
| [`programUnsubscribe`](https://solana.com/docs/rpc/websocket/programunsubscribe)           | 1 CU                |                            |                |
|                                                                                            |                     |                            |                |
| [`signatureSubscribe`](https://solana.com/docs/rpc/websocket/signaturesubscribe)           | 1 CU                | `signatureNotification`    | 5 CU           |
| [`signatureUnsubscribe`](https://solana.com/docs/rpc/websocket/signatureunsubscribe)       | 1 CU                |                            |                |
|                                                                                            |                     |                            |                |
| [`slotSubscribe`](https://solana.com/docs/rpc/websocket/slotsubscribe)                     | 1 CU                | `slotNotification`         | 5 CU           |
| [`slotUnsubscribe`](https://solana.com/docs/rpc/websocket/slotunsubscribe)                 | 1 CU                |                            |                |
|                                                                                            |                     |                            |                |
| [`slotsUpdatesSubscribe`](https://solana.com/docs/rpc/websocket/slotsupdatessubscribe)     | 1 CU                | `slotsUpdatesNotification` | 5 CU           |
| [`slotsUpdatesUnsubscribe`](https://solana.com/docs/rpc/websocket/slotsupdatesunsubscribe) | 1 CU                |                            |                |

<HTMLBlock>{`
  <style>
    .cu-badge {
      padding: 4px 8px;
      border-radius: 6px;
      display: inline-block;
      font-weight: 500;
    }

    /* Light Mode */
    @media (prefers-color-scheme: light) {
      .cu-subscribe     { background-color: #d1c4e9; color: #384248; }
      .cu-confirm       { background-color: #d1c4e9; color: #384248; }
      .cu-event         { background-color: #d1c4e9; color: #384248; }
      .cu-notification-solana  { background-color: #d1c4e9; color: #384248; }
    }

    /* Dark Mode */
    @media (prefers-color-scheme: dark) {
      .cu-subscribe     { background-color: #7e57c2; color: #ffffff; }
      .cu-confirm       { background-color: #7e57c2; color: #ffffff; }
      .cu-event         { background-color: #7e57c2; color: #ffffff; }
      .cu-notification-solana  { background-color: #7e57c2; color: #ffffff; }
    }
  </style>

  <div style={{ marginTop: '1rem', marginBottom: '1rem' }}>
    <ul style={{ listStyleType: 'none', paddingLeft: 0 }}>
      <li>
        <strong>- Subscribe / Unsubscribe request:</strong>
        <span className="cu-badge cu-notification-solana">1 CU per request</span>
      </li>
      <li>
        <strong>- Confirmation responses:</strong>
        <span className="cu-badge cu-notification-solana">1 CU</span>
      </li>
      <li>
        <strong>- Event messages (e.g., <code>slotNotification</code>):</strong>
        <span className="cu-badge cu-notification-solana">CU varies by event type</span>
      </li>
    </ul>
  </div>
`}</HTMLBlock>

<Callout icon="🚧" theme="warn">
  Each subscription type has a specific event type tied to it. For example, you send `slotSubscribe` → you’ll receive messages of type `slotNotification`.
</Callout>

<HTMLBlock>{`
  <style>
    .cu-details {
      border: 2px solid;
      border-radius: 8px;
      box-shadow: 0 2px 6px rgba(0,0,0,0.2);
      padding: 16px;
      margin-top: 16px;
    }

    .cu-table {
      width: 100%;
      border-collapse: collapse;
      font-family: Arial, sans-serif;
      text-align: left;
    }

    .cu-table th,
    .cu-table td {
      padding: 12px;
    }

    .cu-table tfoot {
      font-weight: bold;
    }

    /* Light mode */
    @media (prefers-color-scheme: light) {
      .cu-details {
        border-color: #e1e7ec;
      }

      .cu-table thead {
        background-color: #f0f4f8;
      }

      .cu-table tfoot {
        background-color: #f9fafb;
      }
    }

    /* Dark mode */
    @media (prefers-color-scheme: dark) {
      .cu-details {
        border-color: #3a3a3a;
      }

      .cu-table thead {
        background-color: #2e2f33;
      }

      .cu-table tfoot {
        background-color: #252627;
      }
    }
  </style>

  <details className="cu-details">
    <summary style={{ fontWeight: 'bold', cursor: 'pointer' }}>
      💡 <strong>Billing Example</strong> – Subscribe to <code>accountSubscribe</code> and receive <code>accountNotification</code>
    </summary>
    <br />
    <table className="cu-table">
      <thead>
        <tr>
          <th>Description</th>
          <th>Count</th>
          <th>CU per Action</th>
          <th>Total CU</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>🔼 Send <code>accountSubscribe</code> request</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive confirmation response</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive <code>accountNotification</code> messages</td>
          <td>8</td>
          <td>5 CU</td>
          <td>40</td>
        </tr>
        <tr>
          <td>🔼 Send <code>accountUnsubscribe</code> request</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive unsubscribe confirmation</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <td colSpan="3"><strong>Total Compute Units</strong></td>
          <td>44 CU</td>
        </tr>
      </tfoot>
    </table>
  </details>
`}</HTMLBlock>

***

<span style={{fontWeight: "bold", display: "inline-flex", alignItems: "center" }}>
  <img src="https://files.readme.io/a1d161db7e1e9961ceb1b5f3f316ffead7893abd6a5c701545df16663ef4a73b-65fe055740d2e564b5a7c95f_Polkadot_1.svg" alt="Polkadot" width="26" style={{ marginRight: "6px" }} />

  <h3>Polkadot</h3>
</span>

| Supported Methods                                                                                                                  | CU per Subscription | Subscribes To            | CU per Message |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------------------------ | -------------- |
| [`beefy_subscribeJustifications`](https://polkadot.js.org/docs/substrate/rpc/#subscribejustifications-beefyversionedfinalityproof) | 1 CU                | `beefy_justifications`   | 1 CU           |
| `beefy_unsubscribeJustifications`                                                                                                  | 1 CU                |                          |                |
|                                                                                                                                    |                     |                          |                |
| [`chain_subscribeFinalizedHeads`](https://polkadot.js.org/docs/substrate/rpc/#subscribefinalizedheads-header)                      | 1 CU                | `chain_finalizedHead`    | 1 CU           |
| `chain_unsubscribeFinalizedHeads`                                                                                                  | 1 CU                |                          |                |
|                                                                                                                                    |                     |                          |                |
| [`chain_subscribeAllHeads`](https://polkadot.js.org/docs/substrate/rpc/#subscribeallheads-header)                                  | 1 CU                | `chain_allHead`          | 1 CU           |
| `chain_unsubscribeAllHeads`                                                                                                        | 1 CU                |                          |                |
|                                                                                                                                    |                     |                          |                |
| [`chain_subscribeNewHeads`](https://polkadot.js.org/docs/substrate/rpc/#subscribenewheads-header)                                  | 1 CU                | `chain_newHead`          | 1 CU           |
| `chain_unsubscribeNewHeads`                                                                                                        | 1 CU                |                          |                |
|                                                                                                                                    |                     |                          |                |
| [`grandpa_subscribeJustifications`](https://polkadot.js.org/docs/substrate/rpc/#subscribejustifications-justificationnotification) | 1 CU                | `grandpa_justifications` | 1 CU           |
| `grandpa_unsubscribeJustifications`                                                                                                | 1 CU                |                          |                |
|                                                                                                                                    |                     |                          |                |
| [`state_subscribeRuntimeVersion`](https://polkadot.js.org/docs/substrate/rpc/#subscriberuntimeversion-runtimeversion)              | 1 CU                | `state_runtimeVersion`   | 1 CU           |
| `state_unsubscribeRuntimeVersion`                                                                                                  | 1 CU                |                          |                |
|                                                                                                                                    |                     |                          |                |
| [`state_subscribeStorage`](https://polkadot.js.org/docs/substrate/rpc/#subscribestoragekeys-vecstoragekey-storagechangeset)        | 1 CU                | `state_storage`          | 5 CU           |
| `state_unsubscribeStorage`                                                                                                         | 1 CU                |                          |                |

<HTMLBlock>{`
  <style>
    .cu-badge {
      padding: 4px 8px;
      border-radius: 6px;
      display: inline-block;
      font-weight: 500;
    }

    /* Light Mode */
    @media (prefers-color-scheme: light) {
      .cu-subscribe     { background-color: #d1c4e9; color: #384248; }
      .cu-confirm       { background-color: #d1c4e9; color: #384248; }
      .cu-event         { background-color: #d1c4e9; color: #384248; }
      .cu-notification-solana  { background-color: #d1c4e9; color: #384248; }
    }

    /* Dark Mode */
    @media (prefers-color-scheme: dark) {
      .cu-subscribe     { background-color: #7e57c2; color: #ffffff; }
      .cu-confirm       { background-color: #7e57c2; color: #ffffff; }
      .cu-event         { background-color: #7e57c2; color: #ffffff; }
      .cu-notification-solana  { background-color: #7e57c2; color: #ffffff; }
    }
  </style>

  <div style={{ marginTop: '1rem', marginBottom: '1rem' }}>
    <ul style={{ listStyleType: 'none', paddingLeft: 0 }}>
      <li>
        <strong>- Subscribe / Unsubscribe request:</strong>
        <span className="cu-badge cu-notification-solana">1 CU per request</span>
      </li>
      <li>
        <strong>- Confirmation responses:</strong>
        <span className="cu-badge cu-notification-solana">1 CU</span>
      </li>
      <li>
        <strong>- Event messages (e.g., <code>chain_newHead</code>):</strong>
        <span className="cu-badge cu-notification-solana">CU varies by event type</span>
      </li>
    </ul>
  </div>
`}</HTMLBlock>

<Callout icon="🚧" theme="warn">
  Each subscription type has a specific event type tied to it. For example, you send `state_subscribeStorage` → you’ll receive messages of type `state_storage`.
</Callout>

<HTMLBlock>{`
  <style>
    .cu-details {
      border: 2px solid;
      border-radius: 8px;
      box-shadow: 0 2px 6px rgba(0,0,0,0.2);
      padding: 16px;
      margin-top: 16px;
    }

    .cu-table {
      width: 100%;
      border-collapse: collapse;
      font-family: Arial, sans-serif;
      text-align: left;
    }

    .cu-table th,
    .cu-table td {
      padding: 12px;
    }

    .cu-table tfoot {
      font-weight: bold;
    }

    /* Light theme */
    @media (prefers-color-scheme: light) {
      .cu-details {
        border-color: #e1e7ec;
      }

      .cu-table thead {
        background-color: #f0f4f8;
      }

      .cu-table tfoot {
        background-color: #f9fafb;
      }
    }

    /* Dark theme */
    @media (prefers-color-scheme: dark) {
      .cu-details {
        border-color: #3a3a3a;
      }

      .cu-table thead {
        background-color: #2e2f33;
      }

      .cu-table tfoot {
        background-color: #252627;
      }
    }
  </style>

  <details className="cu-details">
    <summary style={{ fontWeight: 'bold', cursor: 'pointer' }}>
      💡 <strong>Billing Example</strong> – Subscribe to <code>state_subscribeStorage</code> and receive <code>state_storage</code> notifications
    </summary>
    <br />
    <table className="cu-table">
      <thead>
        <tr>
          <th>Description</th>
          <th>Count</th>
          <th>CU per Action</th>
          <th>Total CU</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>🔼 Send <code>state_subscribeStorage</code> request</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive confirmation response</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive <code>state_storage</code> notifications</td>
          <td>6</td>
          <td>5 CU</td>
          <td>30</td>
        </tr>
        <tr>
          <td>🔼 Send <code>state_unsubscribeStorage</code> request</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
        <tr>
          <td>🔽 Receive unsubscribe confirmation</td>
          <td>1</td>
          <td>1 CU</td>
          <td>1</td>
        </tr>
      </tbody>
      <tfoot>
        <tr>
          <td colSpan="3"><strong>Total Compute Units</strong></td>
          <td>34 CU</td>
        </tr>
      </tfoot>
    </table>
  </details>
`}</HTMLBlock>

<br />

## How to Connect

To connect to the WebSocket endpoint, follow these steps:

1. **Authorize** your request using one of the following methods:

```curl Bearer Token
curl --header "Authorization: Bearer YOUR_API_KEY"
```

```curl API Key
curl --header "X-API-KEY: YOUR_API_KEY"
```

2. You'll need to **install** a WebSocket client like `wscat`, or any other tool you prefer to connect.

```
npm install -g wscat   //One-time installation
```

3. **Connect** to the WebSocket URL with the following URL pattern:

```
wss://svc.blockdaemon.com/:protocol/:network/native
```

For example, for Ethereum Mainnet:

```
wscat --header "Authorization: Bearer YOUR_API_KEY" \
-c wss://svc.blockdaemon.com/ethereum/mainnet/native
```

4. Once connected, you can **send and receive** messages using JSON-RPC:

```json
// Subscribe to a WebSocket event (e.g., newHeads)
{"jsonrpc":"2.0","method":"eth_subscribe","params":["newHeads"],"id":1}

// Server responds with a subscription ID
{"jsonrpc":"2.0","id":1,"result":"0xb544f3328760ac404b9e3a4aec6f2ec0"}

// You’ll receive real-time updates as events happen
{"jsonrpc":"2.0","method":"eth_subscription","params":{
  "subscription":"0xb544f3328760ac404b9e3a4aec6f2ec0",
  "result":{ /* event data */ }
}}

// To unsubscribe from the event stream
{"jsonrpc":"2.0","method":"eth_unsubscribe","params":["0xb544f3328760ac404b9e3a4aec6f2ec0"],"id":2}

// Confirmation that you’ve successfully unsubscribed
{"jsonrpc":"2.0","id":2,"result":true}
```

## 👋 Need Help?

Contact us through [email](mailto:support@blockdaemon.com) or our [support page](https://www.blockdaemon.com/support) for any issues, bugs, or assistance you may need.