How to Add Priority Fees to a Transaction
Transaction (TX) priority is achieved by paying a Prioritization Fee in addition to the Base Fee. By default the compute budget is the product of 200,000 Compute Units (CU) * number of instructions, with a max of 1.4M CU. The Base Fee is 5,000 Lamports per signature. A microLamport is 0.000001 Lamports.
You can find a detailed guide here on how to use priority fees.
The total compute budget or Prioritization Fee for a single TX can be changed by adding instructions from the ComputeBudgetProgram.
ComputeBudgetProgram.setComputeUnitPrice({ microLamports: number })
will add a
Prioritization Fee above the Base Fee (5,000 Lamports). The value provided in
microLamports will be multiplied by the CU budget to determine the
Prioritization Fee in Lamports. For example, if your CU budget is 1M CU, and you
add 1 microLamport/CU, the Prioritization Fee will be 1 Lamport (1M *
0.000001). The total fee will then be 5001 Lamports.
Use ComputeBudgetProgram.setComputeUnitLimit({ units: number })
to set the new
compute budget. The value provided will replace the default value. Transactions
should request the minimum amount of CU required for execution to maximize
throughput, or minimize fees.