Compute Unit
A compute unit is a measurement used by Solana to represent the computational work required to process a transaction or execute program instructions. The term may also be used by Solana data providers such as Solscan as a usage-based billing measure for API calls, with more expensive endpoints consuming more units.
✦ Key Insight
Compute units help Solana manage limited processing resources. Complex transactions, such as swaps involving several programs, generally require more computational work than simple SOL transfers. For users, compute usage can affect priority-fee calculations and whether a transaction remains within its permitted compute limit. For developers and API users, understanding compute-unit billing helps control costs and select efficient endpoints.
✕ Common Misconceptions
Confusing blockchain compute units with API billing units
Setting the transaction limit too low
Requesting excessive compute without understanding fee impact
Assuming every Solana instruction costs the same amount
Ignoring compute-related errors in failed transactions
Detailed Explanation
How It Works
A transaction consumes compute units as its instructions are executed. The sender may specify:
A maximum compute-unit limit
A price paid per compute unit
Program instructions requiring different amounts of work
If a transaction exceeds its compute limit, it may fail. Increasing the limit can provide more capacity, but requesting excessive compute may increase the priority fee.
In an API billing context, the provider assigns different compute-unit costs based on the complexity and resource demand of each endpoint.
FAQs
Are compute units the same as gas?
They are conceptually related because both measure transaction work, but their fee mechanisms differ.
Does using more compute always make a transaction faster?
No. Compute capacity and transaction priority are related but not identical.
Why do API providers use the same term?
It provides a usage-based way to price calls according to endpoint cost.
In Practice
Dig Deeper
Smart Contract
A smart contract is self-executing code stored on a blockchain that automatically performs actions when certain conditions are met.
Transaction Signature
A transaction signature is the unique identifier assigned to a transaction on the Solana blockchain. It serves a similar purpose to a transaction hash on Ethereum and many other blockchains.
Priority Fee
A priority fee is an optional additional transaction fee that a user can pay to improve a transaction’s chance of being processed quickly during network congestion. On Solana, priority fees are associated with the computational resources requested by a transaction.
