Coding shreds are the parity packets of a Solana block. A leader computes them with Reed-Solomon coding from a group of data shreds, which hold the block's real bytes: serialized entries. If some data shreds go missing in transit, a receiver can rebuild them from the data and coding shreds that did arrive.
What does a data shred carry?#
A data shred holds a slice of the leader's serialized ledger data. If you have not met shreds before, start with what a Solana shred is and come back; this page assumes you know a shred is one UDP-sized piece of a block.
After the 64-byte signature and the common header that every shred has, a data shred adds a 5-byte data header with three fields:
- parent_offset (2 bytes): how many slots back the parent block is. A value of 1 means the block builds on the slot right before it; a larger value means slots in between were skipped.
- flags (1 byte): the low six bits hold a reference tick, capped at 63. Under Tower BFT it counted the ticks that had passed in the slot; data shreds still carry a reference-tick field, but under Alpenglow it no longer measures time within the slot. The two high bits are completion markers. One marks the last data shred of a serialized batch, and the other marks the last data shred of the whole slot.
- size (2 bytes): the length of the headers plus the useful data. Anything after that point is zero padding.
The bytes after the headers are the payload. Joined in index order, the payloads of consecutive data shreds form a serialized batch of entries, the records that hold transactions and ticks. A single data shred rarely means anything alone, because an entry or a transaction can start in one shred and end in the next.
What does a coding shred carry?#
A coding shred holds parity: bytes computed from all the data shreds in its group, so the group can survive losses. Agave groups 32 data shreds with 32 coding shreds and runs Reed-Solomon over them. Each group is called a forward error correction set, and FEC sets and erasure coding covers how the group is formed and decoded.
The coding header is 6 bytes:
- num_data_shreds: how many data shreds are in the set.
- num_coding_shreds: how many coding shreds are in the set.
- position: this coding shred's place among the coding shreds of its set, from 0 up to the count minus one.
The parity covers each data shred from the end of its signature to the end of its data, so the data headers are protected too. A rebuilt data shred comes back with its slot, index and flags intact. Nothing in a coding shred can be read as a transaction. Its only use is to restore missing data shreds.
Why are the two kinds different sizes?#
In current Agave code a coding shred is 1228 bytes and a data shred is 1203 bytes. The difference comes from how Reed-Solomon works: every piece in a set must be the same length.
A coding shred has to fit its own signature, its headers, a full parity piece and a Merkle proof into one packet. That parity piece must be as long as the protected part of a data shred. The data shred is therefore cut shorter, so its protected part matches the room left inside a coding shred. Both kinds also end with a 32-byte Merkle root of the previous set and a 120-byte Merkle proof, which let a receiver check a shred against the leader's signature. Some shreds also carry a second signature from the node that retransmitted them, which takes more room from the data.
The practical result for a receiver: size your buffer for 1228 bytes and expect most datagrams near one of the two sizes.
How do you tell them apart on the wire?#
Read byte 64, the first byte after the signature. It is the shred variant. Its high four bits give the kind, and its low four bits give the depth of the Merkle proof. Current Agave code accepts four values:
| Variant byte | Kind |
|---|---|
0x96 | data shred |
0xb6 | data shred, resigned by a retransmitter |
0x66 | coding shred |
0x76 | coding shred, resigned by a retransmitter |
Older software used other values, including the legacy bytes 0xa5 for data and 0x5a for coding, and earlier Merkle variants with a different proof depth. A parser that matches on the high four bits is more forgiving than one that matches whole bytes. The full layout of each field is on the shred header, field by field, and parsing the shred header shows the reads in code.
Why do they have separate index counters?#
Each shred has an index inside its slot, but data and coding shreds count separately. Data shred 40 and coding shred 40 of the same slot are two different packets. The pair of slot and index is only unique when you add the kind, so a receiver that tracks what it has seen should key on all three.
Both kinds share one more field, fec_set_index, which is the index of the first data shred in the set. All 64 shreds of a set carry the same value, and that is how a receiver gathers them before it tries to recover anything.
A data shred's position in its set is its index minus the set index. A coding shred's position is in its own header. With those two numbers a decoder can line up all 64 pieces in the order Reed-Solomon expects.
Questions#
Can transactions be read from coding shreds alone?#
Not directly. Coding shreds hold parity, so you first use them to rebuild the missing data shreds, and that needs at least 32 shreds from the set in any mix of the two kinds.
Are there always 32 coding shreds per set?#
All current validator clients send 32 data and 32 coding shreds per set, according to SIMD-0317. Older software allowed other counts, so a careful receiver reads the counts from the coding header instead of assuming them.
Should a receiver drop coding shreds when no data is lost?#
It can, once every data shred of the set has arrived. Until then, keeping them is the only way to fill a gap without asking another node for the missing piece.
Sources#
- SIMD-0384: Alpenglow migration (PoH deprecation) (checked 2026-11-17)
- Agave source: ledger/src/shred.rs (shred kinds, headers, flags) (checked 2026-11-17)
- Agave source: shred/wire-format/src/constants.rs (payload sizes, 32:32 sets) (checked 2026-11-17)
- Agave source: shred/wire-format/src/shred_variant.rs (variant bytes) (checked 2026-11-17)
- Agave source: shred/wire-format/src/headers.rs (header fields) (checked 2026-11-17)
- Agave source: ledger/src/shred/merkle.rs (Reed-Solomon coding) (checked 2026-11-17)
- SIMD-0317: Enforce 32 data + 32 coding shreds (checked 2026-11-17)