in-solana by Supanode

getRecentPrioritizationFees — Solana RPC Method

getRecentPrioritizationFees returns the priority fees paid in recent slots, optionally filtered to accounts your transaction will touch. This data helps you set a competitive compute unit price so your transaction lands quickly.

Parameters

NameTypeRequiredDescription
account_addressesstring[]NoArray of base-58 encoded account addresses (up to 128). Returns fee data only for slots where transactions touched these accounts. If empty, returns global fee data.

Request

curl -X POST https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getRecentPrioritizationFees",
    "params": [
      ["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"]
    ]
  }'

TypeScript (@solana/kit)

import { createSolanaRpc, address } from "@solana/kit";

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const fees = await rpc
  .getRecentPrioritizationFees([
    address("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"),
  ])
  .send();

const nonZero = fees.filter((f) => f.prioritizationFee > 0n);
if (nonZero.length > 0) {
  const median = nonZero.sort((a, b) =>
    Number(a.prioritizationFee - b.prioritizationFee)
  )[Math.floor(nonZero.length / 2)];
  console.log(`Median priority fee: ${median.prioritizationFee} micro-lamports`);
}

Response

{
  "jsonrpc": "2.0",
  "result": [
    { "slot": 341200000, "prioritizationFee": 1000 },
    { "slot": 341199999, "prioritizationFee": 500 },
    { "slot": 341199998, "prioritizationFee": 0 }
  ],
  "id": 1
}
FieldTypeDescription
slotu64The slot for this fee sample.
prioritizationFeeu64The minimum prioritization fee (in micro-lamports per compute unit) paid by at least one successfully landed transaction in this slot.

The response includes up to 150 recent slots, from newest to oldest.

How priority fees work

Priority fees are set per transaction using two Compute Budget instructions:

  1. setComputeUnitLimit — declare the maximum compute units your transaction may use.
  2. setComputeUnitPrice — set the price per compute unit in micro-lamports.

The total priority fee is: computeUnitsConsumed × computeUnitPrice / 1,000,000 (in lamports).

Validators prioritize transactions with higher compute unit prices within a block.

Common errors

  • Too many addresses — exceeding 128 accounts returns an error.
  • Invalid address — a malformed base-58 key causes the request to fail.

Performance

The response contains up to 150 entries (one per recent slot). The method is lightweight and suitable for calling before each transaction to get current fee data.

FAQ

How do I set a competitive priority fee? Call getRecentPrioritizationFees with the accounts your transaction touches. Take the median or 75th percentile of non-zero fees as your compute unit price. This gives you a competitive fee without overpaying.

What are micro-lamports? 1 micro-lamport = 0.000001 lamports. Priority fees are specified in micro-lamports per compute unit. A fee of 1,000 micro-lamports per CU on a transaction consuming 200,000 CUs costs 200,000 × 1,000 / 1,000,000 = 200 lamports.

Why should I pass account addresses? Passing the accounts your transaction touches returns fee data specific to those accounts’ contention level. Hot accounts (popular DEX pools, NFT mints) typically require higher fees than less active accounts.

Is a priority fee of 0 valid? Yes. A transaction with no priority fee still pays the base fee (5,000 lamports per signature). However, during high-demand periods, zero-priority transactions are less likely to be included in a block.

How many slots of data does this return? Up to 150 recent slots, which covers approximately 60 seconds of block history at typical block production rates.

Updated: