$npx -y skills add agiprolabs/claude-trading-skills --skill shredstreamPre-execution Solana transaction streaming via Jito ShredStream, Shyft RabbitStream, and Triton Deshred
| 1 | # ShredStream — Pre-Execution Solana Data |
| 2 | |
| 3 | ShredStream gives you transaction data **before the validator executes the block** — typically 100-500ms earlier than standard Yellowstone gRPC. You see transaction *intent*, not confirmed results. |
| 4 | |
| 5 | This is the fastest path to Solana data for time-critical trading strategies. |
| 6 | |
| 7 | ## How It Works |
| 8 | |
| 9 | Solana validators produce blocks by serializing transactions into **shreds** (~1,228 bytes each, sized for UDP MTU). Shreds propagate through Turbine (Solana's fanout protocol, 2-3 hops). ShredStream bypasses Turbine by receiving shreds **directly from leader validators** via Jito's Block Engine. |
| 10 | |
| 11 | ``` |
| 12 | Leader Validator |
| 13 | │ |
| 14 | ├── Turbine (standard, 2-3 hops, 200-500ms) |
| 15 | │ └── Your RPC Node → Yellowstone gRPC (post-execution) |
| 16 | │ |
| 17 | └── Jito Block Engine (direct) |
| 18 | └── ShredStream Proxy (your server) |
| 19 | ├── UDP shreds → Your RPC/Validator (faster block building) |
| 20 | └── gRPC entries → Your Trading Bot (decoded transactions) |
| 21 | ``` |
| 22 | |
| 23 | ### What You Get vs. What You Don't |
| 24 | |
| 25 | | Available (Pre-Execution) | NOT Available (Needs Execution) | |
| 26 | |---------------------------|--------------------------------| |
| 27 | | Transaction signatures | Success/failure status | |
| 28 | | Account keys (pubkeys) | Balance changes (pre/post) | |
| 29 | | Instructions (program, accounts, data) | Log messages | |
| 30 | | Address lookup table references | Inner instructions (CPI) | |
| 31 | | Slot number | Token balance changes | |
| 32 | | | Compute units consumed | |
| 33 | |
| 34 | **Key tradeoff**: Speed for completeness. You see what's *about to happen* but can't confirm it actually succeeded. Some transactions you see will ultimately fail. |
| 35 | |
| 36 | ## Three Ways to Get Pre-Execution Data |
| 37 | |
| 38 | | Provider | Product | Latency | Access | Cost | |
| 39 | |----------|---------|---------|--------|------| |
| 40 | | **Jito** | ShredStream Proxy | ~10-50ms from leader | Apply + auth keypair | Free (beta) | |
| 41 | | **Shyft** | RabbitStream | ~15-100ms faster than gRPC | Shyft gRPC plan | From $199/mo | |
| 42 | | **Triton** | Deshred (`SubscribeDeshred`) | ~6.3ms p50 from shred | Triton customer | ~$2,900+/mo | |
| 43 | |
| 44 | See `references/providers_compared.md` for detailed comparison. |
| 45 | |
| 46 | ## Option 1: Jito ShredStream Proxy |
| 47 | |
| 48 | The most direct approach — run Jito's open-source proxy on your own server. |
| 49 | |
| 50 | ### Get Access |
| 51 | |
| 52 | 1. Generate a Solana keypair: `solana-keygen new -o shred_auth.json` |
| 53 | 2. Apply at [Jito's form](https://web.miniextensions.com/WV3gZjFwqNqITsMufIEp) with your public key |
| 54 | 3. Wait for approval (your keypair gets whitelisted) |
| 55 | 4. No staking requirement, free during beta |
| 56 | |
| 57 | ### Run the Proxy |
| 58 | |
| 59 | ```bash |
| 60 | # Clone and build |
| 61 | git clone https://github.com/jito-labs/shredstream-proxy.git --recurse-submodules |
| 62 | cd shredstream-proxy |
| 63 | |
| 64 | # Run with gRPC enabled (key flag: --grpc-service-port) |
| 65 | RUST_LOG=info cargo run --release --bin jito-shredstream-proxy -- shredstream \ |
| 66 | --block-engine-url https://mainnet.block-engine.jito.wtf \ |
| 67 | --auth-keypair /path/to/shred_auth.json \ |
| 68 | --desired-regions ny,amsterdam \ |
| 69 | --dest-ip-ports 127.0.0.1:8001 \ |
| 70 | --grpc-service-port 7777 |
| 71 | ``` |
| 72 | |
| 73 | Docker (host networking required for UDP): |
| 74 | |
| 75 | ```bash |
| 76 | docker run -d --name shredstream-proxy --rm \ |
| 77 | --network host \ |
| 78 | -e RUST_LOG=info \ |
| 79 | -e BLOCK_ENGINE_URL=https://mainnet.block-engine.jito.wtf \ |
| 80 | -e AUTH_KEYPAIR=/app/shred_auth.json \ |
| 81 | -e DESIRED_REGIONS=ny,amsterdam \ |
| 82 | -e DEST_IP_PORTS=127.0.0.1:8001 \ |
| 83 | -e GRPC_SERVICE_PORT=7777 \ |
| 84 | -v /path/to/shred_auth.json:/app/shred_auth.json \ |
| 85 | jitolabs/jito-shredstream-proxy shredstream |
| 86 | ``` |
| 87 | |
| 88 | ### Configuration |
| 89 | |
| 90 | | Parameter | Description | Example | |
| 91 | |-----------|-------------|---------| |
| 92 | | `BLOCK_ENGINE_URL` | Jito block engine endpoint | `https://mainnet.block-engine.jito.wtf` | |
| 93 | | `AUTH_KEYPAIR` | Path to whitelisted Solana keypair | `shred_auth.json` | |
| 94 | | `DESIRED_REGIONS` | Max 2, comma-separated | `ny,amsterdam` | |
| 95 | | `DEST_IP_PORTS` | Where to forward raw shreds (UDP) | `127.0.0.1:8001` | |
| 96 | | `GRPC_SERVICE_PORT` | Enable gRPC entry streaming | `7777` | |
| 97 | | `SRC_BIND_PORT` | Incoming shred UDP port | `20000` | |
| 98 | |
| 99 | Available regions: `amsterdam`, `dublin`, `frankfurt`, `london`, `ny`, `salt-lake-city`, `singapore`, `tokyo` |
| 100 | |
| 101 | ### Verify It's Working |
| 102 | |
| 103 | ```bash |
| 104 | # Check shreds are arriving via UDP |
| 105 | sudo tcpdump 'udp and dst port 20000' |
| 106 | # Should see many ~1200-byte packets continuously |
| 107 | ``` |
| 108 | |
| 109 | ### Consume via gRPC |
| 110 | |
| 111 | ```rust |
| 112 | use jito_protos::shredstream::{ |
| 113 | shredstream_proxy_client::ShredstreamProxyClient, |
| 114 | SubscribeEntriesRequest, |
| 115 | }; |
| 116 | |
| 117 | let mut client = ShredstreamProxyClient::connect("http://127.0.0.1:7777").await?; |
| 118 | let mut stream = client |
| 119 | .subscribe_entries(SubscribeEntriesRequest {}) |
| 120 | .await? |
| 121 | .into_inner(); |
| 122 | |
| 123 | while let Some(entry) = stream.message().await? { |
| 124 | let entries: Vec<solana_entry::entry::Entry> = |
| 125 | bincode::deserialize(&entry.entries)?; |
| 126 | |
| 127 | for e in &entries { |
| 128 | for tx in &e.transactions { |