OpenInfra.sh is now live - Solana infrastructure, included with every server. LEARN MORE HERE >

OpenInfra.shopeninfra.sh

getRecentPrioritizationFees

Returns recent prioritization-fee samples, optionally filtered to transactions that lock a set of writable accounts.

Request

Send a JSON-RPC 2.0 POST request with method: "getRecentPrioritizationFees". The optional params array accepts up to 128 base-58 encoded account addresses to filter results.

curl · JSON-RPCjson
{  "jsonrpc": "2.0",  "id": 1,  "method": "getRecentPrioritizationFees",  "params": [    ["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]  ]}

@solana/kit

kit.tsts
import { address, createSolanaRpc } from "@solana/kit"; const rpc_url = "https://rpc.openinfra.sh";const rpc = createSolanaRpc(rpc_url); let addresses = [address("CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY")];let prioritizationFees = await rpc  .getRecentPrioritizationFees(addresses)  .send(); console.log(prioritizationFees);

@solana/web3.js

web3.tsts
import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js"; const connection = new Connection("https://rpc.openinfra.sh", "confirmed"); let addresses = [new PublicKey("CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY")]; let prioritizationFees = await connection.getRecentPrioritizationFees({  lockedWritableAccounts: addresses}); console.log(prioritizationFees);

Rust

main.rsrs
use anyhow::Result;use solana_client::nonblocking::rpc_client::RpcClient;use solana_commitment_config::CommitmentConfig;use solana_sdk::pubkey; #[tokio::main]async fn main() -> Result<()> {    let client = RpcClient::new_with_commitment(        String::from("https://rpc.openinfra.sh"),        CommitmentConfig::confirmed(),    );     let addresses = [pubkey!("CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY")];    let prioritization_fees = client.get_recent_prioritization_fees(&addresses).await?;     println!("{:#?}", prioritization_fees);     Ok(())}

Parameters

ParameterTypeRequiredDescription
addressesarrayNoArray of account addresses, as base-58 encoded strings. Maximum 128 addresses. When provided, the response reflects fees observed for transactions that lock all of the supplied accounts as writable.

Response

response.jsonjson
{  "jsonrpc": "2.0",  "result": [    {      "slot": 348125,      "prioritizationFee": 0    },    {      "slot": 348126,      "prioritizationFee": 1000    },    {      "slot": 348127,      "prioritizationFee": 500    },    {      "slot": 348128,      "prioritizationFee": 0    },    {      "slot": 348129,      "prioritizationFee": 1234    }  ],  "id": 1}

The result is an array of prioritization-fee sample objects, one per recent block. Each object contains:

FieldTypeDescription
slotu64The slot that produced this fee sample.
prioritizationFeeu64The per-compute-unit prioritization fee, in micro-lamports, observed for that slot.