How Solana transaction fees work

Base fee plus priority fee: how to calculate the priority fee from the compute unit price and limit, why only contested accounts get expensive, and why rent isn't a fee.

On this page
  1. Two parts
  2. The priority fee
  3. Choosing a price
  4. Local fee markets
  5. Rent is not a fee
  6. Landing a transaction

Two parts

fee = base fee + priority fee
  • Base fee: 5,000 lamports per signature. One signer pays 0.000005 SOL. Half is burned, half goes to the validator that produced the block.
  • Priority fee: optional, all of it to the validator. Paid to be scheduled sooner when blocks are busy.

The fee payer is the first signer. Fees are charged even when the transaction fails, as long as it lands in a block.

The priority fee

Two values, both set with Compute Budget instructions:

  • compute unit price, in micro-lamports (millionths of a lamport) per CU
  • compute unit limit, the most CU the transaction may use
priority fee = ceil(price × limit ÷ 1,000,000) lamports

At 10,000 micro-lamports and 200,000 CU: 2,000,000,000 ÷ 1,000,000 = 2,000 lamports. With the 5,000-lamport base fee, the transaction costs 7,000 lamports.

The fee is charged on the limit, not on what was used. A transaction with three program instructions and no limit set defaults to 600,000 CU and pays priority on all of it, even if it used 40,000. Measuring compute units and setting a tight limit can cut the priority fee by 10× or more.

import { ComputeBudgetProgram, Transaction } from "@solana/web3.js";

const tx = new Transaction().add(
  ComputeBudgetProgram.setComputeUnitLimit({ units: 45_000 }),
  ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 10_000 }),
  swapInstruction,
);
// priority fee = ceil(10_000 × 45_000 / 1_000_000) = 450 lamports

Choosing a price

The going rate depends on which accounts you write, not on the network as a whole. getRecentPrioritizationFees takes a list of accounts and returns what recent transactions writing them paid, slot by slot. I take a percentile of that (median for normal transactions, 75th for urgent ones) and cap it, so a spike can't drain a user's wallet. Several RPC providers offer estimate APIs that do the same with more data.

Local fee markets

With one global fee market, a popular mint makes every transaction expensive. Solana avoids that through the account model: transactions declare the accounts they write, and the scheduler only orders transactions that want the same write lock. Congestion, and the fees it brings, mostly stays on the contested accounts.

Buying into a hot token launch competes with everyone writing that pool. Sending SOL to a friend at the same moment usually needs no priority fee at all.

The design lesson is the same as for compute: don't make every user write one shared account. A global counter updated by every transaction turns the whole program into one contested account.

Rent is not a fee

Creating an account takes a rent-exempt deposit proportional to its size: about 0.00089 SOL for an empty account plus about 0.0071 SOL per KiB. It isn't spent.

Cost Who gets it Refundable
Base fee Half burned, half to validator No
Priority fee Validator No
Rent deposit Stays in the account Yes, when the account is closed

Creating a token account (165 bytes) costs a user about 0.002 SOL. Nearly all of it is the deposit, which comes back when the account is closed.

Landing a transaction

A higher fee doesn't guarantee inclusion. Transactions also fail to land because the blockhash expired (about 150 slots, roughly a minute), the RPC node dropped them, or simulation failed. My procedure:

  1. Simulate, then set the limit to the units consumed plus 10–20%.
  2. Price from recent fees for the accounts being written, with a cap.
  3. Use a recent blockhash and resend until it expires, then rebuild.
  4. Confirm at the commitment the use case needs: confirmed for UI updates, finalized for anything that moves real money off-chain.