Priority Fee & Simulation APIs
Use getRecentPrioritizationFees, simulateTransaction, and provider fee APIs to estimate compute units and priority fees before sending transactions.
Search across all documentation pages
Use getRecentPrioritizationFees, simulateTransaction, and provider fee APIs to estimate compute units and priority fees before sending transactions.
Quick-reference recipe card - copy-paste ready.
import { createSolanaRpc, getBase64EncodedWireTransaction } from "@solana/kit";
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
await rpc.getRecentPrioritizationFees([]).send();
await rpc.simulateTransaction(encodedTx, {
commitment: "processed",
sigVerify: false,
}).send();When to reach for this:
import { createSolanaRpc } from "@solana/kit";
const rpc = createSolanaRpc(process.env.RPC_URL!);
// Recent priority fees for relevant accounts (empty = global sample)
const fees = await rpc.getRecentPrioritizationFees([]).send();
const recent = fees.map((f) => f.prioritizationFee).filter((n) => n > 0);
recent.sort((a, b) => a - b);
const p75 = recent[Math.floor(recent.length * 0.75)] ?? 0;
console.log("suggested microLamports CU price (p75):", p75);
// Simulate signed or partially signed tx (base64 wire)
const simulation = await rpc
.simulateTransaction("BASE64_WIRE_TX", {
commitment: "processed",
sigVerify: false,
replaceRecentBlockhash: true,
})
.send();
console.log("err:", simulation.value.err);
console.log("units:", simulation.value.unitsConsumed);
console.log("logs:", simulation.value.logs?.slice(0, 5));What this demonstrates:
unitsConsumed and logs without committing state (except when configured).replaceRecentBlockhash helps simulate txs with expiring blockhashes.getRecentPrioritizationFees returns per-slot fee observations for account lock sets.simulateTransaction runs SVM against bank snapshot at chosen commitment.priorityFeeEstimate endpoints with percentile stats.| Option | Effect |
|---|---|
sigVerify: false | Faster sim, skips signature checks |
replaceRecentBlockhash | Refreshes blockhash for stale txs |
innerInstructions | Returns CPI breakdown |
accounts | Returns post-simulation account states |
// After simulation, set compute budget ix with headroom
const units = simulation.value.unitsConsumed ?? 200_000;
const limit = Math.ceil(units * 1.1);
const microLamports = Math.max(p75, 1_000);sigVerify: true before mainnet send.| Alternative | Use When | Don't Use When |
|---|---|---|
| Fixed priority fee | Low traffic devnet | Mainnet congestion periods |
| Jito tip APIs | Bundle landing | Simple transfers |
| Surfpool simulate | Fork-accurate DeFi | Wallet-only apps |
CLI solana confirm -v | Post-send debug | Pre-send planning |
Micro-lamports per compute unit for priority fee instruction - multiply by requested CU budget for total priority lamports.
Per transaction batch during congestion; less frequent on quiet devnet.
No on-chain spend - RPC compute only; some providers rate-limit heavy simulation.
Often yes with sigVerify: false - useful for partial signing flows.
Simulation informs SetComputeUnitLimit and SetComputeUnitPrice instruction values.
Helius and others wrap percentile estimates - fall back to getRecentPrioritizationFees for portability.
Fastest feedback during iterative debugging - match send commitment for final checks.
Yes if program returns error on insufficient output - read logs and err field.
Use getBase64EncodedWireTransaction when building txs with kit pipelines before simulate.
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 16, 2026