Clone the free repo solana-grpc-subscribe-slots, install dependencies, point the endpoint to https://grpc.gsnode.io, and you’ll have every new Solana slot hitting your terminal in < 50 ms.
A slot is the heartbeat of Solana. Every 400 ms (≈ 2,500 slots/hour) a validator may produce a block. If you can see the next slot before everybody else, you can:
Use case | How slot streaming helps |
---|---|
DEX bots & MEV searchers | Predict when swaps will settle and time tip accounts. |
Sniper tools | Know the precise slot where liquidity will appear. |
Validator dashboards | Monitor slot skew and fork events in real time. |
Before start, you need the next requirements:
Stack | Min version |
---|---|
Node.js | 18.x |
TypeScript | 5.x |
@grpc/grpc-js | 1.8.x |
protobufjs | 7.x |
git clone https://github.com/gsnode/solana-grpc-subscribe-slots.git
cd solana-grpc-subscribe-slots
npm i
No Git? Copy index.ts into your own project and install the same dependencies.
Create a .env file:
GRPC_ENDPOINT=https://grpc.gsnode.io
ts-node index.ts
You should see a stream like:
slot: 249068235
slot: 249068236
slot: 249068237
…
import { SubscribeRequest, CommitmentLevel } from "./types";
const req: SubscribeRequest = {
accounts: {},
slots: { incoming_slots: {} },
transactions: {},
transactionsStatus: {},
entry: {},
blocks: {},
blocksMeta: {},
accountsDataSlice: [],
commitment: CommitmentLevel.PROCESSED // switch to CONFIRMED if you need more certainty
};
console.log("Streaming Solana slots…");
CommitmentLevel.PROCESSED means you get the event as soon as a validator votes, not when it’s finalized, exactly what bots need.
What you’ll learn | Repo |
---|---|
Account balance updates (USDC) | solana-grpc-subscribe-account |
Token balance with data slice | …-account-slice |
Filtered transactions (Serum only) | …-transaction-filtered |
Block metadata stream | …-blocks-meta |
(Full index in the GS Node README)
Engineer. CEO of GS Node. Marketing Manager at Smithii.