# Data Streaming

## Data Access Options

At the moment, RPC Fast does not provide direct UDP shred ingestion to end users. Instead, Solana data is available to our clients via two high-performance gRPC interfaces:

* **Aperture gRPC (Beta)**
* **ShredStream gRPC**

Both services are sourced directly from validator-level UDP shreds, ensuring minimal delay from the network.

### Aperture gRPC (Beta)

Aperture gRPC **reconstructs raw shreds into a structured stream** compatible with the Yellowstone gRPC model, while bypassing traditional RPC node processing.

{% hint style="warning" %}
Aperture gRPC supports only slots, entries and transactions streaming, without replay metadata, such as inner program instructions, balance changes, etc. For blocks, accounts updates and extended transaction metadata please use Yellowstone gRPC.
{% endhint %}

Compared to standard Yellowstone deployments, this approach:

* Reduces end-to-end latency by \~30–40 ms
* Avoids RPC node overhead (banking stage, account indexing, etc.)
* Delivers ordered, near-real-time transactions stream
* Supports server-side transaction filtering (account mentions, signatures, etc.)
* Provides a drop-in developer experience for existing Yellowstone clients

In short, **Aperture combines shred-level speed with Yellowstone-level usability**. [Read more](#aperture-grpc-beta).

### ShredStream gRPC

ShredStream gRPC provides a more direct representation of the underlying data flow by streaming Solana Entries reconstructed from shreds.

Key characteristics:

* Streams raw entry data (closer to validator pipeline)
* No built-in filtering – all parsing and selection must be handled client-side
* Suitable for teams that require maximum control over decoding and processing

<table><thead><tr><th width="183.32373046875">Feature</th><th>Aperture gRPC</th><th>ShredStream gRPC</th><th>Yellowstone gRPC</th></tr></thead><tbody><tr><td>Data source</td><td>UDP shreds</td><td>UDP shreds</td><td>Nodes' Geyser interface</td></tr><tr><td>Output format</td><td>Yellowstone-compatible</td><td>Solana Entry stream</td><td>Yellowstone</td></tr><tr><td>Latency</td><td>~30–40 ms faster than Yellowstone)</td><td>Same as Aperture</td><td>Moderate</td></tr><tr><td>Filtering</td><td>Server-side</td><td>Client-side only</td><td>Server-side</td></tr><tr><td>Use case</td><td>HFT, trading bots</td><td>Custom pipelines, low-level processing</td><td>Any non-latency-critical workloads</td></tr></tbody></table>

***

## Overview

Solana supports real-time blockchain data delivery through native streaming mechanisms. Instead of repeatedly polling RPC endpoints over HTTP, applications can subscribe to live updates and receive notifications as state changes occur. This is essential for responsive, **state-aware applications** such as explorers, dashboards, bots, wallets, and trading systems.

**Streaming enables:**

* Real-time UI updates (wallet balances, dashboards)
* Transaction tracking
* Program activity monitoring
* Trading and automation systems
* Indexing and analytics pipelines

Solana provides two primary streaming approaches:

1. **WebSocket JSON-RPC PubSub** (official RPC interface)
2. **gRPC Streaming via Geyser plugins** (validator-level streaming)

Both methods allow applications to stay synchronized with on-chain state – with different performance and architectural tradeoffs.

| Streaming Method       | Best For                                                                        |
| ---------------------- | ------------------------------------------------------------------------------- |
| **JSON-RPC WebSocket** | Lightweight apps, UI dashboards, wallet balance notifications, basic monitoring |
| **gRPC Streaming**     | High-frequency trading, indexing, analytics, heavy event loads, backend engines |

Streaming complements rather than replaces regular HTTP RPC calls. While HTTP queries are great for on-demand lookups (e.g., historical data), streaming ensures your app is **kept up-to-date in real time** without hammering RPC endpoints.

{% hint style="success" %}
RPC Fast provides both lightweight WebSocket subscriptions and high-performance streaming solutions designed for production-grade Solana infrastructure.
{% endhint %}

***

## Solana RPC WebSocket PubSub&#x20;

Solana’s official RPC interface includes a PubSub system over WebSockets, documented in the [Solana Documentation](https://solana.com/docs).

Instead of calling `getAccountInfo` repeatedly, clients:

1. Open a persistent WebSocket connection
2. Send a subscription request
3. Receive push notifications when matching events occur

> This form of streaming uses standard JSON-RPC over WebSockets (persistent connection, JSON payloads) and is part of Solana’s official RPC interface.

### Architecture

```
Client Application
│
│ WebSocket (JSON-RPC)
▼
RPC Fast Solana Node
│
▼
Solana Validator Network
```

### Supported Subscription Types

The RPC WebSocket interface supports:

<table><thead><tr><th width="266.76177978515625">Subscription</th><th>Description</th></tr></thead><tbody><tr><td><code>accountSubscribe</code></td><td>Notifies when an account’s lamports or data change</td></tr><tr><td><code>programSubscribe</code></td><td>Notifies when accounts owned by a program change</td></tr><tr><td><code>logsSubscribe</code></td><td>Streams program log output</td></tr><tr><td><code>signatureSubscribe</code></td><td>Tracks transaction confirmation status</td></tr><tr><td><code>slotSubscribe</code></td><td>Notifies when a new slot is processed</td></tr><tr><td><code>blockSubscribe</code></td><td>Streams block data (if enabled)</td></tr><tr><td><code>rootSubscribe</code></td><td>Tracks finalized root changes</td></tr></tbody></table>

{% hint style="info" %}
RPC Fast SaaS endpoints do not support `all` and `allWithVotes` filters for WebSocket subscriptions. As a best practice, include more specific filters to reduce latency and bandwidth usage.
{% endhint %}

### Commitment Levels

Each subscription may specify a commitment level:

* `processed` → lowest latency
* `confirmed` → voted by supermajority
* `finalized` → irreversible state

Choosing the right commitment is a latency vs. safety tradeoff.

### Example: Account Subscription

```
import WebSocket from "ws";

const ws = new WebSocket("wss://your-rpc-endpoint");

ws.on("open", () => {
  ws.send(JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "accountSubscribe",
    params: [
      "ACCOUNT_PUBLIC_KEY",
      { commitment: "confirmed" }
    ]
  }));
});

ws.on("message", (data) => {
  console.log("Update:", data.toString());
});
```

### When to Use WebSocket Streaming

Best suited for:

* Wallet balance updates
* Basic trading bots
* UI dashboards
* Lightweight monitoring
* Applications with moderate subscription counts

***

## High-Performance Streaming (gRPC-based)

For **low-latency or high-throughput** streaming use cases (e.g., trading engines, real-time analytics), many providers build on Solana’s **Geyser plugin architecture** to expose streaming via **gRPC** rather than plain WebSockets. This approach is more efficient for binary data and supports advanced filtering and throughput.

### What Is gRPC Streaming?

* Solana validators and nodes can load Geyser plugins that expose on-chain data events at the lowest possible level.
* Clients then connect via **gRPC** (binary protocol on HTTP/2) and receive a stream of structured data (accounts, transactions, blocks, slots).
* This avoids JSON overhead and enables *continuous streaming* with minimal latency.

### Architecture

```
Client Backend
       │
       │  gRPC (HTTP/2, Protobuf)
       ▼
RPC Fast Geyser Stream
       │
       ▼
Validator Runtime (Geyser plugin)
```

### Data Types Typically Streamed

* Account updates (raw + parsed)
* Transactions
* Entry/slot updates
* Blocks
* Vote updates

### Benefits of gRPC Streaming

* **Low latency & high throughput:** Binary streaming pushes data as soon as it’s processed in memory.
* **Structured protocols:** Strong typing and efficient serialization (Protocol Buffers).
* **Advanced filtering:** Clients can subscribe only to the data types or accounts they care about.
* **Better for backend engines:** Helpful when handling many subscriptions or large volumes of data.

This pattern forms the basis for many existing Solana streaming services (e.g., Yellowstone gRPC, Dragon’s Mouth implementations across providers).

### When to Use gRPC Streaming

Recommended for:

* High-frequency trading (HFT)
* Real-time arbitrage engines
* MEV systems
* Large-scale indexing
* Analytics pipelines
* Applications handling thousands of updates per second

***

## WebSocket vs gRPC Comparison

<table><thead><tr><th width="194.23046875">Feature</th><th>WebSocket RPC</th><th>Geyser gRPC</th></tr></thead><tbody><tr><td>Protocol</td><td>JSON over WebSocket</td><td>gRPC (Protobuf over HTTP/2)</td></tr><tr><td>Latency</td><td>Low</td><td>Very Low</td></tr><tr><td>Throughput</td><td>Moderate</td><td>High</td></tr><tr><td>Filtering</td><td>Basic</td><td>Advanced</td></tr><tr><td>Best For</td><td>Frontend apps</td><td>Backend engines</td></tr><tr><td>Setup Complexity</td><td>Simple</td><td>Advanced</td></tr></tbody></table>

***

## Streaming vs HTTP Polling

| HTTP Polling                | Streaming              |
| --------------------------- | ---------------------- |
| Repeated requests           | Persistent connection  |
| Higher latency              | Near real-time         |
| Higher RPC load             | Efficient push updates |
| Good for historical queries | Good for live state    |

Most production systems combine:

* **HTTP RPC** → historical queries
* **WebSocket** → reactive updates
* **gRPC** → high-performance ingestion

***

## Concepts & Patterns

**Commitment Levels:**\
Commitment determines how “final” a piece of data must be before it triggers a notification (`processed` → earliest, `finalized` → safest). This choice affects latency vs. certainty.

**Subscription Lifecycle:**

Connect → request one or more subscriptions → receive events → unsubscribe → close connection.

**Filtering:**\
Many streaming clients support filtering (e.g., specific accounts or programs) to reduce noise and bandwidth. gRPC streams often provide *richer*, more granular filtering options.

***

## Design Considerations

**1. Backpressure Handling**

Applications consuming streams must be able to process events quickly or queue them appropriately.

**2. Reconnection Strategy**

WebSocket and gRPC connections should implement:

* Automatic reconnect
* Subscription replay
* Idempotent state handling

**3. Commitment Strategy**

Lower commitment = faster but less final.\
Higher commitment = safer but slower.

**4. Filtering Strategy**

Over-subscribing can overwhelm systems. Use account and program filters to reduce noise.

***

## Summary

* **Solana supports real-time blockchain streaming natively** via RPC WebSocket PubSub — part of its core RPC API — enabling clients to subscribe to account, transaction, log, slot, and other events.
* **For advanced workloads, Geyser gRPC streaming** is used by many services to deliver low-latency, structured data streams with more throughput and filtering power.
* **Streaming is essential** for building responsive dApps: wallets, analytics dashboards, explorers, trading bots, monitoring tools, and more.

Streaming allows applications to remain synchronized with on-chain state efficiently, reduce polling overhead, and react to events with minimal latency.
