For Solana apps that need data the instant it lands (MEV bots, live analytics, DeFi monitors) periodic REST polling and JSON-RPC WebSockets fall short.
REST polling adds extra latencyThe delay between issuing an RPC call (or any network reques… More and hammers the nodeAny server or computer running the Solana client software, p… More with repeated calls; native WebSockets cover only specific events (accounts, signatures, logs) and can choke under load.
gRPCgRPC es un framework de código abierto de alto rendimiento … More, by contrast, opens a high-throughput binary stream that pushes data from node to client with no polling.
In practice, you receive each transactionA signed data packet that contains instructions to transfer … More as soon as the node has it, with built-in filters and the capacity to handle heavy volumes efficiently.
This guide shows how to leverage gRPC support to stream all finalized transactions on Solana in real time. We target commitment FINALIZED for audit-grade reliability, though you can drop to confirmed or processed if you need even lower latency.
By the end you’ll have a complete transaction feed ready for indexing pipelines, financial monitoring, or compliance tooling.
Subscribing to the full stream of finalized transactions guarantees a complete, irreversible record of on-chain activity: auditors and compliance engines get rock-solid data, analysts gain a spotless history for back-testing without re-org risk, and builders can expose real-time APIs and dashboards that funds are willing to pay for.
In short, you lock in trustworthy coverage, open new revenue streams, and future-proof your data pipeline.
REST polling relies on firing JSON-RPC requests at regular intervals to ask the node for new blocks or signatures.
That “pull” model injects seconds of extra latency, bloats network and CPU usage with repetitive JSON decoding, and risks rate-limit errors or missed transactions if the polling window is too wide. As Solana’s TPS grows, orchestrating hundreds of parallel HTTP calls becomes an operational headache.
With gRPC streaming, you flip to a “push” model: a single HTTP/2 connection sends finalized transactions in real time, encoded as lightweight Protobuf frames. Built-in back-pressure and server-side filters (by accountA data structure on Solana that holds tokens and state; acco… More, program or tx type) let you scale to millions of tx/day without flooding your infra. Bottom line: gRPC yields full coverage, lower complexity, and latency measured in milliseconds—exactly what production-grade pipelines need.
npm install @grpc/grpc-js @grpc/proto-loader protobufjs typescript ts-node
@grpc/grpc-js - pure JS gRPC client
@grpc/proto-loader - loads .proto files
protobufjs - handles Protobuf messages
ts-node - run TS directly; typescript for IDE/tsc
Mainnet endpoint: https://fra.grpc.gsnode.io or https://ny.grpc.gsnode.io . No API key needed at publish time. GS Node ships ready-made .proto files or TS typings drawn from the Yellowstone Geyser plugin.
import { Client, SubscribeRequest, CommitmentLevel } from "@triton-one/yellowstone-grpc";
import * as dotenv from "dotenv";
dotenv.config();
const client = new Client({ grpcUrl: process.env.GRPC_ENDPOINT || "grpc.gsnode.io:443" });
const req: SubscribeRequest = {
slots: {},
accounts: {},
transactions: {
alltxs: {
vote: true, // include validator vote txs
failed: true, // include failed txs
signature: undefined,
accountInclude: [],
accountExclude: [],
accountRequired: []
}
},
transactionsStatus: {},
blocks: {},
blocksMeta: {},
entry: {},
accountsDataSlice: [],
commitment: CommitmentLevel.FINALIZED
};
console.log("🔗 Connecting to the finalized-tx stream...");
(async () => {
const stream = await client.subscribe();
stream.write(req);
stream.on("data", (res) => {
if (res.transaction) {
const sig = res.transaction.transaction.signatures[0].toString("base58");
console.log(`✅ Slot ${res.transaction.slot} | ${sig}`);
// TODO: push to Kafka, decode instructions, etc.
}
});
stream.on("error", (err) => console.error("gRPC error:", err));
})();
npx ts-node index.ts
Expect a steady ~25–30 finalized tx/sec. Extend the handler to store, filter, or analyze as needed.
Problem | Fix |
Stream drops every few minutes | Enable TCP keep-alive (keepalive_time_ms=30000) or use ping: true. |
High CPU on JSON stringify | Work with Protobuf objects directly; serialize only what you need. |
Disk fills in hours | Compress / offload to cheap storage; avoid JSON blobs. |
Missing txs after restart | Checkpoint last slot, reconnect with fromSlot, overlap + dedupe. |
OOM under peak TPS | Scale consumers horizontally; filter server-side if you don’t need everything. |
Yes, binary frames, no base-64, HTTP/2 flow control. With PROCESSED commitment you can see <1 s latency.
Absolutely. Use accountInclude, accountExclude, or subscribe by program ID/signature. Server-side filters cut bandwidth dramatically.
If a node provides gRPC on that network, yes. GS Node focuses on mainnet. For devnet, run your own validatorA node that actively participates in the consensus process b… More with Yellowstone gRPC or use a provider offering devnet endpoints.
Join us and test the most powerful gRPC on Solana.
Engineer. CEO of GS Node. Marketing Manager at Smithii.