library / AI and blockchain / SI0058
Fee-pressure sentiment index
A script that reads recent priority fees and slot fill over RPC and prints one on-chain urgency number from minus 100 to plus 100, with the parts behind it, so a model gets a mood reading without any social text.
Why fees carry mood
Sentiment tools usually read social posts and headlines. An engineer who wants a similar signal from the chain itself has a quieter source. When many senders want a transaction in the next few blocks, they pay extra for inclusion and the slots fill up. When interest drains away, priority fees fall to zero and slots run light. Nobody types a word, yet the aggregate says how hurried the crowd is.
That hurry is urgency, and urgency is the mood the index measures. It has no sign. A rush toward a token and a rush away from it cost the same fee, so the number says how worked up the chain is and nothing about which way it leans.
A model can use that in a prompt or a tool result: one figure with its parts is easier to reason over than a page of decoded transactions. The method stays at the aggregate level on purpose. Two RPC methods answer it, and neither needs getTransaction or any account decoding.
The two inputs
Fees say how much senders pay. Fill says how many transactions each slot carries. Together they separate a crowd that pays up from a chain that is simply busy with patient traffic.
| Input | Call | Window | Meaning |
|---|---|---|---|
| Fees | getRecentPrioritizationFees with one address | Up to 150 recent slots, one value each, about 30 seconds at 200 ms a slot | The minimum priority fee, in micro-lamports per compute unit, among transactions that wrote to the account in that slot |
| Fill | getRecentPerformanceSamples with a limit of 30 | 30 one-minute samples | numTransactions divided by numSlots: transactions per slot |
The address matters. A fee is only observed for transactions that take a write lock on the account, so a token mint that ordinary transfers only read has nothing to show. Pass an account that transactions write to, such as a busy pool or a program's state account. Called with no address, the fees call reports the network-wide floor, which stays at zero while any block has room. The file defaults to a well-known SOL and USDC pool.
Since the Alpenglow switch on 2026-10-21 a slot lasts about 200 ms and blocks carry no vote transactions, so numTransactions already counts user transactions and the per-slot figure needs no vote subtraction.
The index
Each input is split in time. The newest third is the recent window and the older two thirds are the baseline. For fees that means about 50 recent slots against 100 older ones. For the samples it means 10 minutes against 20.
For each input the file computes a lean: 100 * (recent - older) / (recent + older). It is 0 when the windows match, +100 when the baseline was zero and the recent value is positive, and -100 in the reverse case. Two zero windows give 0. A plain ratio blows up whenever the older value is zero, which fee windows often are, and this form stays finite and bounded by construction.
Fees enter as the 75th percentile of each window. The median sits at zero most of the time and hides a crowd that pays up, while the 90th percentile jumps on a single sender. The file prints the recent median and 90th percentile next to the index for context. Fill enters as transactions per slot, pooled over each window, so each sample counts by the slots it covered.
The index is the mean of the leans that came back, rounded to a whole number.
| Index | Reading |
|---|---|
| Above 25 | Urgency rising: senders pay more, or slots run fuller, than a moment ago |
| -25 to 25 | Steady |
| Below -25 | Urgency easing |
The cutoffs are starting points, so tune them against a day of your own readings. The two windows run at different speeds on purpose. Fees move within seconds and fill moves over minutes, so the index blends a fast and a slow view.
The file
The file runs on Node 24 with @solana/kit 8.6.0 and nothing else. Set CARBIUM_KEY first; it exits with a message when the key is missing, and CARBIUM_RPC_URL overrides the endpoint.
// SI0058 · Fee-pressure sentiment index// https://carbium.sh/library/si/fee-pressure-sentiment-index// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MIT// Fee-pressure sentiment index from two aggregate reads. Run: CARBIUM_KEY=... node main.ts [account]import { address, createDefaultRpcTransport, createSolanaRpcFromTransport } from "@solana/kit";const key = process.env.CARBIUM_KEY;if (!key) { console.error("Set CARBIUM_KEY to your Carbium API key."); process.exit(1);}const url = process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh";const rpc = createSolanaRpcFromTransport(createDefaultRpcTransport({ url, headers: { "x-api-key": key } }));// An account that transactions write to: a fee is only seen on write locks.const account = address(process.argv[2] ?? "58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2");const percentile = (xs: number[], p: number) => { const s = [...xs].sort((a, b) => a - b); return s.length ? s[Math.min(s.length - 1, Math.floor((p / 100) * s.length))] : 0;};// Newest first in, newest third and older two thirds out.const thirds = <T>(xs: readonly T[]) => { const k = Math.ceil(xs.length / 3); return [xs.slice(0, k), xs.slice(k)] as const;};const lean = (recent: number, older: number) => recent + older === 0 ? 0 : Math.round((100 * (recent - older)) / (recent + older));const parts: { name: string; recent: number; older: number; lean: number }[] = [];const add = (name: string, recent: number, older: number) => parts.push({ name, recent, older, lean: lean(recent, older) });const [fees, samples] = await Promise.allSettled([ rpc.getRecentPrioritizationFees([account]).send(), rpc.getRecentPerformanceSamples(30).send(),]);for (const [name, r] of [["getRecentPrioritizationFees", fees], ["getRecentPerformanceSamples", samples]] as const) { if (r.status === "rejected") console.log(`failed: ${name}: ${r.reason instanceof Error ? r.reason.message : String(r.reason)}`);}if (fees.status === "fulfilled" && fees.value.length) { const v = [...fees.value].sort((a, b) => Number(b.slot) - Number(a.slot)).map((x) => Number(x.prioritizationFee)); const [recent, older] = thirds(v); add("fee p75, micro-lamports per CU", percentile(recent, 75), percentile(older, 75)); console.log(`recent ${recent.length} of ${v.length} slots: fee p50 ${percentile(recent, 50)}, p90 ${percentile(recent, 90)}`);}if (samples.status === "fulfilled" && samples.value.length) { const [recent, older] = thirds(samples.value); const perSlot = (xs: readonly { numSlots: bigint; numTransactions: bigint }[]) => { const slots = xs.reduce((n, x) => n + Number(x.numSlots), 0); return slots ? xs.reduce((n, x) => n + Number(x.numTransactions), 0) / slots : 0; }; add("transactions per slot", perSlot(recent), perSlot(older));}if (!parts.length) { console.error("No component answered, so there is no index."); process.exit(1);}const index = Math.round(parts.reduce((n, p) => n + p.lean, 0) / parts.length);const mood = index > 25 ? "urgency rising" : index < -25 ? "urgency easing" : "steady";for (const p of parts) console.log(`${p.name}: recent ${p.recent.toFixed(1)}, older ${p.older.toFixed(1)}, lean ${p.lean}`);console.log(`index ${index} (${mood}) for ${account}`);console.log(JSON.stringify({ account, index, mood, parts }));
run: node main.ts
Run node main.ts for the default pool, or node main.ts <account> for your own. It prints the recent fee percentiles, one line per component with its recent value, older value and lean, then the index with its reading, and last a JSON line to hand a model as a tool result.
The two calls settle on their own. When one is refused, a failed: line names it and the index comes from the component that answered. When neither answers, the script says so and exits with code 1.
For the fee per compute unit in detail, see Priority fee per compute unit. For slot time and finalization in one status line, see Plain-English network status.
Where it ends
- The index measures urgency and has no direction. It says nothing about whether a token's price will rise or fall, and a spike is as likely to follow an outage, a mint or a crowded launch as a market move.
- One account is one crowd. A launch or an airdrop claim on the chosen account moves the index while the rest of the chain sits still. Run it on several accounts and compare them before calling the result a chain-wide mood.
- Thin windows swing. Fifty slots is a short sample, and an older window of zeros makes any positive fee read +100. Read the parts and the recent percentiles before acting on the index.
- The memory is short. The fee call reaches back about 30 seconds and the samples 30 minutes. A series comes from running the file on a timer and storing each output.
- An index near zero can mean steady or idle. The parts show which: zero fees with few transactions per slot is a quiet chain.
- The fee data covers landed transactions only. A sender who paid and missed the slot leaves no trace in it.
When it goes wrong
| what goes wrong | what to do |
|---|---|
| Every fee reading is 0 and the fee part never moves. | The account is one that transactions only read, such as a mint. Pass an account they write to, like a pool, a vault or a program's state account. |
| The index sits near 0 while the chain is clearly busy. | The index compares the recent third with the older two thirds, so a long busy stretch reads steady. Look at the recent values printed beside it for the level. |
| One call fails with 429. | The index still prints from the call that answered; run it again on the next minute for both parts. |
| A TypeError about mixing BigInt and other types. | Kit returns slots, counts and fees as bigint. Convert with Number() before arithmetic, as the file does. |
| address() throws on the argument. | The argument must be a base58 address of 32 bytes. Check for a stray quote or a truncated paste. |
| The index jumps to +100 or -100 on a quiet account. | The older window held only zeros, so any change is total. Read the component lines and the fee percentiles, or pick a busier account. |
Questions
Can I get Solana sentiment without social text?
Yes, as urgency. Priority fees and slot fill come from two aggregate RPC methods, and together they say how hurried senders are. They carry no direction, so read the result as intensity; bullish or bearish needs another source.
What does an index of +60 mean?
In the recent third, senders pay clearly more, or slots run clearly fuller, than in the older two thirds. The file prints both components, so you can see which one drove it.
How often should I run it?
The samples refresh about once a minute and the fee list moves every slot, so one run a minute catches both. Running more often returns the same performance samples.
Which account should I pass?
One that transactions write to and that sees steady use: a busy pool or a program's state account. Skip mints, which ordinary transfers only read.