Skip to content
Back
Reference

Solana shred format reference

Map common, data, coding, legacy, and Merkle shred regions by byte range while keeping variant-dependent capacity explicit.

Wire unit

One UDP datagram contains one raw Solana shred. shredstream.sh permits datagrams up to 1,228 bytes and measured a 1,216-byte mean on 2026-08-31. The mean is not a fixed packet size. Parse using the received datagram length and the selected shred variant.

All multibyte integer fields in the headers below are little-endian. Byte ranges use a start-inclusive, end-exclusive convention.

Common header

The current common header is 83 bytes.

RangeWidthFieldTypeMeaningValidation
0..6464signatureEd25519 signature bytesLeader authentication materialVerify with the scheduled leader and the variant-specific signed message
64..651variantVariant discriminatorSelects data or coding, legacy or Merkle, proof size, and Merkle flagsDispatch before reading variant-dependent regions
65..738slotUnsigned 64-bit little-endianSlot for which the shred was producedCheck against the active cluster and accepted slot horizon
73..774indexUnsigned 32-bit little-endianIndex inside the data or coding index spaceInclude shred type in identity
77..792versionUnsigned 16-bit little-endianCluster-lineage shred versionCompare with trusted cluster configuration
79..834fec_set_indexUnsigned 32-bit little-endianFirst data index of the FEC setGroup only metadata-compatible members

The minimal safe read for the common header is 83 bytes. Reject a shorter datagram before accessing any common field.

Data header

The current data header follows the common header and ends at byte 88.

RangeWidthFieldTypeMeaningValidation
83..852parent_offsetUnsigned 16-bit little-endianDifference between slot and parent slotOffset cannot imply an impossible parent
85..861flagsBit fieldReference tick and completion stateAccept only defined bits
86..882sizeUnsigned 16-bit little-endianEnd of common header, data header, and ledger dataMust be at least 88 and no greater than the variant permits or the received length

Data flags

BitsNameMeaning
0..5Reference tickSaturating reference-tick value
6DATA_COMPLETE_SHREDThe shred completes the current data unit
7 together with bit 6LAST_SHRED_IN_SLOTThe shred is the final data shred in the slot and is also data complete

The value 0x40 marks data complete. The value 0xC0 marks last in slot and therefore also data complete. A parser should use the bit definitions from its pinned client release rather than accept unknown combinations.

The size field is not the UDP datagram length. Bytes can remain after the declared ledger data for padding, chained-root material, Merkle proof nodes, or a retransmitter signature.

Coding header

The current coding header follows the common header and ends at byte 89.

RangeWidthFieldTypeMeaningValidation
83..852num_data_shredsUnsigned 16-bit little-endianNumber of data shards, kMust agree across the FEC set
85..872num_coding_shredsUnsigned 16-bit little-endianNumber of parity shards, mMust agree across the FEC set
87..892positionUnsigned 16-bit little-endianLocal coding position from 0 through m minus 1Must be less than m

The coding shred’s erasure-shard position is k plus position. Its global coding index is not that local array position. The first coding index can be derived as coding index minus position.

The common current target is 32 data and 32 coding shreds in an FEC set. A final set can be shorter. Allocate from sanitized k and m rather than treating 32 plus 32 as an eternal packet rule.

Variant families

FamilyRoleAuthentication and layout consequence
Legacy dataCarries serialized ledger bytesUses the legacy signed-data rule and has no Merkle proof trailer
Legacy codingCarries Reed-Solomon parityUses the legacy signed-data rule and legacy coding layout
Merkle dataCarries serialized ledger bytesCarries proof material used to reconstruct the leader-signed Merkle root
Merkle codingCarries Reed-Solomon parityCarries proof material for the coding shard’s position in the FEC Merkle tree
Chained Merkle dataData plus chain commitmentAdds the preceding-root commitment defined by the variant
Chained Merkle codingParity plus chain commitmentAdds the same chain relation for a coding member
Retransmitter-signed Merkle dataMerkle data plus retransmitter evidenceAdds a trailing retransmitter signature without replacing the leader signature
Retransmitter-signed Merkle codingMerkle coding plus retransmitter evidenceAdds a trailing retransmitter signature without replacing the leader signature

The variant byte is a dispatch value, not a field to decode with a guessed mask. Current Merkle forms encode proof-entry count in the low four bits and use other bits for role and flags. Exact valid discriminants and flag combinations belong to the matching Agave release.

Merkle-dependent regions

Logical regionPresent whenPurposeSize rule
Erasure shardEvery FEC memberReed-Solomon input or parityDerived by the typed variant
Chained Merkle rootChained variantCommits to the preceding FEC set rootFixed by the matching implementation
Merkle proof nodesMerkle variantReconstructs the root for this shard positionProof count comes from the variant
Retransmitter signatureRetransmitter-signed variantAuthenticates retransmission evidenceFixed signature width at the variant-defined tail
PaddingWhere construction requires itFills the protected shard layoutNever expose as ledger data

There is no one valid proof offset for all packets. Data or coding role, proof depth, chain presence, retransmitter signature presence, and payload capacity all affect the boundary. Use typed accessors from the pinned implementation.

Identity and ordering keys

PurposeKey
Exact shred identityCluster context, slot, shred type, index
FEC-set groupingCluster context, slot, fec_set_index, compatible variant family
Data orderingSlot, data index
Coding orderingSlot, coding index
Duplicate conflict evidenceIdentity plus canonical received bytes
Persistent multi-cluster keyTrusted cluster identifier plus shred identity

Data and coding indices occupy separate spaces. Deduplicating on slot and index alone can discard a valid member of the other type.

FEC consistency checks

Every member admitted to one recovery set must agree on slot, cluster shred version, FEC-set index, data count, coding count, protected shard size, variant compatibility, and authenticated Merkle context where present. Coding members must imply the same first coding index. A recovered data shred must pass the same structural and authentication checks as a received data shred.

Do not append coding payload to ledger bytes. Coding shreds exist to reconstruct missing data members.

Signed material

FamilyLeader authentication rule
LegacyVerify the signed data returned by the matching typed implementation
MerkleReconstruct the Merkle root for the shard and verify the leader signature over that root
Retransmitter-signed MerklePreserve and verify the leader-authenticated root; handle the extra retransmitter signature under its separate rule

The expected public key comes from the scheduled leader for the slot. A matching source IP, plausible slot, or correct cluster shred version does not prove authenticity.

Deshredding boundary

Only sanitized data bytes are concatenated, in data-index order, across the applicable completed range. The parser’s data accessor must exclude headers, padding, proof nodes, chained roots, and retransmitter signatures.

Completion flags describe boundaries. They do not make an incomplete earlier range appear. A last-in-slot flag without all required data or successful FEC recovery still leaves a gap.

Fail-closed parser order

  1. Check the received datagram length against the 1,228-byte product maximum.
  2. Check enough bytes exist for the common header.
  3. Read and dispatch the variant.
  4. Read common fields with checked slices.
  5. Compare the cluster shred version.
  6. Parse the data or coding header.
  7. Validate sizes, indices, counts, flags, and proof layout.
  8. Resolve the scheduled leader.
  9. Verify legacy signed data or the Merkle root.
  10. Admit the packet to duplicate, ordering, and FEC state.

Unknown variants and impossible lengths are explicit rejections. Falling back to a legacy layout can turn proof bytes into plausible application data.

Questions

Is every Solana shred 1,228 bytes?
No. 1,228 bytes is the maximum datagram size in the shredstream.sh wire contract, while 1,216 bytes is a measured mean. Useful data capacity varies with shred role, Merkle proof depth, chain material, retransmitter-signature presence, and padding. Use the received length and a variant-aware parser.
What uniquely identifies a shred?
Within one trusted cluster context, use slot, shred type, and index. Data and coding shreds have separate index spaces, so slot plus index is insufficient. Persistent multi-cluster systems also need a trusted cluster identifier because the 16-bit shred version can collide across unrelated cluster lineages.
Can a parser use fixed offsets for Merkle proof data?
No single proof offset covers every variant. The boundary depends on data or coding role, proof-entry count, chain presence, retransmitter signature, protected shard layout, and declared data size. Dispatch the variant, sanitize it with the matching Agave implementation, and use typed accessors for proof and data regions.