Improved Priority Fees API

This is currently in staging/beta testing. If you want access to an endpoint for testing, contact us on your customer support channels. After receiving client feedback, we will create a PR to include this feature in the Anza/Solana Labs repositories.

Solana's default RPC stack supports identifying recently paid priority fees globally and per writeable account. Currently, this provides a single number per slot to indicate the minimum priority fee amount. Returning only the minimum priority fee limits the ability of RPC consumers to more clearly identify what priority fees to use in their transactions.

To address this, we have added a percentile parameter to the Solana JSON RPC `getRecentPrioritizationFees` method that provides you better flexibility to estimate previous priority fees that were paid and, thus, what you might want to add to your transactions.

If you are running your own Solana node or an RPC provider, we provide the patches you can apply to your local Solana validator build to support these new parameters. We encourage everyone to support this new param.

Client API

To help accelerate your development with this change, we've prepared an example repository with examples of API usage and utility functions that you can copy-paste into your JS codebase and get started without additional dependencies.

Sample requests

Request Body:

{
  "method": "getRecentPrioritizationFees",
  "jsonrpc": "2.0",
  "params": [
    [
      "RNXnAJV1DeBt6Lytjz4wYzvS3d6bhsfidS5Np4ovwZz"
    ],
    {
      "percentile": 5000
    }
  ],
  "id": "1"
}

The response format doesn't change. The only difference is the return value reflects the percentile from the request. The default behavior, when no percentile is provided, is to return the minimum, as before.

{
  "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
}

Sample CURL requests

You can use the following CURL requests to try out the API (replace localhost:8899 with your RPC endpoint, which is currently on our staging servers only).

curl localhost:8899 -X POST -H "Content-Type: application/json" -d '[{"method":"getRecentPrioritizationFees","jsonrpc":"2.0","params":[],"id":"1"}]'
curl localhost:8899 -X POST -H "Content-Type: application/json" -d '[{"method":"getRecentPrioritizationFees","jsonrpc":"2.0","params":[[],{"percentile":5000}],"id":"1"}]'
curl localhost:8899 -X POST -H "Content-Type: application/json" -d '[{"method":"getRecentPrioritizationFees","jsonrpc":"2.0","params":[["RNXnAJV1DeBt6Lytjz4wYzvS3d6bhsfidS5Np4ovwZz"]],"id":"1"}]'
curl localhost:8899 -X POST -H "Content-Type: application/json" -d '[{"method":"getRecentPrioritizationFees","jsonrpc":"2.0","params":[["RNXnAJV1DeBt6Lytjz4wYzvS3d6bhsfidS5Np4ovwZz"],{"percentile":5000}],"id":"1"}]'

Last updated