Sol Shred SDK
sol-shred-sdk is a multi-source Solana shred ingestion and transaction/event parsing SDK.
The default, lowest-latency path is:
UDP packet -> Solana/Agave Shred -> FEC recovery -> deshred -> Entry -> VersionedTransaction -> event parser
Source/decode mode is selected with ShredDecodeMode. Native raw UDP shreds are the recommended path; Jito-style ShredStream gRPC entries are retained as a compatibility source while Jito service availability lasts.
What This SDK Provides
| Area | Coverage |
|---|---|
| Input | Raw UDP Solana shred payloads, or Jito-style ShredStream gRPC entries |
| Decode | ShredDecodeMode::RawUdp uses solana-ledger Shred parsing, Reed-Solomon recovery, Shredder::deshred, and bincode Vec<Entry> decode; ShredDecodeMode::JitoGrpc receives prebuilt entry batches |
| Transactions | Entry-to-transaction flattening with slot context |
| Events | DexEvent parser migrated from sol-parser-sdk ShredStream handling |
| Extensibility | TransactionEventParser trait for custom parser plug-ins |
| Compatibility | Preserves selected generated proto/type re-exports used by older code |
Migrated parser families match the sol-parser-sdk parser surface:
- PumpFun, PumpFun v2/Mayhem, Pump fees, PumpSwap
- Raydium LaunchLab, CPMM, CLMM, AMM V4
- Orca Whirlpool
- Meteora Pools, DAMM V2, DBC, DLMM
- Token accounts, nonce accounts, selected DEX account state events, and block metadata types
Raw shred subscriptions parse transaction-visible instruction data directly from
Entry transactions. Log-only and account-update event parsers are included for
SDK compatibility, but raw shreds do not carry execution logs or account update
payloads by themselves.
Installation
[]
= "3.0.1"
Decode Mode
Choose the source/decoder when creating the client:
use ;
let raw = new_with_decode_mode.await?;
let jito = new_with_decode_mode.await?;
Raw UDP Event Subscription
Bind a UDP socket where your Solana shred source sends raw shred datagrams:
use ;
use ;
async
Queue Subscription
For consumers that prefer polling:
use ShredStreamClient;
async
For legacy PumpFun/Bonk-only consumers, subscribe_pumpfun,
subscribe_pumpfun_callback, and the generic subscribe_with_parser APIs are
still available.
Low-Level Decoder
Use the low-level API when you already own the UDP receive loop:
use Instant;
use ;
let mut decoder = new;
Custom Transaction Parser
sol-shred-sdk owns networking, shred reassembly, and transaction traversal. Higher-level crates can plug in event parsing without reimplementing shredstream handling:
use AnyResult;
use TransactionEventParser;
use VersionedTransaction;
;
Configuration Notes
RawShredConfig::udp_payload_prefix_skipshould stay0for native raw shreds.RawShredConfig::forward_slot_watermarkdefaults tofalseso out-of-order completed slots are not dropped. Enable it only when you explicitly prefer forward-only latency over completeness.ShredStreamConfig::low_latency()favors shorter reassembly waits and faster restart.ShredStreamConfig::high_throughput()increases receive buffering, tracked slots, and queue capacity.ShredDecodeMode::JitoGrpckeeps the old entries-gRPC source but still uses the same unifiedDexEventparser.- The UDP receive buffer is requested with
socket2; the OS may cap the actual value.
Decoder Benchmark
The raw decoder has an ignored release-mode microbench that generates real Solana merkle shreds with solana-ledger and decodes them through RawShredDecoder:
RAW_SHRED_BENCH_ITERS=10000
Current local reference result:
packets_per_sec=1172196 slots_per_sec=36631 tx_per_sec=1172196
License
This project is licensed under the MIT License - see the LICENSE file for details.