⚑ Raw Shred Quickstart

Raw Shred Stream delivers raw Solana shreds to your server as UDP datagrams, straight into your own receiver. This quickstart binds a UDP socket and receives those datagrams so you can confirm data is flowing. From there, deshredding, reassembly, and transaction decoding run in your own pipeline β€” through an optimized decoder, so the latency advantage is preserved.

Want to skip the decoder entirely? Decoded Shred Stream delivers transactions already reassembled in standard wire format. See Building a Receiver for the full raw-shred pipeline.


πŸ“‹ Prerequisites

  1. Create an account on ShredStream.com
  2. Launch a Raw 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

πŸ’» Receive Raw Shred Datagrams

Bind a UDP socket to the port you configured on ShredStream.com and read datagrams. Each datagram carries one raw Solana shred β€” those bytes are yours to deshred and decode.

Python

python
import os, socket
PORT = int(os.environ.get("SHREDSTREAM_PORT", 8080))
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("0.0.0.0", PORT))
while True:
shred, _ = sock.recvfrom(65535)
# Raw Solana shred bytes β€” feed your deshredder / decoder here.
print(f"shred: {len(shred)} bytes")

JavaScript / TypeScript

javascript
import dgram from 'node:dgram';
const PORT = parseInt(process.env.SHREDSTREAM_PORT || '8080');
const sock = dgram.createSocket('udp4');
sock.on('message', (shred) => {
// Raw Solana shred bytes β€” feed your deshredder / decoder here.
console.log(`shred: ${shred.length} bytes`);
});
sock.bind(PORT, '0.0.0.0');

Rust

rust
use std::net::UdpSocket;
fn main() -> std::io::Result<()> {
let port: u16 = std::env::var("SHREDSTREAM_PORT")
.ok().and_then(|v| v.parse().ok()).unwrap_or(8080);
let sock = UdpSocket::bind(("0.0.0.0", port))?;
let mut buf = [0u8; 65535];
loop {
let (len, _) = sock.recv_from(&mut buf)?;
// Raw Solana shred bytes β€” feed your deshredder / decoder here.
println!("shred: {} bytes", len);
}
}

Go

Gogo
package main
import (
"fmt"
"net"
"os"
"strconv"
)
func main() {
port, _ := strconv.Atoi(os.Getenv("SHREDSTREAM_PORT"))
if port == 0 {
port = 8080
}
conn, err := net.ListenUDP("udp", &net.UDPAddr{IP: net.IPv4zero, Port: port})
if err != nil {
panic(err)
}
defer conn.Close()
buf := make([]byte, 65535)
for {
n, _, err := conn.ReadFromUDP(buf)
if err != nil {
continue
}
// Raw Solana shred bytes β€” feed your deshredder / decoder here.
fmt.Printf("shred: %d bytes\n", n)
}
}

Set SHREDSTREAM_PORT (or edit the default) to the port you configured for your stream on the ShredStream.com dashboard.

This loop only proves datagrams are arriving. Raw shreds still need deshredding, reassembly, and transaction decoding β€” that pipeline is yours to build. To skip it entirely, see Decoded Shred Stream: transactions arrive already reassembled.


🧩 Legacy Client: shredstream

Warning: our client is no longer recommended for latency-sensitive use cases. Use another client instead, or our Decoded Shred Stream service directly.

If you need something that runs today, the legacy shredstream client binds the port, deshreds and reassembles client-side and hands you ready Solana transactions. Client-side deshredding costs latency β€” fine to get started, not to compete on latency.

LanguageInstallPackage
JavaScript / TypeScriptnpm install shredstreamnpm
Pythonpip install shredstreamPyPI
Rustcargo add shredstreamcrates.io
Gogo get github.com/shredstream/shredstream-sdk-go/v2GitHub
rust
// cargo add shredstream
use shredstream::ShredListener;
fn main() {
let port: u16 = std::env::var("SHREDSTREAM_PORT")
.ok().and_then(|v| v.parse().ok()).unwrap_or(8001);
let mut listener = ShredListener::bind(port).expect("bind");
// Client-side deshredding β†’ ready Solana transactions
for (slot, transactions) in listener.transactions() {
for tx in &transactions {
println!("slot {}: {}", slot, tx.signatures[0]);
}
}
}

βš™οΈ OS Buffer Tuning

Your receiver should request a large socket receive buffer (at least 25 MB) via setsockopt(SO_RCVBUF, …). You also need to allow that 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

Raw Shred Quickstart β€” Docs | ShredStream.com