Skip to content
SummaryA transaction has signatures + a message. The message contains a header, account addresses, recent blockhash, and compiled instructions. Max serialized size: 1,232 bytes (4,096 bytes for the v1 format).
A Transaction has two top-level fields:
  • signatures: An array of signatures
  • message: Transaction information, including the list of instructions to be processed
Transaction
A transaction is its signatures plus the message they sign.A transaction is its signatures plus the message they sign.
A transaction is its signatures plus the message they sign.
The total serialized size of a transaction must not exceed PACKET_DATA_SIZE (1,232 bytes). This limit equals 1,280 bytes (the IPv6 minimum MTU) minus 48 bytes for network headers (40 bytes IPv6 + 8 bytes fragment header). The 1,232 bytes include both the signatures array and the message struct.
v1 transactions raise the limit to 4,096 bytesThis page describes the legacy transaction format, which the v0 format also follows apart from its version prefix and address lookup tables. The v1 format raises the size limit to 4,096 bytes and uses a different wire layout.
Signatures and message together must fit in one 1,232-byte packet.Signatures and message together must fit in one 1,232-byte packet.
Signatures and message together must fit in one 1,232-byte packet.

​Signatures

The signatures field is a compact-encoded array of Signature values. Each Signature is a 64-byte Ed25519 signature of the serialized Message, signed with the signer account’s private key. One signature is required for every signer account referenced by the transaction’s instructions. Each signature is produced by a private key. Where that key lives — a local keypair, a cloud HSM or KMS, or a managed wallet service — is a production design decision. See Signing in Production. The first signature in the array belongs to the fee payer, the account that pays the transaction base fee and prioritization fee. This first signature also serves as the transaction ID, used to look up the transaction on the network. The transaction ID is commonly referred to as the transaction signature. Fee payer requirements:
  • Must be the first account in the message (index 0) and a signer.
  • Must be a System Program-owned account or a nonce account (validated by validate_fee_payer).
  • Must hold at least the total fee (for a nonce account, the fee plus the account’s rent-exempt minimum); otherwise the transaction fails with InsufficientFundsForFee.
  • Must not drop from rent-exempt to rent-paying when the fee is deducted: a rent-exempt fee payer must stay at or above its rent-exempt minimum, or be drained to exactly 0 lamports. Otherwise the transaction fails with InsufficientFundsForRent.

​Message

The message field is a Message struct containing the transaction’s payload:
  • header: The message header
  • account_keys: An array of account addresses required by the transaction’s instructions
  • recent_blockhash: A blockhash that acts as a timestamp for the transaction
  • instructions: An array of instructions
Message
The header field is a MessageHeader struct with three u8 fields that partition the account_keys array into permission groups:
  • num_required_signatures: Total number of signatures required by the transaction.
  • num_readonly_signed_accounts: Number of signed accounts that are read-only.
  • num_readonly_unsigned_accounts: Number of unsigned accounts that are read-only.
MessageHeader
Legacy and versioned message prefixesIn a legacy transaction message, the first message byte is num_required_signatures, followed by the other two MessageHeader bytes. In a versioned transaction message, the first byte is a version prefix instead; the three-byte MessageHeader starts immediately after that prefix. See versioned transactions for the full v0 and v1 message layouts.
The header's three counts give every account in account_keys its permissions.The header's three counts give every account in account_keys its permissions.
The header's three counts give every account in account_keys its permissions.

​Account addresses

The account_keys field is a compact-encoded array of public keys. Each entry identifies an account used by at least one of the transaction’s instructions. The array must include every account and must follow this strict ordering:
  1. Signer + Writable
  2. Signer + Read-only
  3. Non-signer + Writable
  4. Non-signer + Read-only
This strict ordering allows the account_keys array to be combined with the three counts in the message’s header to determine the permissions for each account without storing per-account metadata flags. The header counts partition the array into the four permission groups listed above.
Account addresses are ordered by permission; the header counts mark the boundaries.Account addresses are ordered by permission; the header counts mark the boundaries.
Account addresses are ordered by permission; the header counts mark the boundaries.

​Recent blockhash

The recent_blockhash field is a 32-byte hash that serves two purposes:
  1. Timestamp: proves the transaction was created recently.
  2. Deduplication: prevents the same transaction from being processed twice.
A blockhash expires after 150 blocks, about 30 seconds at 200ms slots. If the blockhash is no longer valid when the transaction arrives, it is rejected with BlockhashNotFound, unless it is a valid durable nonce transaction.
The getLatestBlockhash RPC method allows you to get the current blockhash and last block height at which the blockhash will be valid.

​Instructions

The instructions field is a compact-encoded array of CompiledInstruction structs. Each CompiledInstruction references accounts by index into the account_keys array rather than by full public key. It contains:
  1. program_id_index: Index into account_keys identifying the program to invoke.
  2. accounts: Array of indices into account_keys specifying the accounts to pass to the program.
  3. data: Byte array containing the instruction discriminator and serialized arguments.
CompiledInstruction
Each compiled instruction names its program and accounts by index into account_keys.Each compiled instruction names its program and accounts by index into account_keys.
Each compiled instruction names its program and accounts by index into account_keys.

​Transaction binary format

Transactions are serialized using a compact encoding scheme. All variable-length arrays (signatures, account keys, instructions) are prefixed with a compact-u16 length encoding. This format uses 1 byte for values 0-127 and 2-3 bytes for larger values. Legacy transaction layout (on the wire):
FieldSizeDescription
num_signatures1-3 bytes (compact-u16)Number of signatures
signaturesnum_signatures x 64 bytesEd25519 signatures
num_required_signatures1 byteMessageHeader field 1
num_readonly_signed1 byteMessageHeader field 2
num_readonly_unsigned1 byteMessageHeader field 3
num_account_keys1-3 bytes (compact-u16)Number of static account keys
account_keysnum_account_keys x 32 bytesPublic keys
recent_blockhash32 bytesBlockhash
num_instructions1-3 bytes (compact-u16)Number of instructions
instructionsvariableArray of compiled instructions
Each compiled instruction is serialized as:
FieldSizeDescription
program_id_index1 byteIndex into account keys
num_accounts1-3 bytes (compact-u16)Number of account indices
account_indicesnum_accounts x 1 byteAccount key indices
data_len1-3 bytes (compact-u16)Length of instruction data
datadata_len bytesOpaque instruction data

​Size calculation

Given PACKET_DATA_SIZE = 1,232 bytes, the available space can be calculated:

​Example: SOL transfer transaction

The diagram below shows how transactions and instructions work together to allow users to interact with the network. In this example, SOL is transferred from one account to another. The sender account’s metadata indicates that it must sign for the transaction. This allows the System Program to deduct lamports. Both the sender and recipient accounts must be writable, in order for their lamport balance to change. To execute this instruction, the sender’s wallet sends the transaction containing its signature and the message containing the SOL transfer instruction.
The sender signs; the instruction lists the sender as a writable signer and the receiver as writable.The sender signs; the instruction lists the sender as a writable signer and the receiver as writable.
The sender signs; the instruction lists the sender as a writable signer and the receiver as writable.
After the transaction is sent, the System Program processes the transfer instruction and updates the lamport balance of both accounts.
The System Program debits the sender and credits the receiver.The System Program debits the sender and credits the receiver.
The System Program debits the sender and credits the receiver.
Verify the recipient before sending SOLA System Program transfer adds lamports to any account. There is no protocol-level check that the recipient can move the SOL back out. Lamports can only be moved out by the account’s owning program, so sending SOL to a token mint, a program, or a PDA you don’t control risks permanent loss of funds — only an authority specified by the owning program can return them. SOL sent to a token account is recoverable only by that account’s owner, never by the sender.SPL token transfers are partly self-protecting: the Token Program rejects a transfer whose accounts don’t match the expected mint. Native SOL transfers have no such guard, so the sender must verify the recipient before signing. See Verify Address for the full classification logic.
The example below shows the code relevant to the above diagrams. See the System Program’s transfer function.
The Rust tab needs solana-sdk 4.x, which matches the current solana-client. With the latest solana-sdk (5.x), the transaction type no longer matches the one solana-client expects. Install the dependencies with:
The following example shows the structure of a transaction that contains a single SOL transfer instruction.
The code below shows the output from the previous code snippets. The format differs between SDKs, but notice that each instruction contains the same required information.

​Verify the recipient before transferring

Because a SOL transfer succeeds into any account, check the recipient before signing. Fetch the account and only send to a System Program wallet (or an unfunded on-curve address); reject mints, token accounts, programs, and PDAs you don’t control.
Kit
This snippet checks native SOL recipients. For the full classification that also handles SPL token sends (token accounts, ATAs, Token-2022), see Verify Address.

​Fetching transaction details

After submission, retrieve transaction details using the transaction signature and the getTransaction RPC method.
You can also find the transaction using Solana Explorer.
Transaction Data
The raw response identifies accounts by index and stores inner (CPI) instructions as encoded blobs. To resolve these into addresses and walk the full instruction tree, see Transaction Introspection.