TriportRPC

getRecentPrioritizationFees

POSThttps://api.triport.io/v1/sol

Returns the per-block prioritization fees paid over the most recent blocks, for estimating the priority fee to attach before sending a transaction.

Solanasol_read_rpcfree+ — 20 / 60 / 200 / 600 RPS (free / basic / pro / business)

getRecentPrioritizationFees returns a list of the prioritization fees observed in recent blocks — up to the last 150 blocks. Each entry pairs a slot with the prioritizationFee (in micro-lamports per compute unit) that was sufficient to land a transaction in that block.

Use this method to size the priority fee before submitting a transaction. A common strategy is to fetch the recent fees, take a percentile (for example the median or the 75th percentile of the non-zero values), and set your compute-unit price accordingly via a ComputeBudget instruction.

The optional addresses parameter narrows the result to blocks where a transaction wrote to one of the given accounts (write-locked them). This yields a fee estimate tailored to the accounts your transaction will touch — useful when a specific account is contended. Omit addresses to get the global recent-fee picture across the cluster.

Parameters

JSON-RPC params is a positional array: [addresses?].

addressesarray of string (base-58)optional
Up to 128 account public keys. Fees are reported for blocks in which one of these accounts was write-locked. Omit for global recent fees. Each key must match ^[1-9A-HJ-NP-Za-km-z]{32,44}$.

Response

The array is ordered by slot (ascending) and covers up to the most recent 150 blocks. Entries with prioritizationFee: 0 represent blocks where no priority fee was required.

resultarray
List of PrioritizationFee objects, one per recent block.
result[].slotinteger
The slot the fee observation is for.
result[].prioritizationFeeinteger
The per-compute-unit prioritization fee, in micro-lamports, paid in that slot.

Errors

Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.

CodeMeaningWhen it happens
-32602Invalid paramsaddresses is not an array of valid base-58 keys, or contains more than 128 entries.
401UnauthorizedMissing or invalid Authorization: Bearer key.
429Rate limitedMore than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600).

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io/v1/sol", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getRecentPrioritizationFees",
    params: [["So11111111111111111111111111111111111111112"]],
  }),
});


const { result } = await res.json();


// Median of the non-zero recent fees, a common estimation strategy.
const fees = result.map((f) => f.prioritizationFee).filter((f) => f > 0).sort((a, b) => a - b);
const median = fees.length ? fees[Math.floor(fees.length / 2)] : 0;
console.log(`Suggested priority fee: ${median} micro-lamports/CU`);

TypeScript SDK (@triport/sdk)

import { TriportClient } from "@triport/sdk";


const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });


const fees = await client.solana.getRecentPrioritizationFees([
  "So11111111111111111111111111111111111111112",
]);


const nonZero = fees.map((f) => f.prioritizationFee).filter((f) => f > 0);
const max = nonZero.length ? Math.max(...nonZero) : 0;
console.log(`Peak recent priority fee: ${max} micro-lamports/CU`);

Python (triport-sdk)

import os
from statistics import median
from triport import TriportClient


client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])


fees = client.solana.get_recent_prioritization_fees(
    ["So11111111111111111111111111111111111111112"],
)


non_zero = [f["prioritizationFee"] for f in fees if f["prioritizationFee"] > 0]
suggested = int(median(non_zero)) if non_zero else 0
print(f"Suggested priority fee: {suggested} micro-lamports/CU")

Notes

  • Units: prioritizationFee is denominated in micro-lamports per compute unit. Multiply by the compute-unit limit of your transaction to get the total priority fee in micro-lamports, then divide by 1,000,000 for lamports.
  • Up to 128 addresses: the addresses array is capped at 128 entries. Supply only the accounts your transaction will write-lock for the most relevant estimate.
  • Up to 150 blocks: the window is the most recent 150 blocks, so the result may contain fewer entries early after cluster restarts.
  • Applying the fee: set the returned value as the compute-unit price using a ComputeBudget SetComputeUnitPrice instruction before sending the transaction.
  • Related methods: use getFeeForMessage to compute the base fee for a compiled message, and getSlot to inspect the current slot the cluster has reached.