Loading documentation…
Read the recent Solana priority-fee floor over rpc edge to price compute-unit fees that land.
getRecentPrioritizationFees returns the per-compute-unit priority fees paid in recent slots. Use it
to price your own compute-unit fee so your transaction lands during congestion without overpaying.
Pass an optional array of account addresses to scope the sample to slots that touched those accounts;
omit or pass [] for the network-wide floor.
curl -s https://rpc.rpcedge.com \
-H 'content-type: application/json' \
-H 'x-api-key: YOUR_UUID_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getRecentPrioritizationFees",
"params": [[]]
}'In Python, take a high percentile as your compute-unit price:
import requests
ENDPOINT = "https://rpc.rpcedge.com?key=YOUR_UUID_KEY"
fees = requests.post(ENDPOINT, json={
"jsonrpc": "2.0", "id": 1,
"method": "getRecentPrioritizationFees", "params": [[]],
}).json()["result"]
vals = sorted(f["prioritizationFee"] for f in fees)
p75 = vals[int(len(vals) * 0.75)]
print("suggested compute-unit price (micro-lamports/CU):", p75)| Position | Name | Type | Notes |
|---|---|---|---|
0 | addresses | string[] | Optional. Up to 128 base-58 addresses to scope the sample. [] = network-wide. |
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{ "slot": 429641440, "prioritizationFee": 0 },
{ "slot": 429641441, "prioritizationFee": 12000 }
]
}Each element is one recent slot. prioritizationFee is in micro-lamports per compute unit
(1 lamport = 1,000,000 micro-lamports). Take a high percentile (p75-p90) of the returned values as
your compute-unit price, and set it with ComputeBudgetProgram.setComputeUnitPrice.