Programs

Priority fees and Jito tips, decoded from instructions

Everything a transaction will pay to land is written in its bytes: the signature fee, the priority fee and any Jito tip. This recipe reads all three in legacy, v0 and v1 transactions, and its fee total matched what mainnet charged on every one of 915 real transactions.

To read the priority fee and Jito tip from a transaction, decode three things. Compute Budget instructions give the unit price and limit in legacy and v0; the v1 configuration mask gives the priority fee directly. Signatures, including those precompiles verify, give the base fee. Tips are System transfers to the published tip accounts.

Programs, accounts and sources#

WhatValueWhere it comes from
Compute Budget programComputeBudget111111111111111111111111111111solana-sdk program IDs
System program11111111111111111111111111111111solana-sdk program IDs
Signature-verify programsEd25519, secp256k1 and secp256r1, listed on the program IDs pagesolana-sdk program IDs
Jito tip accountseight accounts, from getTipAccountsthe Jito Block Engine, at run time
Fee per signature5,000 lamportsSolana fee documentation

Fetch the tip accounts when your receiver starts and refresh them now and then. The answer on 18 November 2026 listed eight accounts; the code below never hard-codes them.

Where the fee sits in each format#

Legacy and v0v1
Priority feeunit price (micro-lamports, Compute Budget tag 3) times unit limit, divided by one million, rounded upa u64 of total lamports, present when bits 0 and 1 of the configuration mask are set
Unit limitCompute Budget tag 2, capped at 1,400,000; if absent, a default from the instruction countthe configuration mask, bit 2; not needed for the fee
Compute Budget instructionsusedignored for the fee
Base fee5,000 lamports per signature, including precompile signaturesthe same

The arithmetic for legacy and v0 is worked through on reading the priority fee from a transaction, and the instruction tags are on Compute Budget instructions. Transaction v1 shows the configuration mask byte by byte.

The default limit is where decoders most often go wrong. With no tag 2 instruction, each top-level instruction adds 200,000 units, unless its program is one that Agave charges as a builtin, which adds 3,000. In Agave 4.4.1 that list is System, Compute Budget, the four loaders, secp256k1 and Ed25519. Stake, Address Lookup Table and secp256r1 are not on it and add 200,000 like any program.

Signatures you cannot see in the signature list#

A transaction can ask a signature-verify program to check signatures carried inside its instruction data. Each of those is charged like a transaction signature. The first byte of each such instruction is the number of signatures it verifies, so the count is still readable from the bytes. One v0 transaction in our fixtures had a single signature in its list and an Ed25519 instruction verifying one more: it paid 10,000 lamports in signature fees, not 5,000.

Finding Jito tips#

A Jito tip is an ordinary System program transfer whose recipient is one of the tip accounts. Nothing else marks it: no special instruction and no flag. So detection is a set lookup on the transfer's destination, done after the transfer is decoded.

In our fixtures, 74 top-level transfers went to tip accounts, 7,415,031 lamports in all. Tips sent from inside another program, for example by a bundling contract, are inner instructions and do not appear in the transaction bytes, so a shred decoder misses them; count them later from executed data if they matter.

Steps#

  1. Fetch the tip accounts once at startup with fetchTipAccounts.
  2. For each decoded transaction, build its key list: static keys, then any addresses loaded from lookup tables. Compute Budget and System calls are top level, so in practice their program IDs are always static.
  3. Call feesOf. It returns the signature count, both fees, the unit limit and where it came from, and the tips.
  4. Store total as the fee the payer will be charged if the transaction lands, and the tips separately: tips are transfers, not fees.
  5. Once the transaction is confirmed, meta.fee from RPC is the final word; this recipe matched it exactly in our tests.

src/fees.ts#

src/fees.ts
// What a transaction pays, read from its bytes alone: signature fee, priority fee and Jito tips.
// Sources: Solana fee docs; Agave v4.4.1 program-runtime execution_budget.rs (default compute limits) and
// builtins-default-costs (which programs count as builtins); SIMD-0385 (v1 config mask). See L12, L13 and T-10.
import type { Tx } from "./tx.ts";
export const LAMPORTS_PER_SIGNATURE = 5_000n;
const COMPUTE_BUDGET = "ComputeBudget111111111111111111111111111111";
const SYSTEM = "11111111111111111111111111111111";
// Precompiles: the first data byte of each instruction is the number of signatures it verifies, and each one is charged.
const PRECOMPILES = new Set(["Ed25519SigVerify111111111111111111111111111", "KeccakSecp256k11111111111111111111111111111",
"Secp256r1SigVerify1111111111111111111111111"]);
// Programs that cost 3,000 units, not 200,000, when no limit is requested (Agave v4.4.1 NON_MIGRATING_BUILTINS_COSTS).
const BUILTINS = new Set([SYSTEM, COMPUTE_BUDGET, "BPFLoaderUpgradeab1e11111111111111111111111", "BPFLoader1111111111111111111111111111111111",
"BPFLoader2111111111111111111111111111111111", "LoaderV411111111111111111111111111111111111", "KeccakSecp256k11111111111111111111111111111",
"Ed25519SigVerify111111111111111111111111111"]);
const MAX_UNITS = 1_400_000, DEFAULT_UNITS = 200_000, BUILTIN_UNITS = 3_000;
export type Fees = {
signatures: number; // transaction signatures plus those verified by precompile instructions
signatureFee: bigint; // lamports
computeUnitLimit: number | null; // the requested limit, or the default; null for v1 without a limit (not needed for its fee)
limitSource: "instruction" | "default" | "v1 config" | "none";
microLamportsPerUnit: bigint | null; // legacy and v0 only
priorityFee: bigint; // lamports
total: bigint; // signatureFee + priorityFee: what the fee payer is charged if the transaction lands
tips: { to: string; lamports: bigint }[]; // top-level System transfers to a tip account
};
/** keys: static keys followed by any addresses loaded from lookup tables. tipAccounts: from getTipAccounts. */
export function feesOf(tx: Tx, keys: string[], tipAccounts: Set<string>): Fees {
const prog = (ix: Tx["instructions"][number]) => keys[ix.programIndex];
const signatures = tx.signatures.length + tx.instructions.filter((ix) => PRECOMPILES.has(prog(ix))).reduce((n, ix) => n + (ix.data[0] ?? 0), 0);
const signatureFee = LAMPORTS_PER_SIGNATURE * BigInt(signatures);
let priorityFee = 0n, computeUnitLimit: number | null = null, microLamportsPerUnit: bigint | null = null;
let limitSource: Fees["limitSource"] = "none";
if (tx.version === 1) {
// v1: the config mask carries the priority fee as total lamports; Compute Budget instructions are not used for fees.
priorityFee = tx.config?.priorityFeeLamports ?? 0n;
if (tx.config?.computeUnitLimit !== undefined) { computeUnitLimit = tx.config.computeUnitLimit; limitSource = "v1 config"; }
} else {
for (const ix of tx.instructions) {
if (prog(ix) !== COMPUTE_BUDGET || !ix.data.length) continue;
const v = new DataView(ix.data.buffer, ix.data.byteOffset, ix.data.byteLength);
if (ix.data[0] === 2 && ix.data.length >= 5) { computeUnitLimit = Math.min(v.getUint32(1, true), MAX_UNITS); limitSource = "instruction"; }
if (ix.data[0] === 3 && ix.data.length >= 9) microLamportsPerUnit = v.getBigUint64(1, true);
}
if (computeUnitLimit === null) {
computeUnitLimit = Math.min(tx.instructions.reduce((n, ix) => n + (BUILTINS.has(prog(ix)) ? BUILTIN_UNITS : DEFAULT_UNITS), 0), MAX_UNITS);
limitSource = "default";
}
if (microLamportsPerUnit) priorityFee = (microLamportsPerUnit * BigInt(computeUnitLimit) + 999_999n) / 1_000_000n; // round up
}
const tips: Fees["tips"] = [];
for (const ix of tx.instructions) {
if (prog(ix) !== SYSTEM || ix.data.length !== 12) continue;
const v = new DataView(ix.data.buffer, ix.data.byteOffset, ix.data.byteLength);
const to = keys[ix.accounts[1]];
if (v.getUint32(0, true) === 2 && tipAccounts.has(to)) tips.push({ to, lamports: v.getBigUint64(4, true) });
}
return { signatures, signatureFee, computeUnitLimit, limitSource, microLamportsPerUnit, priorityFee, total: signatureFee + priorityFee, tips };
}
/** The Jito tip accounts, from the Block Engine. Fetch at startup and refresh now and then; never hard-code them. */
export async function fetchTipAccounts(blockEngineUrl = "https://mainnet.block-engine.jito.wtf"): Promise<Set<string>> {
const r = await fetch(`${blockEngineUrl}/api/v1/getTipAccounts`, { method: "POST", headers: { "content-type": "application/json" },
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "getTipAccounts", params: [] }) });
const j = await r.json();
if (!Array.isArray(j.result)) throw new Error("getTipAccounts: " + JSON.stringify(j.error ?? j));
return new Set<string>(j.result);
}

src/decode-fees.ts: one transaction#

src/decode-fees.ts
// Print what one transaction pays: signature fee, priority fee and Jito tips.
// node src/decode-fees.ts <transaction-base64> [loaded-writable,...] [loaded-readonly,...]
import { decodeTx } from "./tx.ts";
import { feesOf, fetchTipAccounts } from "./fees.ts";
const [txBase64, loadedW = "", loadedR = ""] = process.argv.slice(2);
const tipAccounts = await fetchTipAccounts(); // in a long-running receiver, fetch once at startup and refresh periodically
const tx = decodeTx(Buffer.from(txBase64, "base64"));
const keys = [...tx.staticKeys, ...loadedW.split(",").filter(Boolean), ...loadedR.split(",").filter(Boolean)];
const fees = feesOf(tx, keys, tipAccounts);
console.log(JSON.stringify({ signature: tx.signatures[0], version: tx.version, ...fees }, (_k, v) => (typeof v === "bigint" ? v.toString() : v)));

Three real transactions#

Fieldv0, price and tipv1, config feev0, precompile
signature3eYBYhawBrUJvCCn5BaS33d4TJ7F9xAeAkDn6yh78Eh1m68ihmLcK2a6YrubRc4Sic7JjJ87vj3o2S2oisLXK4Tm36rFNmu3EShgKrPSipWyK6A8Yn58jWuHYrByCDDJCFVKzLCMiAGu4mFD4hw5zVKABJnenQSYmhbTWUhJfPsUKiuy5FQvmxcEHsbdbDEHofhpkB87qqhEKAXZY1pVzN8pMkqmiC4ZuWsvMW2XuFuqnrQfpk7D8f5YnUuDjYv5dTmtiEoq
signatures charged112 (1 listed, 1 verified by Ed25519)
unit limit20,493, from an instruction4,000, from the config278,384, from an instruction
unit price150,000 micro-lamportsnone: v1 has no price1,509 micro-lamports
priority fee3,074 lamports6,223 lamports421 lamports
total fee8,074 lamports11,223 lamports10,421 lamports
meta.fee from RPC8,07411,22310,421
Jito tip10,000 lamportsnonenone

All three come from slot 470,901,815. In the first, 150,000 times 20,493 is 3,073,950,000, which divided by one million is 3,073.95, rounded up to 3,074.

How this code was tested#

GroupTransactionsTotal fee equals meta.fee
legacy, default limit3939/39
legacy, limit from an instruction171171/171
v0, default limit3434/34
v0, limit from an instruction375375/375
v0 with a precompile signature11/1
v1, config295295/295
Tips found74 transfers56/56 equal the tip account's balance change, where that transfer was the only one into it

The 915 transactions are every distinct transaction in our fixtures: two full mainnet blocks plus the per-program samples, failed ones included, because failed transactions are charged too. The test is test-fees.ts in the examples' test-all.sh; fetchTipAccounts was run against the Block Engine on 18 November 2026 and returned the same eight accounts as the saved answer.

What the bytes cannot tell you#

The fee is what the payer is charged if the transaction lands. It says nothing about whether it lands, and a failed transaction pays it too. The builtin list behind the default limit belongs to the validator software and can change with a release or feature gate, so keep comparing against meta.fee. Tip detection depends on a current tip account list and sees only top-level transfers. And a tip or fee is not proof of priority: inclusion is the leader's choice.

For when a transaction stops being able to land, see blockhash expiry; to settle fees against confirmed blocks, the reconcile recipe. To compute fees on transactions as the leader sends them, compare the plans.

Sources#

Raw shreds on your own server

Ultra Low Latency Shreds is $200 and Standard Shreds is $100. You pay in crypto, tell us which IPv4 address and UDP port should receive the stream, and we wire it up by hand.