# Delivery format

Read the Solana shred headers, data flags and payload offsets delivered over UDP

Source: https://zerocopy.sh/docs/shredstream/format

Each UDP datagram carries one raw Solana shred, unchanged, up to 1,228 bytes.
Shredstream forwards chained Merkle data and coding shreds for the cluster's current
shred version. ZeroCopy does not check the leader's signature before forwarding.
[Verify it](/docs/shredstream/processing#verify-the-leader-signature) before accepting the shred.

## Common header [#common-header]

Offsets and sizes are in bytes from the start of the datagram. Integers wider than
one byte use little endian encoding. The common header is 83 bytes.

| Field | Offset | Size | Meaning |
| --- | --- | --- | --- |
| `signature` | 0 | 64 | Leader signature |
| `shred_variant` | 64 | 1 | Shred type and Merkle variant |
| `slot` | 65 | 8 | Slot containing the shred |
| `index` | 73 | 4 | Shred index within its type in the slot |
| `version` | 77 | 2 | Shred version |
| `fec_set_index` | 79 | 4 | Identifier of the FEC set within the slot |

## Data shred header [#data-shred-header]

The data header follows the common header, and the payload starts at byte 88.

| Field | Offset | Size |
| --- | --- | --- |
| `parent_offset` | 83 | 2 |
| `flags` | 85 | 1 |
| `size` | 86 | 2 |

The `flags` byte uses Agave's values:

| Value | Meaning |
| --- | --- |
| `0x40` | Data complete: the shred ends a batch of entries |
| `0xc0` | Last in slot: set with data complete on the slot's last data shred; test `(flags & 0xc0) == 0xc0` |

The low six bits hold the reference tick.

## Coding shred header [#coding-shred-header]

The coding header follows the common header, and the payload starts at byte 89.

| Field | Offset | Size |
| --- | --- | --- |
| `num_data_shreds` | 83 | 2 |
| `num_coding_shreds` | 85 | 2 |
| `position` | 87 | 2 |

With `slot` and `fec_set_index`, these fields let you group each FEC set and
[recover missing data shreds](/docs/shredstream/processing#recover-data-shreds). Decode entries and
transactions from the result with a Merkle shred decoder.
