I've seen on the zz explorer that some guys doing arbitrage, set an amount of fee before executing the tx so that can be prioritized.

How do they know how much fees to set?

Do they use multiple txs? Or do they check through solana rpc json apis? Or do they just make random amounts or loops?

For example: enter image description here

How does this guy set the base fees + priority fees? He's doing arbitrage, where does these values come from? Every tx has different fees values


1 Answer 1


A transaction may set the maximum number of compute units it is allowed to consume and the compute unit price by including a SetComputeUnitLimit and a SetComputeUnitPrice Compute budget instructions respectively.

If no SetComputeUnitLimit is provided the limit will be calculated as the product of the number of instructions in the transaction (excluding the Compute budget instructions) and the default per-instruction units, which is currently 200k.


Calculating Solana Fees

How are Solana transaction fees calculated?


An additional fee user can specify in the compute budget instruction to prioritize their transactions.

The prioritization fee is calculated by multiplying the requested maximum compute units by the compute-unit price (specified in increments of 0.000001 lamports per compute unit) rounded up to the nearest lamport.

Transactions should request the minimum amount of compute units required for execution to minimize fees.


Compute Budget instructions don't require any accounts and don't consume any compute units to process. Transactions can only contain one of each type of compute budget instruction, duplicate types will result in an error.

You can set the compute unit limit and unit price by calling the compute budget program. you can do so by using the Solana web3js library


How to pick the fee

In general, it's hard to know what fee to pick in order to get your transaction processed first. You can use a higher fee than the daily average transaction fee.

This might be useful to use



  • 1
    Thanks for the answer, here i can see that this guy uses an algorithm to calculate the fees. It's not on profit's percent, because every times it's a new percent. I can't understand, it could be it's random. And anyway he doesn't send the same tx multiple times with different fees. If i can find an answer i'll post it here. Jan 17, 2023 at 11:03
  • 1
    Updated answer, this might be useful solanacompass.com/statistics/fees
    – vicyyn
    Jan 17, 2023 at 14:24
  • 1
    Thanks! This is indeed some starting point. Hope to find some other useful resources, in the meantime i'll check your links. Jan 17, 2023 at 16:21
  • Where can I view the priority fee used on a transaction?
    – Sid
    Jan 24 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.