getRecentPrioritizationFees
Returns a list of prioritization fees from recent blocks. Prioritization fees are additional fees paid to incentivize validators to include a transaction in a block more quickly. This method is critical for applications that need to dynamically set compute unit prices to ensure timely transaction inclusion during periods of high network congestion, such as NFT mints or DeFi trading.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | array[string] | No | Array of base-58 encoded account addresses (max 128). If provided, returns fees for transactions that write-lock these accounts |
Response
Returns an array of prioritization fee objects:
| Field | Type | Description |
|---|---|---|
[].slot | u64 | Slot in which the fee was observed |
[].prioritizationFee | u64 | The per-compute-unit fee paid by at least one transaction in the block, in micro-lamports |
Code Examples
cURL
1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "method": "getRecentPrioritizationFees",
5 "params": [
6 ["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]
7 ]
8}'TypeScript
1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2 method: "POST",
3 headers: { "Content-Type": "application/json" },
4 body: JSON.stringify({
5 jsonrpc: "2.0",
6 id: 1,
7 method: "getRecentPrioritizationFees",
8 params: [
9 ["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]
10 ]
11 }),
12});
13const { result } = await response.json();
14const avg = result.reduce((s, f) => s + f.prioritizationFee, 0) / result.length;
15console.log("Average priority fee:", avg, "micro-lamports");Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getRecentPrioritizationFees",
7 "params": [
8 ["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]
9 ]
10})
11result = response.json()["result"]
12avg = sum(f['prioritizationFee'] for f in result) / len(result)
13print(f"Average priority fee: {avg} micro-lamports")Rust
1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let client = Client::new();
7 let res = client.post("http://[IP_ADDRESS]:[PORT]")
8 .json(&json!({
9 "jsonrpc": "2.0",
10 "id": 1,
11 "method": "getRecentPrioritizationFees",
12 "params": [
13 ["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]
14 ]
15 }))
16 .send().await?
17 .text().await?;
18 println!("{}", res);
19 Ok(())
20}Example Response
1{
2 "jsonrpc": "2.0",
3 "result": [
4 { "slot": 166974442, "prioritizationFee": 1000 },
5 { "slot": 166974441, "prioritizationFee": 500 },
6 { "slot": 166974440, "prioritizationFee": 0 }
7 ],
8 "id": 1
9}