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

Each UDP payload represents exactly one raw Solana shred. Datagram length may not exceed 1,228 bytes under shredstream.sh. Actual length varies by role and variant, so parsing uses the returned length plus the selected format.

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

For current data variants, bytes 83 through 87 form the role-specific header, making byte 88 its exclusive end.

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.

Do not interpret the size field as total datagram length. Padding, chained-root material, Merkle proof nodes, or a retransmitter signature may follow the declared ledger data.

Coding header

Current coding variants place their role header at bytes 83 through 88, with 89 as the exclusive end.

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

For a coding shred, add k to position to obtain its erasure-shard location. That local array location differs from the global coding index. Subtract position from coding index to derive the first coding index.

The common current target pairs 32 data shreds with 32 coding members per FEC set. Final sets may contain fewer members. Allocate from sanitized k and m instead of treating the illustrated 32-plus-32 layout as permanent.

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 dispatches format and must not be decoded through a guessed mask. In current Merkle forms, its lowest four bits carry proof-entry count while other bits select role and flags. The matching Agave release defines valid discriminants and combinations.

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

Each role owns an independent index space. A deduplication key containing only slot and numeric index can wrongly discard the valid member from the other role.

FEC consistency checks

Admission to one recovery set requires agreement on slot, cluster shred version, FEC-set index, data count, coding count, protected shard size, compatible variant, and authenticated Merkle context when present. Coding members must imply one first coding index. Reconstructed data then undergoes every structural and authentication check applied to direct arrivals.

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

Resolve the expected verification key through the trusted schedule entry for that slot's leader. Matching source IP, plausible slot, or correct cluster shred version cannot establish authenticity.

Deshredding boundary

Concatenate only sanitized data slices, following data-index order across the applicable completed range. A parser's accessor excludes headers, padding, proof nodes, chain roots, and every retransmitter signature.

Completion flags mark boundaries but cannot fill an earlier incomplete range. Even a slot-final flag leaves a gap when required data is absent and FEC recovery has not succeeded.

Fail-closed parser order

  1. Reject any received datagram longer than the 1,228-byte ceiling.
  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. 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.
Which fields form a shred identity?
Inside a trusted cluster context, combine slot, role, and that role's index. Data and coding use distinct numeric spaces, so slot plus a number is insufficient. Persistent multi-cluster systems also need a trusted cluster identifier because the header's 16-bit version can collide across unrelated 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.