SOC 2 Badge

GetBlock Secures SOC 2 Type 1 Attestation.Strengthening Enterprise & Institutional Position

How to Optimize Solana Transactions with Priority Fees

blog_author_logo

GETBLOCK

March 20, 2026

5 min read

Your swap times out. The NFT mint you've been waiting for sells out while your transaction sits in limbo. The arbitrage opportunity disappears before your trade even hits the chain.

On Solana, milliseconds matter—and priority fees are your ticket to the front of the line.

In this guide, GetBlock breaks down what priority fees are, when you actually need them, and walks you through our step-by-step tutorial for implementing them in your own applications.

TL;DR

Priority fees are optional tips to validators that get your transactions processed faster. Here's what you need to know:

  • Priority fees follow a simple formula: Compute Units × Compute Unit Price. You're bidding for block space, not just paying a flat rate.

  • Simulation is non-negotiable. You pay for the compute unit limit you set, not what you use. Guessing wastes money or causes failures.

  • Dynamic fee calculation beats static values. Network conditions change constantly—fetch recent fees instead of hardcoding.

  • We've published a complete implementation guide with working TypeScript code in our documentation.

Let's explore what makes priority fees essential—and how to use them effectively.

What Are Priority Fees?

What Are Priority Fees?

Priority fees are optional fees you add to a Solana transaction to increase its scheduling priority. Think of them as a tip to validators—transactions with higher priority fees get processed before those with lower fees or no fees at all.

The formula is straightforward:

Priority Fee = Compute Units × Compute Unit Price

Where:

  • Compute Units (CU) measure the computational resources your transaction consumes. A simple SOL transfer uses around 450 CU. A DEX swap might use 100,000-200,000 CU.

  • Compute Unit Price is how much you're willing to pay per CU, measured in microLamports. For context: 1 microLamport equals 0.000000000001 SOL.

Ready to access blockchain data with flexible pricing? Sign up for GetBlock and start building with our RPC endpoints today.

When Should You Use Priority Fees?

Priority fees aren't always necessary. During normal network conditions, transactions land fine without them. Here's when they actually make sense:

  1. Skip or use minimal fees: Simple wallet transfers during normal activity. The base fee handles it.

  2. Medium priority recommended: DeFi swaps and trades where timing affects price execution.

  3. High- to urgent-priority: NFT mints during launch, time-sensitive operations, or when network congestion is detected.

  4. Extreme priority: Arbitrage opportunities where microseconds determine profit or loss.

The question isn't "should I use priority fees?" It's "how time-sensitive is this transaction, and what's the current network state?"

Understanding Compute Units

Every Solana transaction consumes compute units. The more complex your transaction, the more CUs it uses.

Typical CU usage by transaction type:

  • Simple SOL transfer: ~450 CU

  • Token transfer (SPL): ~20,000-30,000 CU

  • DEX swap: ~100,000-200,000 CU

  • Complex DeFi operations: ~200,000-400,000 CU

Without explicitly setting a compute unit limit, Solana defaults to 200,000 CU per instruction. Without setting a compute unit price, no priority fee is charged—only the base fee.

This default behavior is why many developers unknowingly overpay. A simple transfer doesn't need 200,000 CU, but that's what you'll be charged for if you don't simulate first.

The Three-Step Process That Actually Works

Getting priority fees right comes down to three steps that most tutorials skip or oversimplify:

1. Simulate First

Wrap your transfer instruction in a versioned transaction and dry-run it against the network. This tells you exactly how many compute units your specific transaction will consume—no guessing required.

1

2

const simulation = await connection.simulateTransaction(simTx);
const estimatedCU = Math.ceil(simulation.value.unitsConsumed * 1.1) + 600;

The 10% buffer accounts for minor variations. The extra 600 CU accounts for the two ComputeBudget instructions you'll add to the final transaction (which weren't in the simulation).

2. Fetch Dynamic Fees

Network conditions change constantly. Yesterday's "safe" fee might be inadequate during today's congestion—or wastefully high during quiet periods.

1

2

3

4

5

6

const recentFees = await connection.getRecentPrioritizationFees();
const sortedFees = recentFees
  .map((f) => f.prioritizationFee)
  .filter((f) => f > 0)  .sort((a, b) => a - b);
  .sort((a, b) => a - b);
const dynamicFee = sortedFees[Math.floor(sortedFees.length * 0.75)];

Taking the 75th percentile of recent fees gives you a competitive bid without overpaying.

3. Build the Transaction in the Right Order

Order matters. The compute budget instructions must come before your main transaction logic:

  1. SetComputeUnitLimit

  2. SetComputeUnitPrice

  3. Your actual transfer/swap/mint instruction

Get this wrong, and your priority fee won't apply correctly.

What Can You Build With This?

Understanding priority fees unlocks several capabilities:

  1. Trading bots that land trades during volatile markets when everyone else times out.

  2. NFT minting tools that actually secure allocations during high-demand launches.

  3. Arbitrage systems in which the speed difference between landing and failing is measured in lamports of the priority fee.

  4. DeFi applications that give users control over their transaction urgency and cost tradeoffs.

  5. Payment processors that guarantee settlement times for business-critical transfers.

The difference between a working bot and a profitable bot often comes down to optimizing priority fees.

Ready to Build Your Own?

We've created a comprehensive guide that walks you through building a fully functional priority fee implementation. You'll learn how to:

  1. Set up the development environment with the right dependencies

  2. Connect to Solana using GetBlock's RPC endpoints for reliable connectivity

  3. Simulate transactions to get accurate compute unit estimates

  4. Fetch real-time network fees for dynamic pricing

  5. Build properly ordered transactions with compute budget instructions

  6. Send and confirm with appropriate commitment levels

The complete implementation takes under 100 lines of TypeScript. By the end, you'll have a reusable pattern for any transaction type—transfers, swaps, mints, or complex DeFi operations. Access the full guide here and the complete code repository

Conclusion

Priority fees aren't complicated—but getting them right requires moving past the "set a high number and hope" approach that wastes money, and the "skip it entirely" approach that causes failures during congestion.

The pattern is simple: simulate to know your actual CU needs, fetch recent fees to understand the current market, and build your transaction with compute budget instructions in the correct order.

Solana's speed is only useful if your transactions actually land. Priority fees ensure they do.

Want reliable Solana infrastructure for your priority fee implementation? Create your free GetBlock account and access production-grade RPC endpoints.