⚡ SDK Quick Start

Our official SDKs handle UDP reception, shred parsing, and transaction decoding out of the box. Install one command, write a few lines of code, and start receiving Solana shreds.


📦 Available SDKs

JavaScript / TypeScriptnpm install shredstream
Pythonpip install shredstream
Rustcargo add shredstream
Gogo get github.com/shredstream/shredstream-sdk-go

📋 Prerequisites

  1. Create an account on ShredStream.com
  2. Launch a Shred Stream and pick your region
  3. Enter your server's IP address and the UDP port where you want to receive shreds
  4. Open your firewall for inbound UDP traffic on that port — see Network Setup

💻 Quick Start Examples

Each example listens for raw shreds on the port assigned by ShredStream.com.

// First, install our SDK with: npm install shredstream
const { ShredListener } = require('shredstream');
const listener = new ShredListener(8001);
// Decoded transactions — ready-to-use Solana transactions
listener.on('transactions', (slot, txs) => {
txs.forEach(tx => console.log(`slot ${slot}: ${tx.signature}`));
});
// OR: raw shreds — lowest latency, pre-block delivery
// listener.on('shred', (slot, index, payload) => {
// console.log(`slot ${slot} index ${index} len ${payload.length}`);
// });
listener.start();

Replace 8001 with the port assigned to your stream on the ShredStream.com dashboard.


⚖️ Raw Shreds vs Decoded Transactions

The SDKs offer two modes:

ModeMethodLatencyUse Case
Raw shreds.shreds() / on('shred') / OnShred()LowestCustom parsing, binary analysis, maximum speed
Decoded transactionsfor slot, txs in listener / on('transactions') / OnTransactions()Slightly higherReady-to-use Solana transactions with signatures

Decoded transactions are emitted as each shred arrives, not at the end of the slot. The latency difference between the two modes is minimal.


⚙️ OS Buffer Tuning

The SDKs configure the socket receive buffer automatically (25 MB by default). However, you still need to allow this buffer size at the OS level:

bash
# Linux
sudo sysctl -w net.core.rmem_max=33554432
# macOS
sudo sysctl -w kern.ipc.maxsockbuf=33554432

See Network Setup for full firewall and buffer configuration.


➡️ Next Steps