How to Stream Solana Slots in Real Time With gRPC (+ Free Repo)
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:
Front-run MEV bots (or build your own).
Fire sniping transactions one slot earlier.
Benchmark validator lag and RPC latency for your infra dashboard.
Who benefits?
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.
Requirements & Quick Setup
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
How to suscribe Solana Slots step by step
This is how to suscribe Solana slots in 3 steps only cloning a github repo:
1. Clone (or copy) the repo
No Git? Copy index.ts into your own project and install the same dependencies.
2. Point to GS Node
Create a .env file:
3. Run it
You should see a stream like:
Under the Hood: The 15-Line gRPC Call
CommitmentLevel.PROCESSED means you get the event as soon as a validator votes, not when it’s finalized, exactly what bots need.
Pro Tips From Infra Engineers
Parallel streams > single streamSpin up 3–5 workers, round-robin endpoints, and merge events. No single connection bottleneck.
Back-pressure with queuesPipe slots into BullMQ (or Redis streams). Avoid dropping events during GC pauses.
Track “slot lag”(network_latest – local_latest) > 100? Your VPS is falling behind—time to relocate or upgrade NIC.
Store minimal dataA slot, timestamp, and maybe leaderPubkey is enough. Save disk; replay later via blocks if needed.
Common Pitfalls
Mixing REST & gRPC leads to unpredictable latencies. Stick to one transport for mission-critical flows.
Neglecting commitment levels: FINALIZED adds up to ~3 s delay—great for analytics, awful for MEV.
Assuming slots == blocks: not every slot becomes a block; handle skipped slots in your logic.