Transaction Anatomy

Key Elements

Important

Signature
A 64 bytes long digital signature in the ed25519 format that verifies the authenticity and integrity of a transaction.

Account
A record in the Solana ledger that serves as a storage space for user data or an executable program.

Compact Array
An array-like data structure that starts with a 16-bit encoded array length, followed by the array elements.

Blockhash
A unique hash that identifies a block produced as a part of the Proof of History algorithm.

Program ID
The public key of an account that stores a compiled program on the blockchain.

Instruction
A command that specifies the Program ID to be executed, the accounts involved, and additional data that the program can use to determine the action to be performed.

Transaction Anatomy

Solana transactions consist of two major parts in the following order:

  • A compact array of signatures.
  • A message that contains a compact array of account addresses, a recent blockhash and a compact array of instructions.

Transaction Anatomy

Signatures

For each signature in the compact array, the Solana verifies two conditions:

  • The number of signatures must match the first 8 bits of the message header.
  • Each signature is validated against the corresponding public key at the same index in the account addresses array.

Message Layout

Message Layout

1. Header

  • Number of required signatures in the transaction (8 bits).
  • Number of read-only accounts requiring signatures (8 bits).
  • Number of read-only accounts not-requiring signatures (8 bits).

2. Accounts

  • Addresses that require signatures with read-write access.
  • Addresses that require signatures with read-only access.
  • Addresses that do not require signatures with read-write access.
  • Addresses that do not require signatures with read-only access.

3. Recent blockhash

  • Ensures transaction lifetime

    Transaction is deemed invalid if the blockhash is older than 150 blocks (approximately 1 minute).

  • Prevents transaction replay

    By tying each transaction to a unique recent blockhash, Solana ensures that identical transactions cannot be processed more than once.

4. Instructions with the following anatomy:

  • Program ID index.
  • Compact-array of account address indices.
  • Compact-array of opaque 8-bit data (what operations to perform and any additional data).

Instruction Anatomy