Transaction Fees

Every Solana transaction requires a transaction fee, paid in SOL. Transaction fees are split into two parts: the base fee and the prioritization fee. The base fee compensates validators for processing the transaction. The prioritization fee is an optional fee, to increase the chance that the current leader will process your transaction.

Base fee

Every transaction costs 5000 lamports per included signature. This fee is paid by the first signer on the transaction and must be paid by an account owned by the System Program. The base fee is split as follows:

  • 50% burned: Half is burned (taken out of the circulating SOL supply).
  • 50% distributed: Half is paid to the validator that processed the transaction.

Prioritization fee

A prioritization fee is an optional fee used to increase the chance that the current leader (validator) will process your transaction. The validator receives 100% of the priority fee. Prioritization fees can be set by adjusting the transaction's computation unit (CU) price and CU limit. (See the How to Use Priority Fees guide for more details on prioritization fees.)

The prioritization fee is calculated as follows:

Prioritization fee formula
Prioritization fee = CU limit * CU price

The prioritization fee is used to determine your transaction's priority, relative to other transactions. It is calculated using the following formula:

Transaction priority formula
Priority = (Prioritization fee + Base fee) / (1 + CU limit + Signature CUs + Write lock CUs)

Compute unit limit

By default, each instruction is allocated 200,000 CUs and each transaction is allocated 1.4 million CUs. You can change these defaults by including a SetComputeUnitLimit instruction in your transaction.

To calculate the appropriate CU limit for your transaction, we recommend the following steps:

  1. Estimate the required CU units by simulating the transaction
  2. Add a 10% safety margin to this estimate

The priority fee is determined by the requested compute unit limit transaction, not the actual number of compute units used. If you set a compute unit limit that's too high or use the default amount, you may pay for unused compute units.

Compute unit price

The compute unit price is an optional amount of micro-lamports paid for each requested CU. You can think of the CU price as a tip to encourage the validator to prioritize your transaction. To set the CU price, include a SetComputeUnitPrice instruction in your transaction.

The default CU price is 0, meaning the default prioritization fee is also 0.

For help determining the best CU price for your transaction, see the real-time CU price recommendation provided listed in the table below.

Example

The examples below show how to set the CU limit and CU price on a transaction using Solana SDKs.

SDKSource Code Reference
@solana/web3.js (Typescript)ComputeBudgetProgram
solana-sdk (Rust)ComputeBudgetInstruction
const limitInstruction = ComputeBudgetProgram.setComputeUnitLimit({
units: 300_000
});
const priceInstruction = ComputeBudgetProgram.setComputeUnitPrice({
microLamports: 1
});
import {
LAMPORTS_PER_SOL,
SystemProgram,
Transaction,
Keypair,
Connection,
ComputeBudgetProgram,
sendAndConfirmTransaction
} from "@solana/web3.js";
const connection = new Connection("http://localhost:8899", "confirmed");
const sender = Keypair.generate();
const recipient = new Keypair();
const airdropSignature = await connection.requestAirdrop(
sender.publicKey,
LAMPORTS_PER_SOL
);
await connection.confirmTransaction(airdropSignature, "confirmed");
// Create compute budget instructions
const limitInstruction = ComputeBudgetProgram.setComputeUnitLimit({
units: 300_000
});
const priceInstruction = ComputeBudgetProgram.setComputeUnitPrice({
microLamports: 1
});
const transferInstruction = SystemProgram.transfer({
fromPubkey: sender.publicKey,
toPubkey: recipient.publicKey,
lamports: 0.01 * LAMPORTS_PER_SOL
});
// Add the compute budget and transfer instructions to a new transaction
const transaction = new Transaction()
.add(limitInstruction)
.add(priceInstruction)
.add(transferInstruction);
const signature = await sendAndConfirmTransaction(connection, transaction, [
sender
]);
console.log("Transaction Signature:", signature);
Console
Click to execute the code.

Is this page helpful?

Table of Contents

Edit Page
Transaction Fees | Solana