What Is Compute Unit in Solana?
A compute unit (CU) is the smallest unit of computational work on Solana. Every instruction in a transaction consumes compute units, and each transaction has a compute unit limit. If the limit is exceeded, the transaction fails with ComputationalBudgetExceeded.
Key numbers
| Limit | Value |
|---|---|
| Default per instruction | 200,000 CU |
| Maximum per transaction | 1,400,000 CU |
| Block limit | 48,000,000 CU |
Why compute units matter
- Priority fees. The total priority fee =
computeUnitPrice * computeUnitsConsumed / 1,000,000. Lower CU usage means lower fees. - Block packing. Validators fit transactions into blocks up to the block compute limit. Tighter CU budgets make your transaction easier to include.
Setting compute limits
Use the setComputeUnitLimit instruction from the Compute Budget program to set an explicit limit. Without it, each instruction defaults to 200,000 CU. Simulate your transaction first to find the actual consumption, then set the limit to that value plus a small margin.
See the compute units optimization guide for detailed instructions.
Sources
Updated: