A Solana transaction is a list of signatures followed by the message they sign. The message holds a three-byte header, the account keys, a recent blockhash and the instructions, each instruction pointing into the key list by index. In the legacy and v0 formats every length is a compact-u16, so you read the bytes front to back.
Two parts: the signatures and the message they sign#
Every legacy or v0 transaction starts with a count of signatures, then that many 64-byte Ed25519 signatures, then the message. The signatures are made over the message bytes exactly as they appear on the wire, which is why a decoder must never reformat the message before checking or hashing it.
Signature number one is the fee payer's, and it also serves as the identifier everyone uses for the transaction. The page on signatures as transaction IDs explains why that one is the ID.
The newer v1 format moves the signatures to the end, after the message. Everything below describes legacy and v0, which still make up much of each block.
The message header: three counts that assign roles#
The message opens with three single-byte counts:
- how many signatures the message requires;
- how many of the signing accounts are read only;
- how many of the non-signing accounts are read only.
These three numbers, applied to the ordered key list, decide which accounts sign and which may be written. Nothing else in the transaction marks an account as writable. The account roles page shows how to compute each role from the header.
A v0 message puts one extra byte before the header, 0x80, whose top bit says "this is a versioned message, version 0". A legacy message never sets that bit, because its first byte is the required-signature count, and 128 signatures of 64 bytes each could never fit in a 1,232-byte transaction. The versioned transactions page covers that test.
Account keys#
Next comes a compact-u16 count and then that many 32-byte public keys. The order is fixed: signers that may be written, then read-only signers, then writable non-signers, then read-only non-signers. The fee payer is always first.
Program IDs live in this same list. A transfer through the System program lists 11111111111111111111111111111111 as one of its keys, just like any account. Turning 32 raw bytes into the familiar address is covered in base58 and public keys.
The recent blockhash#
After the keys sit 32 bytes of a recent blockhash. It ties the transaction to a short window of time, after which validators refuse it. One exception changes the meaning of this field: a durable nonce transaction stores a nonce value here instead, so you cannot assume the field names a recent block.
Instructions#
Then a compact-u16 count of instructions. Each instruction is:
- one byte: the index of the program in the key list;
- a compact-u16 count, then one byte per account the instruction uses, each an index into the key list;
- a compact-u16 length, then that many bytes of instruction data.
The data is opaque at this level. Its meaning belongs to the program, and the page on instruction data follows one instruction from these indexes back to real accounts.
A v0 message adds one more section after the instructions: its address table lookups. Those let the transaction use accounts that are not in the key list at all.
Compact-u16 lengths#
Lengths in the legacy and v0 formats use a compact encoding. Each byte carries seven bits of the number, low bits first, and its top bit says whether another byte follows. Values up to 127 take one byte, which is why most counts in a real transaction are a single byte.
You cannot skip to a field by fixed offset. To reach the instructions you must read the signature count, step over the signatures, read the key count and step over the keys. A transaction also carries no length of its own, so the only way to find where one ends inside an entry is to parse it.
A real transfer, byte by byte#
This is a 215-byte legacy transaction from mainnet slot 470,901,815: one SOL transfer through the System program.
| Bytes | Field | Value in this transaction |
|---|---|---|
| 0 | Signature count (compact-u16) | 1 |
| 1 to 64 | Signature | the transaction ID (given in full under Sources) |
| 65 to 67 | Header | 1 required signature, 0 read-only signers, 1 read-only non-signer |
| 68 | Key count | 3 |
| 69 to 164 | Three 32-byte keys | sender, recipient, System program |
| 165 to 196 | Recent blockhash | 32 bytes |
| 197 | Instruction count | 1 |
| 198 | Program index | 2 (the System program) |
| 199 to 201 | Account indexes | count 2, then 0 and 1 |
| 202 to 214 | Data | length 12, then 02000000 (transfer) and the amount, 43,590,000,000 lamports |
The header explains the roles without any extra flag. One required signature makes key 0 the only signer and the fee payer. One read-only non-signer makes the last key, the System program, read only. The recipient in between is writable.
Why the layout matters when you decode from shreds#
An entry stores its transactions end to end, with nothing marking where one stops. Your parser therefore has to understand every field just to find where the next transaction starts, and one mistake shifts everything that follows in the entry. Building that parser is the first real stage of the decoding pipeline.
The bytes you hold are also the transaction exactly as the sender built it: no parsed fields, no resolved addresses, no outcome. That is the starting point, not the result.
Questions about the layout#
Is the recent blockhash the block the transaction landed in?#
No. It names a block the sender saw shortly before sending, and it limits how long the transaction stays valid. The slot it landed in comes from the block you decoded it from.
How big can a transaction be?#
A legacy or v0 transaction fits in 1,232 bytes. The v1 format raises the limit to 4,096 bytes.
Where are the account addresses for a v0 transaction?#
Partly in the key list and partly in lookup tables, which the transaction references by index. Address lookup tables explains what you need to resolve them.
What the transaction itself cannot tell you#
The transaction is a request. It does not say whether it succeeded, what the programs logged or which other programs they called. A decoder that starts from shreds sees only these fields, so anything about results has to come from a source that ran the block.
Next: versions and your first decode#
Continue with how Solana versions its transactions, then decode your first transaction from raw shreds. The shred decoder documentation has a recipe for each language.
Sources#
- Solana docs: transactions (checked 2026-11-18)
- anza-xyz/solana-sdk message crate: legacy and versioned messages (checked 2026-11-18)
- SIMD-0385 Transaction V1 Format (checked 2026-11-18)
- Example transaction 373S6VB5N69t8cBPf8EoW5Ks95kTafQ2UNrUNkvH3MtWTbRMG4ePQGtJt73DscfEQtageiRviSCBXsXc3JTNmKWy, slot 470,901,815 (mainnet getBlock) (checked 2026-11-18)
Raw shreds on your own server
Ultra Low Latency Shreds is $200 and Standard Shreds is $100. You pay in crypto, tell us which IPv4 address and UDP port should receive the stream, and we wire it up by hand.