A Solana transaction is a list of instructions executed atomically. Understanding the transaction structure — instructions, accounts, signers, compute budget — is prerequisite to building, debugging, or optimizing anything with Raydium. This page covers that structure, the limits that constrain it, and how the two fee categories (Solana network fees, Raydium protocol fees) stack in a real swap.
Transaction anatomy
A Solana transaction has three core components:- Message: the ordered list of instructions, the accounts they reference, and the recent blockhash.
- Signatures: one per signer, attesting the transaction was authorized.
- Recent blockhash: proves the transaction is recent; transactions with stale blockhashes (>150 slots old) are rejected.
Instructions
An instruction specifies:program_id— the program to invoke.accounts— the accounts (and their writable/signer flags) the program may touch.data— opaque bytes the program interprets.
ComputeBudget::SetComputeUnitLimit— raise the default CU limit.ComputeBudget::SetComputeUnitPrice— set a priority fee.- Optional
CreateAssociatedTokenAccount— create the output ATA if the user doesn’t have one. Raydium::SwapBaseInput— execute the swap.- Optional
CloseAccount— close a wrapped-SOL ATA.
raydium.trade.swap().
Accounts in transactions
Every account touched by any instruction in the transaction must be listed in the transaction’s account keys. Each account is flagged:- Signer / non-signer: must the account’s owner sign the transaction?
- Writable / read-only: can the transaction modify the account?
solana-fundamentals/account-model). CLMM swaps with multiple tick array crossings can have 20+.
Transaction size limit
Solana caps transactions at 1232 bytes including signatures, message, and headers. This is the single most common obstruction for complex transactions — Raydium’s CLMM with multi-hop routing regularly pushes against this limit. Breakdown of a typical ~1000-byte Raydium swap:Address Lookup Tables (ALTs)
ALTs let a transaction reference accounts by a 1-byte index into a published table rather than a full 32-byte pubkey. This compresses a transaction drastically:- A transaction referencing 20 accounts directly: ~640 B of pubkeys.
- Same transaction using ALTs: ~20 B of indices + ALT references.
Compute budget
Every transaction has a compute unit (CU) budget. Exceeding it terminates execution and fails the transaction.- Default: 200,000 CU per transaction.
- Maximum: 1,400,000 CU per transaction (raised via
ComputeBudget::SetComputeUnitLimit). - Per-block ceiling: 48M CU per block (protocol-level).
integration-guides/priority-fee-tuning for the full table):
Always set an explicit CU limit via
ComputeBudget; otherwise you get the 200k default, which is too low for most Raydium instructions.
Priority fees
Beyond the base transaction fee (5000 lamports per signature), validators increasingly prioritize transactions paying priority fees: a per-CU tip in microlamports.integration-guides/priority-fee-tuning for how to size this dynamically.
Instruction count and account count limits
Beyond the 1232-byte total limit:- Max accounts per transaction: 128.
- Max accounts per instruction (CPI): 64.
- Max instructions per transaction: no hard limit, bounded only by the size limit.
- Max CPI depth: 4 (a program can call another, which can call another, 4 levels deep).
Fee categories in a Raydium swap
A user swap transaction pays fees in two categories:Solana network fees
Paid to validators in SOL.- Base signature fee: 5000 lamports per signature. Almost always 1 signature = 0.000005 SOL.
- Priority fee: CU-price × CU-limit in microlamports. Varies with congestion; see
integration-guides/priority-fee-tuning.
Raydium protocol fees
Deducted from the swap amount.- Swap fee: percentage of input (CPMM 0.25% typical, CLMM 0.01%–1% per tier). Split between LPs and protocol destinations. See
ray/protocol-fees.
Example: $1000 USDC → SOL via CPMM 0.25% tier
Slippage (price impact + market move) is not a fee but affects the same bottom line.
Versioned transactions
Solana has two transaction formats:- Legacy: the original format, no ALT support.
- v0 (Versioned): supports ALTs, extensible to future versions.
Blockhash freshness
A transaction must include a blockhash from within the last ~150 slots (~60 seconds). Beyond that window, validators reject it. For retry loops, fetch a fresh blockhash on each retry:integration-guides/priority-fee-tuning for the full retry-with-escalating-fees pattern.
Parallel execution
Solana executes non-conflicting transactions in parallel on multi-core validators. Two transactions conflict if they both write the same account. Implications for Raydium:- Two swaps on the same pool can’t execute in parallel — both write the pool state.
- A swap on Pool A and a swap on Pool B execute in parallel if account lists don’t overlap.
- A read-only transaction never blocks a writer on the same account (read-only is concurrent with itself but not with writes).
Transaction confirmation levels
When submitting a transaction you pick a confirmation level:
For swap UX,
confirmed is standard. For operations handling large value (pool creation, reward top-ups), finalized is safer.
Simulation
Solana supports simulating a transaction before submitting:getBestSwapInfo to verify the chosen route actually succeeds. Simulation isn’t free — it consumes RPC capacity — but it catches errors before paying for them.
Pointers
solana-fundamentals/account-model— accounts in transactions.solana-fundamentals/pdas-and-cpis— how programs invoke each other.integration-guides/priority-fee-tuning— sizing CU limits and priority fees.ray/protocol-fees— Raydium protocol-fee structure.

