Setting a priority fee on Solana is the most effective way to ensure your transaction gets processed ahead of competing ones during network congestion. Solana's fee system is composed of two parts: a base fee of 5,000 lamports per signature, and an optional prioritization fee that you set in micro-lamports per Compute Unit (CU).
To set a priority fee, you need to add a ComputeBudgetProgram.setComputeUnitPrice instruction to your transaction. This tells the network how much you are willing to pay per compute unit to prioritize your transaction in the leader's queue.
Priority fees give your transaction a higher position in the validator's scheduling queue β the higher you bid, the faster your transaction lands.
Solana Developer Docs
The prioritization fee formula is: ceil(compute_unit_price Γ compute_unit_limit / 1,000,000) lamports. This fee goes 100% to the block-producing validator. You should also include setComputeUnitLimit to avoid paying for unused compute units. Always simulate your transaction first to estimate the actual CU consumption before setting limits.
For real-time fee estimation, use getRecentPrioritizationFees RPC method or third-party APIs like Helius getPriorityFeeEstimate. A common best practice is to use the 50thβ75th percentile of recent fees for a balance of cost and confirmation speed. During high network load, consider using the 95th percentile for time-sensitive operations.
