A shred header is the fixed block of bytes at the front of every Solana shred that says what it is and where it belongs. Its first 83 bytes use one layout for all shreds: the leader's signature, a type byte, the slot number, a per-slot counter, the cluster's version and the batch number. A short type-specific header follows.
What is in the shred header?#
A shred is one packet's worth of a block, small enough for a single UDP datagram. There are two kinds, described in data shreds and coding shreds, and both start with the same 83-byte common header. After that, a data shred has a 5-byte data header and a coding shred has a 6-byte coding header.
The layout below comes from the Agave validator source, release v4.4.1. All integers are little-endian.
| Bytes | Field | Type | Meaning |
|---|---|---|---|
| 0 to 63 | signature | 64 bytes | The slot leader's signature |
| 64 | variant | u8 | Data or coding, plus layout details |
| 65 to 72 | slot | u64 | The slot this shred belongs to |
| 73 to 76 | index | u32 | Position of this shred within its slot |
| 77 to 78 | version | u16 | The cluster's shred version |
| 79 to 82 | fec_set_index | u32 | Index of the first data shred in this erasure batch |
What does each common field mean?#
Signature. A 64-byte signature, the same size and scheme Solana uses for transactions, made with the key of the validator scheduled to lead this slot. On current shreds the leader does not sign the shred bytes directly. It signs the Merkle root of the erasure batch, so every shred in a batch carries the identical signature. Merkle shreds and shred signatures walks through how a receiver checks it.
Variant. One byte that tells you whether this is a data or a coding shred and how the tail of the payload is laid out. It gets its own section below.
Slot. The slot number. Together with the leader schedule, it tells you whose signature to expect.
Index. A counter that starts at zero in every slot. Data shreds and coding shreds have separate counters, so a data shred and a coding shred in the same slot can share an index. Only the triple of slot, index and shred type is unique.
Version. A number derived from the genesis hash and the cluster's hard forks. Nodes drop shreds whose version does not match their own, which keeps traffic from another cluster, or from before a hard fork, out of the ledger.
FEC set index. The index of the first data shred in this shred's erasure batch. Every shred of a batch, coding shreds included, carries the same value, so slot plus FEC set index names the batch. In current Agave every batch holds 32 data shreds and 32 coding shreds, so this field steps 0, 32, 64 and so on through a slot. FEC sets explains what the batch is for.
How do I read the variant byte?#
The variant byte has had two encodings over Solana's history, and the source defines both.
Legacy shreds used the whole byte as a type tag: 0xA5 (binary 1010 0101) for data and 0x5A (binary 0101 1010) for coding. These values are still defined in current source as the shred type tags.
Merkle shreds split the byte in two. The high four bits name the variant and the low four bits hold the proof size, the number of entries in the shred's Merkle proof. The Agave v2.0 branch lists six high nibbles:
| High nibble | Variant |
|---|---|
0x4 | Merkle coding |
0x6 | Merkle coding, chained |
0x7 | Merkle coding, chained and resigned |
0x8 | Merkle data |
0x9 | Merkle data, chained |
0xB | Merkle data, chained and resigned |
"Chained" means the shred also carries the Merkle root of the previous batch. "Resigned" means it reserves 64 bytes at the end for a retransmitter's signature. Release v4.4.1 accepts only the chained forms, 0x6, 0x7, 0x9 and 0xB, and rejects the legacy tags and the unchained nibbles. A standard 32 plus 32 batch has a proof of 6 entries, so the bytes you will see most are 0x66 and 0x96, with 0x76 and 0xB6 on the last batch of a slot.
A tolerant parser checks the high nibble rather than exact byte values, since the proof size depends on the batch shape.
What comes after the common header?#
A data shred continues with:
parent_offset(u16, bytes 83 to 84): how many slots back the parent block is. The parent slot isslot - parent_offset.flags(u8, byte 85): the low six bits hold the reference tick, which under Tower BFT counted the ticks that had passed in the slot when the leader made this shred. Data shreds still carry a reference-tick field, but under Alpenglow it no longer measures time within the slot. Bit0x40marks the end of a run of shreds whose joined data can be deserialized on its own, and0xC0marks the last data shred of the slot, which sets both top bits.size(u16, bytes 86 to 87): where the entry data in this shred ends, counted from the start of the payload, headers included.
A coding shred continues with three u16 values: num_data_shreds (bytes 83 to 84), num_coding_shreds (85 to 86) and position (87 to 88), this shred's place among the batch's coding shreds.
Agave sizes a data shred payload at 1,203 bytes and a coding shred payload at 1,228 bytes. The body after the headers holds entry data or parity, then the Merkle material that the variant byte describes.
What does a minimal parser look like?#
This Python function reads both headers. It was tested against crafted data and coding shreds of 1,203 and 1,228 bytes.
1import struct23def parse_header(buf: bytes) -> dict:4if len(buf) < 89:5raise ValueError("too short for a shred")6variant = buf[64]7slot, index, version, fec_set_index = struct.unpack_from("<QIHI", buf, 65)8high = variant & 0xF09if variant == 0xA5 or high in (0x80, 0x90, 0xB0):10kind = "data"11parent_offset, flags, size = struct.unpack_from("<HBH", buf, 83)12extra = {"parent": slot - parent_offset, "flags": flags, "size": size}13elif variant == 0x5A or high in (0x40, 0x60, 0x70):14kind = "coding"15num_data, num_coding, position = struct.unpack_from("<HHH", buf, 83)16extra = {"num_data": num_data, "num_coding": num_coding, "position": position}17else:18raise ValueError(f"unknown variant {variant:#04x}")19return {"kind": kind, "variant": hex(variant), "slot": slot, "index": index,20"version": version, "fec_set_index": fec_set_index, **extra}
For a receiver loop around this, with checks for short datagrams, see the guide to parsing the shred header.
Questions#
Why does a coding shred have an index if it carries no block data?#
The index numbers coding shreds within the slot, on a counter separate from data shreds. Receivers use slot, index and type together to store each shred once and to spot duplicates.
Is the header covered by the signature?#
Yes, indirectly. The leader signs the batch's Merkle root, and each shred's leaf in that tree is a hash over everything after the signature up to the Merkle proof, so changing any header byte breaks verification.
Why is the shred version not the software version?#
It identifies the cluster and its fork history, not the validator release. All nodes on a cluster share one shred version until a hard fork changes it.
Sources#
- SIMD-0384: Alpenglow migration (PoH deprecation) (checked 2026-11-17)
- Agave v4.4.1 source: ledger/src/shred.rs (header structs and variant byte) (checked 2026-11-17)
- Agave v4.4.1 source: ledger/src/shred/wire.rs (byte offsets) (checked 2026-11-17)
- Agave v4.4.1 source: ledger/src/shred/merkle.rs (payload sizes) (checked 2026-11-17)
- Agave v2.0 branch source: ledger/src/shred.rs (legacy and unchained variants) (checked 2026-11-17)
- Agave master source: ledger/src/shred.rs (field documentation) (checked 2026-11-17)
- Solana docs: Transactions (64-byte Ed25519 signatures) (checked 2026-11-17)