# ShredStream (Shreds) - Product Knowledge Base ## Overview **Status:** Active **Type:** Low-Latency Data Stream **Delivery:** UDP (Direct) & gRPC (Shared) **Latency:** Real-time (Zero-Copy Forwarding) ShredStream provides direct access to raw Solana shreds (packet-level data) as they are propagated through the network. This allows trading bots to see transactions and slot updates milliseconds before they appear in standard RPC block subscriptions. ## Architecture 1. **Direct Connect (UDP)**: Raw UDP packets are forwarded from our validator nodes directly to your server's IP. This is the fastest possible method (failed verification checks are skipped; you get raw data). 2. **Shared API (gRPC)**: A structured feed where we verify and parse shreds, then stream them to you via gRPC. Easier to integrate but adds micro-seconds of processing time. --- ## Pricing ### 1. Shared Connection (gRPC) Best for general monitoring and standard bots. * **Daily Pass**: $10 / day * **Weekly Pass**: $49 / week * **Monthly Pass**: $149 / month ### 2. Direct Access (UDP) Best for HFT (High-Frequency Trading) and latency-sensitive applications. * **Daily Pass**: $10 / day * **Weekly Pass**: $59 / week * **Monthly Pass**: $199 / month * **Dedicated Cluster**: $299 / month (Isolated resources) --- ## Integration Guide ### 1. Shared (gRPC) Clients **Connection Info:** * **Endpoint:** `84.32.223.83` * **Port:** `9090` * **Auth:** `x-api-key` header **Rust Example:** ```rust use tonic::{Request, transport::Channel, metadata::MetadataValue}; use shredstream_proxy_client::ShredstreamProxyClient; #[tokio::main] async fn main() -> Result<(), Box> { let channel = Channel::from_static("http://84.32.223.83:9090").connect().await?; let mut client = ShredstreamProxyClient::new(channel); let mut request = Request::new(SubscribeEntriesRequest {}); let api_key = MetadataValue::from_str("YOUR_API_KEY")?; request.metadata_mut().insert("x-api-key", api_key); let mut stream = client.subscribe_entries(request).await?.into_inner(); while let Some(entry) = stream.message().await? { println!("Shred: slot={}, size={}", entry.slot, entry.data.len()); } Ok(()) } ``` **Node.js Example:** ```javascript const client = new proto.ShredstreamProxy('84.32.223.83:9090', grpc.credentials.createInsecure()); const metadata = new grpc.Metadata(); metadata.add('x-api-key', 'YOUR_API_KEY'); const stream = client.subscribeEntries({}, metadata); stream.on('data', (entry) => { console.log(`Shred: slot=${entry.slot}`); }); ``` ### 2. Direct Connect (UDP) **Concept:** You must run a UDP listener on your server. We configure our validators to send packets to your `IP:PORT`. **Rust UDP Listener Example:** ```rust use tokio::net::UdpSocket; #[tokio::main] async fn main() -> std::io::Result<()> { // Bind to the port you provided to AllenHark Console let socket = UdpSocket::bind("0.0.0.0:10000").await?; println!("Listening for shreds on port 10000..."); let mut buf = [0u8; 65535]; loop { let (len, addr) = socket.recv_from(&mut buf).await?; println!("Received {} bytes from {}", len, addr); // Process raw packet (Shred verification checks needed here) } } ``` ## detailed Q&A **Q: What is the difference between Direct and Shared?** A: **Shared** is like a filtered firehose; we parse it for you. **Direct** is a raw tap into the validator's network card. Direct is faster but requires you to handle raw packet logic (erasure coding, signature verification). **Q: Do I need a specialized server?** A: For **Direct Connect**, yes. We recommend co-locating in **Frankfurt** (where our validators are) to minimize network travel time. For **Shared**, any high-performance server works. **Q: How do I manage my subscription?** A: All billing is handled via the [AllenHark Console](https://console.allenhark.com). You can renew manually or enable auto-renewal.