services
Get a key

library / Use cases / UC0040

Token transfer volume report

A transfer of a token is a change in that mint's balances inside a transaction. A script lists the newest transactions of a mint, reads each and prints volume, the largest transaction and top receivers, sized to your plan's limits.

By Carbium · Analytics and research · UC0040 · updated 2026-11-22

01

A transfer is a balance change

The chain keeps no table of transfers per mint. A transfer is something you derive: a transaction in which the balances of that mint changed. The metadata of every transaction lists each token account it touched, with the mint, the owner wallet, the decimals and the amount before and after. Subtract the two and you know who gained, who gave and how much moved.

Reading balances is easier than reading instructions. Tokens move through a direct transfer, a checked transfer, a mint, a burn, and through other programs that call the token program on a caller's behalf. Each shape needs its own decoder, and a new program brings a new shape. The balance lists look the same for all of them, so one rule covers every route in and out of a mint's accounts.

The report defines volume as the sum of every positive owner change for the mint inside a transaction, added over the transactions read. A send of 50 is 50. A mint of 10 is 10, because the receiving wallet gains it. A burn shows no gain and adds nothing. Changes are summed per owner first. A wallet can own several token accounts for one mint, and a move between two of its own accounts nets to zero and counts as nothing.

02

Listing the transactions of a mint

getSignaturesForAddress called with the mint address returns the signatures of transactions that include the mint in their account list, newest first. A page holds up to 1,000 signatures and before pages back from the oldest one you hold. The call costs 50 cells whatever the page size, so a wide page spreads that cost over more signatures than a narrow one.

The list comes from an address index that keeps up to 30 days. An empty page past that point means the index ran out, and the mint may have older transactions that this call cannot show. Paging back reaches every listed transaction of the last 30 days and none older.

Every entry carries an err field. A transaction that failed on chain moved no tokens, so the report skips the lookup for it and saves 50 cells. On a busy mint most of the newest signatures can be failed attempts, which is why the report asks for a full page and keeps only the successful ones.

03

The report script

The script takes a mint address and, optionally, how many transactions to read, capped at 15. It lists one page of up to 1,000 signatures, keeps the newest of that many with no err, reads those at once with getTransaction and nets the balances per owner. It prints one line per transaction that moved tokens, with its signature and amount, followed by the owners that gave and the owners that gained in that transaction. Then comes one summary: how many signatures were listed, how many failed on chain, how many moved tokens, the total volume, the largest transaction and the three wallets that received the most. Amounts are base-unit strings from the RPC, so the sums run in BigInt and the decimals come from the balance entries. It reads CARBIUM_KEY, exits with a message when it is unset, and signs and sends nothing.

main.ts
// UC0040 · Token transfer volume report// https://carbium.sh/library/usecase/token-transfer-volume-report// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MIT// Read-only: totals how much of one mint moved in its newest successful transactions, from the token balances each one records.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); }if (!process.argv[2]) { console.error("Usage: node main.ts <mint> [transactions, at most 15]"); process.exit(1); }const mint = address(process.argv[2]); // throws on anything that is not an addressconst want = Math.min(Math.max(Number(process.argv[3] ?? 12) || 12, 1), 15); // 1 list + 15 reads = 800 cells, inside the 1,024-cell burstconst url = process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh";const rpc = createSolanaRpcFromTransport(createDefaultRpcTransport({ url, headers: { "x-api-key": key } }));type Bal = { mint: string; owner?: string; uiTokenAmount: { amount: string; decimals: number } };type Tx = { meta: { preTokenBalances?: Bal[]; postTokenBalances?: Bal[] } | null } | null;// One page of up to 1,000 signatures (50 cells); the report reads the newest `want` of them that did not fail.const sigs = await rpc  .getSignaturesForAddress(mint, { commitment: "confirmed", limit: 1000 })  .send()  .catch((e: Error) => { console.error(`list failed: ${e.message}`); return process.exit(1); });const live = sigs.filter((s) => !s.err).slice(0, want); // a failed transaction moved no tokensconst reads = await Promise.allSettled(live.map((s) => rpc  .getTransaction(s.signature, { commitment: "confirmed", encoding: "jsonParsed", maxSupportedTransactionVersion: 1 })  .send() as unknown as Promise<Tx>));let decimals = 0, volume = 0n, largest = 0n, moved = 0, nulls = 0, errors = 0;const gained = new Map<string, bigint>();const lines: { sig: string; n: bigint; gave: string[]; got: string[] }[] = [];reads.forEach((r, i) => {  if (r.status === "rejected") { errors++; console.error(`${live[i].signature}: ${r.reason?.message ?? r.reason}`); return; }  const meta = r.value?.meta;  if (!meta) { nulls++; return; }  // Net change per owner for this mint: after minus before, summed over the owner's accounts.  const net = new Map<string, bigint>();  for (const [list, sign] of [[meta.preTokenBalances, -1n], [meta.postTokenBalances, 1n]] as const) {    for (const b of list ?? []) {      if (b.mint !== mint || !b.owner) continue;      decimals = b.uiTokenAmount.decimals;      net.set(b.owner, (net.get(b.owner) ?? 0n) + sign * BigInt(b.uiTokenAmount.amount));    }  }  let inTx = 0n;  for (const [owner, d] of net) if (d > 0n) { inTx += d; gained.set(owner, (gained.get(owner) ?? 0n) + d); }  if (inTx > 0n) {    moved++; volume += inTx; if (inTx > largest) largest = inTx;    const who = (up: boolean) => [...net].filter(([, d]) => (up ? d > 0n : d < 0n)).map(([o]) => o);    lines.push({ sig: live[i].signature, n: inTx, gave: who(false), got: who(true) });  }});const fmt = (n: bigint) => (Number(n) / 10 ** decimals).toLocaleString("en-US", { maximumFractionDigits: 2 });for (const l of lines) {  console.log(`moved ${fmt(l.n)}  ${l.sig}`);  console.log(`  from ${l.gave.join(", ") || "no owner (a mint)"}`);  console.log(`  to   ${l.got.join(", ")}`);}console.log(`${mint}: ${sigs.length} signatures listed, ${sigs.filter((s) => s.err).length} failed on chain, ${live.length} read, ${moved} moved tokens, ${nulls} answered null, ${errors} reads failed`);console.log(`volume ${fmt(volume)}, largest transaction ${fmt(largest)} (token units)`);for (const [owner, n] of [...gained].sort((a, b) => (a[1] < b[1] ? 1 : a[1] > b[1] ? -1 : 0)).slice(0, 3)) {  console.log(`  received ${fmt(n)}  ${owner}`);}

run: CARBIUM_KEY=$CARBIUM_KEY node main.ts <mint> [transactions]

The reads go through Promise.allSettled. A read that fails or answers null is printed and counted, and the report covers the rest. Every call runs at confirmed commitment.

The lookup passes maxSupportedTransactionVersion: 1 with the jsonParsed encoding. Mainnet carries v1 transactions, and with the field absent or 0 a lookup answers -32015 for one and charges nothing.

04

Sizing a report to your plan

Both calls cost 50 cells, the admission charge per call. A rate class absorbs bursts up to 1,024 cells or one second of its rate, whichever is larger. One list and 15 reads come to 800 cells, so the run fits inside the burst on every plan and a first report starts without waiting. After the burst the plan rate sets the pace.

PlanLists per secondReads per secondReads per minute after the burst
Free0.240.2414
Dev1.21.272
Business1005300
Pro500251,500

The read rate is the ceiling. A mint with 100,000 transactions in a day needs 100,000 reads to cover it, which is 4,000 seconds of reading at Pro's 25 per second. Free at 0.24 per second suits a report over a few dozen transactions. Page back with before for a wider window and read in batches of the size your plan refills.

An account's keys share one budget, so a second key for the report adds no room.

05

From one report to a daily series

Run the script on a schedule and store each summary to get volume over time. A scheduled run has to read every successful signature since the stored until mark, which means lifting the 15-read cap and paging, because a 12-transaction slice per run adds up to no volume series on a busy mint. To avoid reading a transaction twice, keep the newest signature you finished and pass it as until on the next list call. For the holder side of a mint, see Token holder tracker. For a live view, logsSubscribe with a mention of the mint pushes each new signature as it lands, and the same lookup and netting follow. Push removes the list calls and leaves the reads, so the read rate in the table still caps a busy mint.

06

Where it ends

  • A plain transfer instruction names the source, the destination and the authority, and never the mint. Such a transaction is absent from the mint's signature list unless another instruction in it names the mint, so the report undercounts a mint that moves mostly by plain transfer. To check, list one known token account of the mint with getSignaturesForAddress and compare its moves with what the report counts for that owner.
  • A launch-day total or a quarterly figure cannot come from one run. It comes only from summaries you stored on earlier runs.
  • getTransaction can answer null for an older signature that the list returned, because the index reaches below the validator's ledger floor. The script counts these. Prove the report on the newest signatures.
  • The default report covers the newest 12 successful signatures from a 1,000-signature page, which on a busy mint spans seconds. Its numbers describe that slice. A figure for a day needs a day of reads.
  • Volume is counted per owner inside each transaction, so a hop that passes the token through a wallet nets to zero there and counts once. A pool vault or an exchange account shows up as a receiver like any wallet. Filter those owners out if your definition excludes them.
  • Units are the token's own, divided by its decimals. A figure in dollars needs a price you bring. A Token-2022 mint with a transfer fee delivers less than the sender's side shows, and the report counts what arrived.
07

When it goes wrong

what goes wrongwhat to do
getTransaction answers -32015.Set maxSupportedTransactionVersion: 1 in the options of your getTransaction call, next to the encoding.
The report lists many signatures but few moved tokens.The list holds every transaction that names the mint, including failed ones and ones that only read it. The moved count is the number to use. A low one on a busy mint means the newest slice held little real movement.
The run ends with 429.A full run is 800 cells and fits the burst, yet a Free key also gets 429 when its network's shared budget runs out, and a call can wait for a validator permit before the 429 comes. A rerun on Free has to wait for the read bucket to refill: 750 cells at 0.24 reads per second of 50 cells is about a minute. Wait for the retry-after hint, then run again.
Reads answer null for signatures the list just returned.The summary line shows the null count. A high one means the slice reached old signatures, so take the report from the newest ones.
Paging back ends on an empty page well before your start date.Stop paging there. Store each report as you go to build history from now on.
08

Questions

Can I list every transfer since the mint was created?

No. Run the report on a schedule and keep each summary. Stored results are the only record that grows past the index window.

Why sum balances and skip the instruction amounts?

Instructions come in many shapes and some programs move tokens inside their own logic. The balance lists carry the same fields for every route, and per owner netting removes the double count from accounts one wallet owns twice.

How many transactions can one report read?

The script caps a run at 15, which with the list call comes to 800 cells and fits the burst on every plan. A larger window needs several runs that page back with before, paced to the read rate of your plan.

Does the volume come out in dollars?

No. It is in token units after dividing by the decimals of the mint. Multiply by a price from your own source for a dollar figure.