Shredstream
Ultra-low latency transaction data by subscribing to Solana shreds before block finalization.
What are Shreds?
Shreds are the fundamental unit of data transmission in Solana's Turbine block propagation protocol. When a leader validator produces a block, it does not transmit the entire block at once. Instead, it breaks the block data into small packets called shreds (typically 1,228 bytes each) and distributes them through a tree of validators.
There are two types of shreds: data shreds containing the actual transaction data, and coding shreds containing Reed-Solomon erasure codes for error recovery. A block can be reconstructed from any sufficient subset of its shreds, making the protocol resilient to packet loss.
Why Shredstream Matters for Traders
Traditional data access paths — RPC polling, WebSocket subscriptions, even gRPC streaming — all receive data after the validator has processed and committed transactions. Shredstream bypasses this by delivering raw shred data directly to subscribers as the leader transmits it, before the block is even assembled.
For MEV searchers and ultra-low latency trading strategies, this represents a meaningful edge. A trader using Shredstream can see a large swap transaction 50–200ms before it appears in any RPC endpoint, providing a window to front-run, back-run, or arbitrage the price impact.
| Data Source | Latency vs. Block Time | Data Completeness | Complexity |
|---|---|---|---|
| Shredstream | Before confirmation | Partial (shreds as received) | High |
| gRPC (Geyser) | At processing | Complete transactions | Medium |
| WebSocket | At confirmation | Complete | Low |
| HTTP RPC | After confirmation | Complete | Lowest |
How Shredstream Works
Shredstream services intercept the Turbine shred propagation path. A Shredstream provider runs infrastructure co-located with major Solana validators and subscribes to their shred output. When the leader begins transmitting a new block, the Shredstream service receives shreds and immediately forwards them to subscribers.
Subscribers receive raw shred data and must reconstruct transactions themselves. This requires implementing the Solana shred deserialization protocol, which is non-trivial but well-documented. Libraries like solana-sdk provide the necessary primitives.
Shredstream vs. gRPC
The choice between Shredstream and gRPC depends on your specific requirements. Shredstream provides the absolute lowest latency but requires more complex client-side processing and delivers incomplete data (you receive shreds as they arrive, not complete transactions). gRPC via Yellowstone provides complete, parsed transaction data with slightly higher latency but significantly simpler integration.
For most production trading applications, gRPC is the better choice. The latency advantage of Shredstream is only meaningful for strategies where 50–200ms makes a difference — primarily MEV extraction and certain arbitrage strategies. For copy trading, analytics, and most DeFi applications, gRPC provides an excellent balance of latency and ease of use.
Infrastructure Requirements
Running a Shredstream subscription requires either co-located infrastructure near major Solana validators or a managed Shredstream service. The latency advantage disappears if your Shredstream provider is geographically distant from the validators. Key validator clusters are concentrated in Frankfurt (226 validators, 19.4% stake), Amsterdam (222 validators, 20.8% stake), and New York.
Infrastructure providers like HighTower offer managed Shredstream access as part of their infrastructure stack, handling the complexity of validator co-location and shred deserialization.
Implementation Example
import { ShredstreamClient } from '@jito-foundation/shredstream';
const client = new ShredstreamClient({
endpoint: 'https://your-shredstream-endpoint',
token: 'your-api-token',
});
// Subscribe to shreds for specific slots
const subscription = client.subscribeShreds({
onShred: (shred) => {
// Shred received - attempt to parse transaction data
if (shred.isData()) {
const txData = shred.parseTransaction();
if (txData) {
// Process transaction before confirmation
processEarlyTransaction(txData);
}
}
},
onError: (err) => {
console.error('Shredstream error:', err);
// Implement reconnection logic
},
});
// Always reconcile with confirmed data
connection.onSlotChange(async (slotInfo) => {
if (slotInfo.type === 'confirmed') {
await reconcileWithConfirmedSlot(slotInfo.slot);
}
});