I am executing time-sensitive transactions (swaps between coins). Before executing the transaction I am fetching the price. However since there is so much movement in that market my transactions fail because the amount exceeds the desired slippage. So I was thinking I could add a higher computing budget so that the transaction is faster executed before the price changes.

I have three questions:

  1. Is 'changing the computing budget' the right choice to make sure the tx is less likely to fail? (I know I could higher the slippage, but that's not what I personally want, I have it set to 10% already)
  2. The computing settings consists of computing units and budget. How can I properly calculate the computing units, is that always the same amount for the same program? Or does that change? Is that even important to set? The Swap SDK I am using does calculate that already, so far I never exceeded the the computing units.
  3. Speaking of computing budget: what is a high computing budget what is a low budget? I checked out the RPC method getRecentPrioritizationFees but that gave me mostly 0 or 1 microlamports. What amount is considered to be good?
  • You can also check out my answer on this question which shows you how to add the compute budget instruction to an existing instruction link Commented Jan 15 at 21:20

1 Answer 1


Compute Budget roughly specifies how much compute your transaction can consume. For example, if your transaction is only computing 1+1 you can imagine that this would take less compute budget than if your transaction is computing some complicated equation.

  1. So changing the compute budget will not affect your transactions probability of success since it's still executing the same code (unless your transaction is right at the edge of the allowed default compute budget and certain parameters make it fail, but this is unlikely and would yield a different error). In fact, requesting compute budget that you don't need can increase the time it takes for your transaction to be included in a block, as each block has a limit of 48M compute units.
  2. You usually don't need to calculate this, as most transactions succeed with the default compute budget already, and, if they don't, developers of frontends/sdks should take care of this for you under the hood.
  3. By default each transaction has 200k compute units per instruction, but can request up to 1.4M compute units.

Finally, judging from the context of your question, I think what you're moreso looking for is Priority fees and how to set those. For this, feel free to check out the following questions on the topic:

How do priority fees (from the ComputeBudget program) prioritize transactions?

How do I add priority fees to a transaction using web3.js?

  • This is a great answer! As a little correction, by default, each transaction has 200k compute units per instruction in the transaction
    – Jon C
    Commented Jan 15 at 17:09
  • Thanks for the correction Jon! Just edited my answer
    – Ahri
    Commented Jan 15 at 20:51

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.