How to see the priority fee a Solana transaction paid

A Solana transaction's fee is one number, meta.fee, with the priority fee hidden inside it. The price per compute unit sits in a base58 instruction the RPC does not decode. Here is how to split the fee, read what the sender asked for, and check the two agree.

The formula

Note the limit, not the units used. You pay for the compute you reserve.

The Compute Budget instructions

They are instructions to ComputeBudget111111111111111111111111111111. The first byte of the data says which one; the rest is a little-endian integer:

First byteInstructionValue
2SetComputeUnitLimitu32, compute units
3SetComputeUnitPriceu64, micro-lamports per compute unit
1RequestHeapFrameu32, bytes
4SetLoadedAccountsDataSizeLimitu32, bytes

With no SetComputeUnitLimit, the runtime uses a default: 200,000 compute units per top-level instruction, 3,000 for builtin programs such as System and Compute Budget, capped at 1,400,000.

Working code, zero dependencies

Save as priority-fee.mjs and run node priority-fee.mjs [signature]. Node 20+, the free public mainnet RPC unless you set SOLANA_RPC_URL.

// priority-fee.mjs: node priority-fee.mjs [signature]. Node 20+, no dependencies
const RPC = process.env.SOLANA_RPC_URL || "https://api.mainnet-beta.solana.com";
const signature = process.argv[2] ?? "x2nTgvSFFneAKW5W5mHcfMYhzen5o7Lfb1pBmepDQQDJZ4ud2Z7QpDxdYVVTVMDqG2e5TJ1qAA8zGDPAxdpudKR";
const COMPUTE_BUDGET = "ComputeBudget111111111111111111111111111111";

// Instruction data is base58. A few lines decode it.
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
function base58(s) {
  let n = 0n;
  for (const c of s) n = n * 58n + BigInt(ALPHABET.indexOf(c));
  const out = [];
  while (n > 0n) { out.unshift(Number(n & 255n)); n >>= 8n; }
  for (const c of s) { if (c !== "1") break; out.unshift(0); }
  return Uint8Array.from(out);
}
const readLE = (b, at, len) => { let v = 0n; for (let i = len - 1; i >= 0; i--) v = (v << 8n) | BigInt(b[at + i]); return v; };

const res = await fetch(RPC, {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "getTransaction",
    params: [signature, { encoding: "jsonParsed", maxSupportedTransactionVersion: 0 }] }),
});
const { result: tx } = await res.json();

// 1. What it paid: total fee minus 5,000 lamports per signature
const fee = tx.meta.fee;
const base = 5000 * tx.transaction.signatures.length;
console.log(`fee ${fee} = base ${base} + priority ${fee - base} lamports`);

// 2. What it asked for: the Compute Budget instructions
const ixs = tx.transaction.message.instructions;
let limit = null, price = 0n;
for (const ix of ixs) {
  if (ix.programId !== COMPUTE_BUDGET) continue;
  const b = base58(ix.data);
  if (b[0] === 2) limit = Number(readLE(b, 1, 4)); // SetComputeUnitLimit(u32)
  if (b[0] === 3) price = readLE(b, 1, 8);         // SetComputeUnitPrice(u64, micro-lamports per CU)
}
// No SetComputeUnitLimit: 200,000 CU per top-level instruction, 3,000 for builtins like Compute Budget and System
const BUILTINS = new Set([COMPUTE_BUDGET, "11111111111111111111111111111111"]);
limit ??= Math.min(1_400_000, ixs.reduce((s, ix) => s + (BUILTINS.has(ix.programId) ? 3000 : 200000), 0));
const declared = (price * BigInt(limit) + 999_999n) / 1_000_000n; // round up
console.log(`price ${price} micro-lamports/CU x limit ${limit} CU = ${declared} lamports`);
console.log(`used ${tx.meta.computeUnitsConsumed} CU`);

Two real mainnet transactions:

$ node priority-fee.mjs
fee 106500 = base 5000 + priority 101500 lamports
price 500000 micro-lamports/CU x limit 203000 CU = 101500 lamports
used 255 CU

$ node priority-fee.mjs 2axWwMEc9F41wpeitiAzxfqaByUEQSfX1ghp4AcdFmUXsa69jEYSgRqhhhoUgtMCBGv6sutdAZ6yAfKwKoLXBP1d
fee 8750 = base 5000 + priority 3750 lamports
price 25000 micro-lamports/CU x limit 150000 CU = 3750 lamports
used 83261 CU

In both, what the transaction paid matches what it asked for to the lamport.

Why the first one paid for 800 times the compute it used

The first transaction is a plain USDC transfer. It set a price of 500,000 micro-lamports per compute unit but no limit, so it was charged for the default 203,000 units (one token instruction at 200,000 plus the Compute Budget instruction at 3,000). It used 255. A SetComputeUnitLimit of, say, 1,000 would have cut the priority fee from 101,500 lamports to 500.

The second, a pump.fun buy, did it properly: a limit of 150,000 for 83,261 used, at a low price.

If you write a wallet or a bot: always set the limit, from a simulation plus a margin. If you analyse transactions: meta.computeUnitsConsumed against the limit is how you spot this.

v1 transactions are different

Version 1 transactions carry no Compute Budget instructions. Their budget is in message.transactionConfig, and the priority fee there is a total in lamports, not a per-unit price. Ask for them with maxSupportedTransactionVersion: 1; with 0 the RPC refuses with error -32015.

The same thing, finished

solana-tx-parse does all of the above for legacy, v0 and v1 transactions, including the builtin list, the v1 transactionConfig and the version retry, with no dependencies:

npm install github:blixvip/solana-tx-parse
import { parseTransaction } from "solana-tx-parse";

const tx = await parseTransaction("x2nTgvSFFneAKW5W5mHcfMYhzen5o7Lfb1pBmepDQQDJZ4ud2Z7QpDxdYVVTVMDqG2e5TJ1qAA8zGDPAxdpudKR");
console.log(tx.fee);
console.log(tx.computeUnits);
{
  lamports: 106500,
  sol: 0.0001065,
  baseLamports: 5000,
  priorityLamports: 101500,
  priorityLamportsDeclared: 101500,
  signatures: 1
}
{
  consumed: 255,
  limit: 203000,
  limitSource: 'default',
  priceMicroLamports: 500000
}

Or from a terminal: npx github:blixvip/solana-tx-parse <signature> prints a Fee and a Compute line.

Limits to know

Want it done for you?

This is the small, open version. Blix is the AI-powered Solana memecoin terminal it comes from: every pump.fun launch live, AI coin ratings, narratives, wallet and X tracking, and one-click trading with 0% fees. There is a public API and an MCP server too.

Start trading at blixvip.comJoin the Discord

Help build it

solana-tx-parse is open source and takes pull requests. There are good first issues with step-by-step instructions, and setup is git clone and npm test.

More guides

How to parse a Solana transaction in Node.js without web3.jssolana-tx-parseHow to read Token-2022 metadata in JavaScriptsolana-token-metaHow to parse a Solana swap transaction for any DEXsolana-swap-parserHow to stop Solana RPC 429 errors (Too Many Requests)solana-rpc-pool