β‘ 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
- Create an account on ShredStream.com
- Launch a Raw Shred Stream and pick your region
- Enter your server's IP address and the UDP port where you want to receive shreds
- 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
import os, socketPORT = 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
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
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
package mainimport ("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.
| Language | Install | Package |
|---|---|---|
| JavaScript / TypeScript | npm install shredstream | npm |
| Python | pip install shredstream | PyPI |
| Rust | cargo add shredstream | crates.io |
| Go | go get github.com/shredstream/shredstream-sdk-go/v2 | GitHub |
// cargo add shredstreamuse 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 transactionsfor (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:
# Linuxsudo sysctl -w net.core.rmem_max=33554432# macOSsudo sysctl -w kern.ipc.maxsockbuf=33554432
See Network Setup for full firewall and buffer configuration.
β‘οΈ Next Steps
- Building a Receiver β what a full raw-shred pipeline involves, and when Decoded Shred Stream is the better fit
- Network Setup β firewall and OS-level configuration
- Best Practices β monitoring, redundancy, and performance
- Troubleshooting β common issues and solutions