TX Stream API
The NextBlock TX Stream API provides real-time streaming of Solana transactions filtered by program IDs. This independent service allows trading bots to subscribe to transaction streams and receive fast notifications for transactions involving specific programs, enabling quick detection of new DEX launches and trading opportunities.
To be authenticated to use NextStream, you have to send SOL to nextstream.sol. 5 SOL = 31 days of access. You can also send less to test the service for a few days. The minimum amount is 1 day (0.17 SOL). Upon sending SOL to nextstream.sol, the address from which you sent the SOL becomes authenticated for one concurrent connection per region. You have to use the SOL sender wallet to authenticate to the NextStream server.
Examples in Rust, TypeScript and Golang are available at github.com/nextblock-ag/nextblock-stream-examples
Overview
To subscribe to NextStream:
Build an authentication message:
{domain}|{publickey}|{nonce}|{timestamp}
domain
: the host you are connecting to (e.g.fra.stream.nextblock.io:22221
)publickey
: the Solana public key of the account that sent the fee transactionnonce
: random integertimestamp
: current unix time (seconds)
Sign the message with the corresponding Solana private key.
Send a subscription request (
NextStreamSubscription
) with:
AuthenticationPublickey
AuthenticationMessage
AuthenticationSignature
(base58)List of
accounts
you want to filter for
Receive streamed messages, each containing a
Packet
with:
transaction
(binary-encoded Solana transaction)slot
Proto Specification
syntax = "proto3";
package stream;
option go_package = "nextblock-stream-examples/golang-example/protos";
message NextPacket {
bytes transaction = 1; // raw transaction bytes
uint64 slot = 2;
}
message NextStreamSubscription {
string authentication_publickey = 1; // the publickey you used to send 5 SOL to nextstream.sol
string authentication_message = 2; // the finished authentication_message:
string authentication_signature = 3; // base58 signature, signed_message signed by authenticated_publieky
repeated string accounts = 4; // base58 accounts to subscribe to
}
message NextStreamNotification {
NextPacket packet = 1;
}
service NextStreamService {
rpc SubscribeNextStream (NextStreamSubscription) returns (stream NextStreamNotification) {}
}
Available Endpoints
Choose the endpoint closest to your location for optimal latency:
Frankfurt:
fra.stream.nextblock.io:22221
Amsterdam:
amsterdam.stream.nextblock.io:22221
London:
london.stream.nextblock.io:22221
Singapore:
singapore.stream.nextblock.io:22221
Tokyo:
tokyo.stream.nextblock.io:22221
New York:
ny.stream.nextblock.io:22221
Salt Lake City:
slc.stream.nextblock.io:22221
Examples
Go Example - Complete Go implementation with connection setup
Rust Example - Rust implementation using Tonic
TypeScript Example - TypeScript implementation for Node.js
HTTP Example - HTTP alternatives
Use Cases
Trading Bots: Real-time transaction detection for automated trading strategies and sniping new DEX launches
Best Practices
Choose optimal endpoint: Use the endpoint closest to your location
Filter efficiently: Subscribe only to programs you need to reduce bandwidth
Handle reconnections: Implement automatic reconnection logic
Process quickly: Handle incoming transactions efficiently to avoid backlog
Use connection pooling: For high-throughput applications
Monitor connection health: Implement heartbeat/keepalive mechanisms
Last updated