> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# getRecentPrioritizationFees

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

<Info>
  **Source**

  [`get_recent_prioritization_fees`](https://github.com/anza-xyz/agave/blob/v4.3.2/rpc/src/rpc.rs#L2451)
</Info>

<Info>
  Currently, a node's prioritization-fee cache stores data from up to 150
  blocks.
</Info>

<RequestExample>
  ```bash cURL
  curl https://api.devnet.solana.com -s -X POST \
    -H "Content-Type: application/json" \
    -d '
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getRecentPrioritizationFees",
      "params": [
        ["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]
      ]
    }
  '
  ```

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

  const rpc_url = "https://api.devnet.solana.com";
  const rpc = createSolanaRpc(rpc_url);

  let addresses = [address("CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY")];
  let prioritizationFees = await rpc
    .getRecentPrioritizationFees(addresses)
    .send();

  console.log(prioritizationFees);
  ```

  ```ts web3.js
  import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";

  const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

  let addresses = [new PublicKey("CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY")];

  let prioritizationFees = await connection.getRecentPrioritizationFees({
    lockedWritableAccounts: addresses
  });

  console.log(prioritizationFees);
  ```

  ```rs Rust
  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://api.devnet.solana.com"),
          CommitmentConfig::confirmed(),
      );

      let addresses = [pubkey!("CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY")];
      let prioritization_fees = client.get_recent_prioritization_fees(&addresses).await?;

      println!("{:#?}", prioritization_fees);

      Ok(())
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response
  {
    "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
  }
  ```
</ResponseExample>

## Parameters

<ParamField body="addresses" type="array">
  Optional array of account addresses, as base-58 encoded strings. Maximum 128
  addresses.

  <Info>
    If you provide this parameter, the response reflects fees observed for
    transactions that lock all of the supplied accounts as writable.
  </Info>

  If you omit `params` entirely, the RPC returns recent prioritization-fee samples
  without filtering by writable account locks.
</ParamField>

## Result

<ResponseField name="result" type="array">
  Array of prioritization-fee samples containing:

  <Expandable title="properties" defaultOpen>
    <ResponseField name="slot" type="u64">
      Slot that produced this fee sample.
    </ResponseField>

    <ResponseField name="prioritizationFee" type="u64">
      Prioritization fee, in micro-lamports per compute unit, observed for that slot.
    </ResponseField>
  </Expandable>
</ResponseField>
