🚰How to Set Up Priority Fees on Solana
Priority fees allow you to pay an additional fee so your Solana transaction is prioritized over others in the leader’s queue. Below, we’ll cover how they work, why they matter, and how to set them up.
What Are Priority Fees?
On Solana, each transaction has a base fee. If you want your transaction to be processed ahead of others (for example, when the network is busy), you can add a priority fee. This extra amount helps ensure validators prioritize your transaction over ones offering a lower fee.
In practice, you set a price for each compute unit (CU) your transaction may use. The higher the price, the more likely your transaction is included first. While priority fees were originally used for time-sensitive or high-value transactions, they're becoming more commonplace and can help any transaction get confirmed faster when network congestion is high.
Why They Matter
When the network is busy, transactions can slow down. Adding a priority fee helps your transaction get confirmed faster. Whether you’re minting NFTs, swapping tokens, or simply want quicker processing, a priority fee keeps you ahead of the crowd.
How Much Should You Pay?
Paying more gets you a faster transaction. But you shouldn’t overpay. One way to estimate a fair tip is the Helius getPriorityFeeEstimate
RPC method. This method calculates how much others recently paid for similar transactions. You can provide either a full, signed transaction or the account keys involved. The API then suggests a fee in micro-lamports that should land your transaction in your chosen percentile—like “Medium” (50th percentile) or “High” (75th percentile).
A simple example call might look like:
The response suggests a priority fee. If you use that number in your setComputeUnitPrice
instruction, you’ll likely pay a balanced fee.
For more details, please refer to our Priority Fee API documentation.
Setting Them Up in Your Code
You can add priority fees by inserting two instructions in your transaction:
ComputeBudgetProgram.setComputeUnitPrice
– Sets the fee (in micro-lamports) per compute unit.ComputeBudgetProgram.setComputeUnitLimit
– (Optional) Increases the maximum compute units your transaction can use.
Here’s a simplified flow:
Create the Compute Budget Instructions
Add Them to Your Transaction
Sign and Send
Remember:
The order of instructions matters. If you need more compute units, set
computeLimitIx
before any instruction that may exceed the default limit.If you don’t specify a
SetComputeUnitPrice
, you get the lowest priority.
Best Practices
Don’t overestimate your compute needs. Request only as many CUs as your transaction truly requires. More units mean higher fees.
Estimate fees. Use tools like Helius’
getPriorityFeeEstimate
to see what others are paying.Stay flexible. If network congestion is low, you can pay less. If it’s high, be willing to pay more.
Final Thoughts
Priority fees exist so that critical transactions on Solana can skip to the front of the line. By learning how to configure them—and how to estimate a fair price—you can ensure your time-sensitive actions happen when you need them to.
Give it a try. Add a small priority fee, watch your transaction speed improve, and refine your approach with real data from the Helius API. The network is there to serve your needs—priority fees just make sure it does so on your schedule.
Check out our in-depth blog post, “Priority Fees: Understanding Solana’s Transaction Fee Mechanics”. It covers the finer points of how priority fees work and offers tips for using them effectively.
Last updated