UDP vs TCP for Receiving Shreds — Which Should You Use?

A technical deep dive into the transport protocols used for Solana Shreds. Why UDP's fire-and-forget model beats TCP's reliability for blockchain data.

  • January 25, 2025
  • Infrastructure
  • AllenHark Team
A quiet stack of pagesAn abstract drawing of light on the page's dark ground. A neat stack of thin, solid pages, the top one lit, with faint streams of light drifting toward it from the left.A quiet stack of pagesAn abstract drawing of light on the page's dark ground. A neat stack of thin, solid pages, the top one lit, with faint streams of light drifting toward it from the left.

When building high-performance Solana infrastructure, you'll often see providers offering UDP (User Datagram Protocol) or TCP (Transmission Control Protocol) connections. For Shreds, the choice is clear, but understanding why is crucial for optimizing your receiver.

The Protocol Showdown

FeatureTCPUDP
ConnectionConnection-oriented (Handshake)Connectionless (Fire-and-forget)
ReliabilityGuaranteed Delivery (Retries)No Guarantee (Best Effort)
OrderingGuaranteed OrderUnordered
OverheadHandshake, ACKs, retransmitsNone

Why Solana Uses UDP for Turbine

Solana's block propagation protocol, Turbine, is built on top of UDP.

  1. Speed is King: In a high-throughput blockchain, waiting for a TCP acknowledgment (ACK) for every packet would grind the network to a halt.
  2. Packet Loss Tolerance: If a few shreds are lost, Solana uses Erasure Coding (Reed-Solomon) to reconstruct the missing data from other packets. It doesn't need every single packet to arrive perfectly.

Receiving Shreds: Why You Should Use UDP

If you consume shreds via TCP, you are introducing artificial latency.

  • TCP Head-of-Line Blocking: If one shred packet is dropped on the internet, your TCP stack will pause all subsequent shreds until that one is retransmitted. You will fall behind the tip of the chain.
  • UDP Streaming: You receive packets as they arrive. If one is dropped, you skip it and keep processing the latest data. For a trading bot, freshness is more important than completeness.

AllenHark's Approach

At AllenHark, we push shreds data over UDP: Direct UDP sends reconstructed entries as datagrams to your IP and port, and Dedicated forwards the raw shreds themselves, data and coding, byte for byte as the validators send them — no TCP wrapper on either.

Connect via UDP today