X

HOW TO CALCULATE PRIORITY FEE

Compute unit price, budget limits, and the lamport formula

How to Calculate Solana Priority Fee

How to Calculate Solana Priority Fee

Calculating the right Solana priority fee requires understanding two key parameters: the compute unit limit and the compute unit price. Together, these determine how much extra you pay to boost your transaction in the validator queue.

The priority fee formula: ceil(compute_unit_price × compute_unit_limit / 1,000,000) lamports. Base fee is always 5,000 lamports per signature on top of this.

Step 1: Understand Compute Units

Every operation on Solana — arithmetic, memory access, syscalls — costs a fixed number of compute units (CUs). Each transaction requests a CU limit upfront. If the limit is exceeded during execution, the transaction fails. The default limit if no instruction is included is 200,000 CUs per non-builtin instruction.

Crucially, the priority fee is charged based on the requested CU limit, not actual usage. Setting a higher limit than needed means paying for unused compute units. Always use SetComputeUnitLimit to request only what your transaction actually needs.

Step 2: Set the Compute Unit Price

The compute unit price (also called CU price) is measured in micro-lamports per compute unit. One lamport equals 1,000,000 micro-lamports. The default CU price is 0, meaning no priority fee by default. You set this via a SetComputeUnitPrice instruction in your transaction.

Step 3: Query Real-Time Fee Estimates

Solana provides the getRecentPrioritizationFees RPC method, which returns fee data from the last 150 blocks. This gives a snapshot of recent fee activity to help you gauge the minimum required value. For more actionable estimates, providers like Helius offer a getPriorityFeeEstimate API that simplifies this into a single value across six priority tiers: Low, Medium, High, Very High, Unsafe Max, and Default.

Step 4: Calculate Your Total Cost

A typical transaction using 200,000 CUs at a CU price of 50,000 microlamports:

Priority Fee = ceil(50,000 × 200,000 / 1,000,000) = 10,000 lamports ≈ 0.00001 SOL

Add the base fee: 5,000 lamports per signature. For a single-signer transaction, total cost = 15,000 lamports — still well under $0.01.

Priority Fee Tiers Explained

Low (25th percentile) — Budget-friendly, suitable for non-urgent transactions where speed is not critical. Good balance of cost and reliability.

Medium (50th percentile) — The recommended starting point for most applications and general use cases. Provides reliable confirmation times.

High (75th percentile) — For time-sensitive operations and competitive scenarios. Ensures prioritized processing during network activity.

Very High (95th percentile) — Premium fees for maximum speed. Suitable for critical operations, MEV strategies, and urgent transactions requiring fast confirmation even under high congestion.

Solana Priority Fee

About This Guide

This guide is part of the priorityfeesolana.org knowledge base — a comprehensive resource for understanding Solana transaction fees, compute unit pricing, and best practices for landing transactions on the Solana network.

Leave A Comment