Compute units
Every Solana transaction runs within a compute-unit limit. The priority fee is the limit times your price, so the limit you set is part of what you pay.
Compute use by transaction type
Measured rows: median and 90th percentile of computeUnitsConsumed over transactions of each program in the latest sampled blocks. Source rows: 150 CU for the System program and 150 CU per compute-budget instruction (agave); token transfers after the p-token upgrade (SIMD-0266): Transfer 186, TransferChecked 218 CU, against 4,645 and 6,200 before.
Limits
- Maximum per transaction1,400,000 CU
- Default per program instruction200,000 CU
- Default per builtin instruction3,000 CU
- Priority fee⌈limit × price ÷ 10⁶⌉ lamports
- Unused unitsnot refunded
import { ComputeBudgetProgram } from "@solana/web3.js";
tx.add(
ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }),
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 10_000 }),
);
// priority fee: 2,000 lamportsFAQ
What is the maximum compute-unit limit on Solana?
1,400,000 compute units per transaction (MAX_COMPUTE_UNIT_LIMIT in the agave runtime).
What limit applies if I do not set one?
200,000 per program instruction and 3,000 per builtin instruction (SIMD-0170), capped at 1,400,000. With a priority price, the fee is charged on that default limit.
Are unused compute units refunded?
No. The priority fee is calculated from the limit you request, not from the units consumed. Setting the limit close to the real use is the cheapest way to pay a given price.
How do I find out how many units my transaction uses?
Simulate it (simulateTransaction returns unitsConsumed), or look up a past transaction: its metadata contains computeUnitsConsumed. Add a margin of 10–20 % for inputs that make the program work harder.
Simulate a transactionWhat did my transaction pay?Fee calculator