DEV Community

swapio
swapio

Posted on

Solana Priority Fees: A Dev's Guide to Getting Transactions Included

Your swap just expired for the third time. The error says "blockhash not found" and the network is clearly congested. The fix is probably a priority fee adjustment, but only if you understand what that setting actually does on-chain.

The Two Fee Components Every Solana Transaction Carries

Base fee: Fixed at 5,000 lamports (0.000005 SOL) per signature. One signature per typical swap, one tiny fraction of a cent, no negotiation.

Priority fee: Completely optional. This is the extra lamports you attach so the validator building the next block has an economic reason to pick your transaction over others competing for the same accounts. During low-traffic periods it barely moves the needle. When many transactions are touching the same pool accounts simultaneously, it can be the difference between landing and expiring.

How the Runtime Computes the Priority Fee

Every transaction declares two values:

  • Compute unit limit: the maximum compute units the transaction is allowed to consume.
  • Price per compute unit: denominated in micro-lamports.

The math is straightforward:

Priority fee = compute unit limit × price per compute unit
Enter fullscreen mode Exit fullscreen mode

A multi-hop route through several AMM pools burns significantly more compute units than a single-account transfer. That means the same micro-lamport price produces a higher absolute fee on complex routes. Most wallets and aggregators estimate both values from recent on-chain data and set them automatically.

Situations Where Bumping the Fee Actually Helps

  • Repeated "blockhash not found" expiries during a high-traffic window, the classic signal that your transaction is getting deprioritized.
  • Trading a token with sudden volume spikes, where many transactions contend for the same pool accounts.
  • Time-sensitive execution, where landing before conditions shift matters.

Situations Where It Won't Help at All

  • Slippage failures. The transaction landed, the price moved past your minimum received threshold, and it reverted. A higher fee played no role. Fix the slippage setting, not the fee.
  • Insufficient SOL balance. If the wallet can't cover fees plus token account rent, the swap fails regardless of priority level.
  • An uncongested network. Paying extra when blocks aren't full is just wasted SOL.

One point worth keeping clear: a higher fee improves inclusion odds. It's not a guarantee.

Sensible Defaults for Fee Settings

  • Keep automatic fee estimation on for routine swaps. Most apps read recent block data and set a reasonable value.
  • When swaps fail during congestion, step up one preset level ("fast" or "turbo" in most UIs) rather than jumping straight to the maximum.
  • Read the fee shown in the wallet confirmation prompt before signing.
  • Maintain a small SOL buffer in every trading wallet. Priority fees are paid in SOL, and running low is a common cause of unexpected failures.

swap.io, a Solana swap aggregator, compares quotes from multiple routing providers (Jupiter among them) and displays the full route and minimum received amount before you confirm. The guide to swapping tokens on Solana covers the full swap flow if you want a walkthrough.

Key Takeaways

  • The base fee is fixed and tiny. The priority fee is optional and varies with network demand.
  • Priority fee = compute units × price per compute unit, so complex routes cost more at the same unit price.
  • Raise the fee when transactions expire during congestion, not to fix slippage failures.
  • Higher fees improve inclusion odds but never guarantee your transaction lands.

Frequently Asked Questions

Do failed Solana transactions still pay fees?

Yes, if the transaction was processed by the runtime and failed on-chain, the base fee and priority fee are both charged. A transaction that expires before processing pays nothing.

Who receives the priority fee?

The validator that includes the transaction in a block collects the priority fee.

Is a priority fee the same as a Jito tip?

No. A Jito tip is a separate payment that routes transactions through Jito's block engine. Both are aimed at improving inclusion, but they operate through different mechanisms.

Why does the priority fee vary between swaps?

Routes through more pools consume more compute units, and busier periods push up the per-unit price that apps set automatically. Both factors raise the final fee.

Top comments (0)