How to Set Solana Priority Fees

Setting Solana priority fees correctly is critical for ensuring your transactions land reliably. The process involves including a ComputeBudgetProgram instruction in your transaction to specify both the compute unit limit and the compute unit price in microLamports.

How to Set Solana Priority Fees
How to Set Solana Priority Fees guide

Step 1 – Estimate the Right Fee

Use the getRecentPrioritizationFees RPC method to query the fees paid in recent blocks for accounts your transaction touches. This provides a baseline. For more accurate estimates, the Helius Priority Fee API offers a getPriorityFeeEstimate method that returns a single recommended value based on real-time network conditions.

Step 2 – Set Compute Budget Instructions

Add two ComputeBudgetProgram instructions to your transaction: setComputeUnitLimit(units) to cap the compute units your transaction may consume, and setComputeUnitPrice(microLamports) to set your price per compute unit. Setting an accurate compute unit limit is important—overpaying for unused compute wastes SOL.

Step 3 – Monitor and Adjust Dynamically

For production applications, implement dynamic fee calculation. Query recent prioritization fees before sending each transaction and adjust your compute unit price based on current conditions. During low activity, 1,000–5,000 microLamports is usually sufficient. During high congestion, you may need 100,000+ microLamports to compete.

How to Set Solana Priority Fees

Related Resources

Explore more guides on our site to deepen your understanding of Solana priority fees and transaction optimization.