gRPC & Geyser Plugin
High-performance real-time data streaming with Yellowstone gRPC and the Geyser plugin interface.
Why gRPC for Solana?
While the JSON-RPC API is sufficient for most read operations, it has fundamental limitations for applications requiring real-time data at scale. WebSocket subscriptions via RPC can miss events under high load, have limited filtering capabilities, and introduce latency from the JSON serialization/deserialization overhead. For high-frequency trading bots, MEV searchers, and real-time analytics platforms, these limitations are unacceptable.
gRPC (Google Remote Procedure Call) with Protocol Buffers (protobuf) solves these problems. Binary serialization is 3–10x more efficient than JSON, streaming connections maintain persistent state, and the strongly-typed interface prevents entire classes of bugs. Solana's gRPC implementation, known as Yellowstone gRPC, is the standard for production data streaming.
The Geyser Plugin Interface
The Geyser plugin is a Solana validator plugin that allows external processes to receive a stream of data directly from the validator's memory. When a validator processes a transaction, it calls registered Geyser plugins with the transaction data before writing to disk. This means Geyser subscribers receive data at the absolute earliest possible moment — before the transaction is even confirmed.
Yellowstone gRPC is the most widely adopted Geyser plugin implementation. It exposes a gRPC server that clients can subscribe to for real-time streams of:
- Transactions — every transaction processed by the validator
- Account updates — whenever an account's data or lamports change
- Blocks — complete block data as slots are processed
- Slot updates — slot status changes (processed, confirmed, finalized)
- Block metadata — leader schedule, rewards, and block statistics
Setting Up a Yellowstone gRPC Client
# Install the Yellowstone gRPC client library
npm install @triton-one/yellowstone-grpcimport Client from "@triton-one/yellowstone-grpc";
import { CommitmentLevel } from "@triton-one/yellowstone-grpc";
const client = new Client(
"https://your-grpc-endpoint:10000",
"your-api-token",
{}
);
// Subscribe to transactions for a specific program
const stream = await client.subscribe();
const request = {
transactions: {
pumpFun: {
vote: false,
failed: false,
accountInclude: ["6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"], // Pump.fun
accountExclude: [],
accountRequired: [],
},
},
commitment: CommitmentLevel.PROCESSED,
};
stream.write(request);
stream.on("data", (data) => {
if (data.transaction) {
const tx = data.transaction;
console.log("New transaction:", tx.transaction?.signatures[0]);
// Process transaction data here
}
});
stream.on("error", (err) => {
console.error("Stream error:", err);
});Filtering Strategies
Yellowstone gRPC supports powerful server-side filtering to reduce bandwidth and processing overhead. Rather than receiving all transactions and filtering client-side, you can specify exactly what data you need:
Account-Based Filtering
// Monitor all activity involving specific accounts
const request = {
transactions: {
myFilter: {
accountInclude: [
"RaydiumPoolAddress",
"OrcaPoolAddress",
],
// Only include transactions that touch these accounts
},
},
};Account Update Subscriptions
// Subscribe to account data changes
const request = {
accounts: {
tokenAccounts: {
account: ["SpecificAccountAddress"],
owner: ["TokenProgramId"],
filters: [
{
datasize: 165, // SPL Token account size
},
],
},
},
};Performance Characteristics
gRPC streaming delivers data significantly faster than polling-based approaches. In production environments with co-located infrastructure, gRPC streams can deliver transaction data within 1–5ms of the validator processing it. This compares favorably to WebSocket subscriptions (10–50ms) and HTTP polling (50–500ms).
| Method | Typical Latency | Throughput | Reliability | Best For |
|---|---|---|---|---|
| HTTP RPC polling | 50–500ms | Low | High | Occasional queries |
| WebSocket subscriptions | 10–50ms | Medium | Medium | UI updates |
| gRPC streaming | 1–10ms | Very High | High | Trading bots, MEV |
| Shredstream | <1ms | Highest | Medium | Ultra-low latency MEV |
gRPC in Production
Running a reliable gRPC subscription in production requires handling reconnection logic, backpressure, and error recovery. The stream can disconnect due to network issues, validator restarts, or rate limiting. A robust implementation includes exponential backoff reconnection, a buffer for processing lag, and monitoring for stream health.
Use Cases
gRPC streaming is the foundation for the most latency-sensitive Solana applications. Common production use cases include monitoring new liquidity pool creations on Raydium or Orca, detecting large swaps for copy trading, tracking NFT listings and sales in real-time, monitoring liquidation opportunities in lending protocols, and building real-time order book replicas for CEX-DEX arbitrage.