# ShredStream (Shreds) - Product Knowledge Base ## Overview **Status:** Active **Type:** Low-Latency Data Stream **Delivery:** UDP (Direct) & gRPC (Shared) **Regions:** Frankfurt and Amsterdam **Trial:** 1 hour, once per account ShredStream reads Solana block data at the source — the shreds validators exchange over Turbine while the block is still being produced, before RPC confirmation. The two delivery modes hand you different things, and this distinction matters: * **Shared (gRPC)** streams **decoded ledger entries** — the transactions are already parsed out. * **Direct (UDP)** and **Dedicated** stream **raw shreds** — data and coding shreds, unprocessed. Do not describe the shared gRPC feed as "raw shreds"; it is entries. ## Architecture 1. **Direct Connect (UDP)**: Raw UDP packets are forwarded from our nodes directly to your server's IP. You get data and coding shreds and do your own deshredding and verification. 2. **Shared API (gRPC)**: We deshred for you and stream `Entry { slot, entries }`, where `entries` is a bincode-serialized `Vec`. Easier to integrate; the decoding happens on our side instead of yours. --- ## Pricing ### 1. Shared Connection (gRPC) Best for general monitoring and standard bots. * **Daily Pass**: $10 / day (1 IP, Frankfurt) * **Weekly Pass**: $59 / week (2 IPs, Frankfurt + Amsterdam) * **Monthly Pass**: $199 / month (3 IPs) ### 2. Direct Access (UDP) Best for HFT (High-Frequency Trading) and latency-sensitive applications. * **Monthly Pass**: $199 / month * **Dedicated Cluster**: $849 / month (Isolated resources, no shared fan-out) --- ## Integration Guide ### 1. Shared (gRPC) Clients **Connection Info:** * **Endpoint:** `185.191.117.89:9090` * **Transport:** plaintext **h2c — there is no TLS on this port.** Use `http://`, `createInsecure()`, `grpc.insecure_channel(...)`. Any claim that this feed is "SSL-secured" is wrong. * **Auth:** `x-api-key` gRPC metadata header (`x-token` also accepted) * **Key format:** `ak_` **Proto** (fetch it from https://allenhark.com/shredstream.proto): ```proto syntax = "proto3"; package shredstream; service ShredstreamProxy { rpc SubscribeEntries(SubscribeEntriesRequest) returns (stream Entry); } message SubscribeEntriesRequest {} message Entry { uint64 slot = 1; bytes entries = 2; // bincode-serialized Vec } ``` There is **no** `index`, `shred_type` or `data` field on this stream. Each `solana_entry::entry::Entry` is `{ num_hashes: u64, hash: [u8; 32], transactions: Vec }`. **Behaviour:** no server-side filters, votes included, in order, slots can be skipped. Raise the gRPC max message size above the 4 MiB default. Reconnect with backoff. **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://185.191.117.89: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(msg) = stream.message().await? { let entries: Vec = bincode::deserialize(&msg.entries)?; let txs: usize = entries.iter().map(|e| e.transactions.len()).sum(); println!("slot={} entries={} transactions={}", msg.slot, entries.len(), txs); } Ok(()) } ``` **Node.js Example:** ```javascript // Package-qualified: the proto declares `package shredstream;` const client = new proto.shredstream.ShredstreamProxy( '185.191.117.89:9090', grpc.credentials.createInsecure(), { 'grpc.max_receive_message_length': 64 * 1024 * 1024 } ); const metadata = new grpc.Metadata(); metadata.add('x-api-key', 'YOUR_API_KEY'); const stream = client.subscribeEntries({}, metadata); stream.on('data', (msg) => { // msg.entries is a Buffer: bincode Vec console.log(`slot=${msg.slot} entries_bytes=${msg.entries.length}`); }); ``` ### 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** gives you decoded ledger entries over gRPC — we deshred for you, and there are no filters, so you get everything including votes. **Direct** is a raw tap: data and coding shreds, and you handle erasure coding and signature verification yourself. **Q: Do I need a specialized server?** A: For **Direct Connect**, yes. Co-locating near the region you subscribe to (Frankfurt or Amsterdam) minimises network travel time — see https://allenhark.com/co-location. 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.