Canonical: https://solanashreds.xyz/blog/order-inside-a-slot

# Order inside a slot: what entry order tells you

A Solana block is an ordered list of entries, and each entry is an ordered list of transactions. Flatten the two and you have the block's transaction order, but only once you hold every piece of the slot.

Solana transaction order in a slot is the leader's order: entries in sequence, and transactions in sequence inside each entry. Number them by walking the entries from the start of the slot and you get the block's transaction index. That number is only final once every earlier data shred of the slot has arrived.

## Where the order comes from

The leader builds a block as a stream of entries. Each entry holds a hash and a list of signed transactions, in the order the leader put them there. Since Alpenglow, the bytes of a deshredded block open with a marker that names the parent slot and block id, continue with batches of entries, each batch preceded by an eight byte count, and close with a footer marker. Proof of history is deprecated, leaving one tick at the end of each block, yet the entries still carry the transactions in order.

So the order is not something a decoder infers. It is written into the data: the position of an entry in the slot, and the position of a transaction in its entry.

## Turning entries into a transaction index

1. Collect data shreds for the slot and order them by shred index. The index defines where each payload sits in the slot's byte stream.
2. Concatenate the payloads from index zero onward, recovering missing data shreds from coding shreds where you can.
3. Read the block components in order, skipping the markers, and read the entries from each batch.
4. Walk the entries in order, and inside each entry walk its transactions in order, assigning a counter that starts at zero for the slot.
5. Store that counter as the transaction's index in the block, next to the slot and the first signature.

## Order before the slot is complete

Shreds do not always arrive in index order, and some may be missing for a while. You can assign a final index to a transaction only when every data shred before it has arrived or been recovered, because you need the full byte stream up to that point to count what came earlier.

In practice that gives you two kinds of knowledge during the slot:

- **A settled prefix:** from index zero up to the first gap, every transaction has its final position.
- **Fragments after the gap:** transactions you can decode and order relative to each other, but whose absolute index is unknown until the gap fills.

A design that needs positions early should store the relative order of fragments and fill in absolute indexes later, rather than guessing. Under Alpenglow a slot can also be skipped entirely, in which case none of its order counts.

## Matching your index to RPC

The getBlock RPC method returns a slot's transactions as one list. Treat its position in that list as the reference, and test that your flattened entry order produces the same sequence on recorded slots before you rely on it. A mismatch almost always points at a flattening bug: a skipped batch, a marker read as an entry, or a recovered shred placed wrongly.

Key rows on slot plus index for ordering, and on the first signature for identity. [Slot versus block height](https://solanashreds.xyz/learn/slot-vs-block-height) covers why the slot, not the height, belongs in that key, and the [reconcile guide](https://solanashreds.xyz/docs/pipeline/reconcile) checks your rows against settled blocks.

## What order is good for

- **Sandwich and backrun studies:** whether a trade sat directly before and after a victim's swap in the same block.
- **Fairness and inclusion research:** where transactions with different fees ended up.
- **Correct replays:** applying swaps to a pool model in the order the chain applied them.

Each of these is research on settled data. [Research datasets from shreds](https://solanashreds.xyz/blog/research-datasets-from-shreds) covers recording order so others can reuse it, and the [decoding pipeline](https://solanashreds.xyz/docs/decode/pipeline) shows where the counter fits among the other stages.

## What block order does not mean

Order in the block is the order the leader chose. It does not tell you when a transaction was sent, when other nodes first saw it, or why the leader placed it there. Failed transactions keep their place in the order too, so a position says nothing about success; [provisional rows](https://solanashreds.xyz/blog/provisional-rows) explains how to store early rows until the outcome is known. [Transaction structure](https://solanashreds.xyz/learn/solana-transaction-structure) covers what each ordered item contains.

## Related reading

For live order studies, the delivery path matters to how early you can see a slot fill in; [Ultra Low Latency Shreds](https://solanashreds.xyz/ultra-low-latency-shreds) describes that plan.

If you read blocks by polling rather than from the stream, [the polling and streaming comparison](https://solanashreds.xyz/compare/block-polling-vs-streaming) shows what each approach gives you to order by.
