---
id: UC0066
title: "Stablecoin supply dashboard"
url: https://carbium.sh/library/usecase/stablecoin-supply-dashboard
collection: Use cases
category: Analytics and research
revision: 1
updated: 2026-11-22
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Stablecoin supply dashboard

A cross-issuer view of stablecoin supply on Solana: read each mint's supply with one call, store snapshots in SQLite, and print every issuer's share of the set and its change since the last row, with a Token-2022 mint included.

## Supply is a mint field

Every SPL token mint account stores its own `supply`, the total base units in existence, next to its `decimals`. The number changes only when the mint authority mints or a holder burns, so a single read of the mint answers how much of a token exists. You never add up holder balances. [getTokenSupply](https://carbium.sh/docs#rpc) returns that field as `amount`, a string of base units, with `decimals` and a ready-made `uiAmountString`. The response also carries a `context.slot`, the slot the node answered at.

A stablecoin supply dashboard is that read repeated for several mints and written down. One row per mint per run gives you a series for each issuer, and from the series you can work out each issuer's share of the set at every point. Questions about holders are a different job. Carbium does not serve `getTokenLargestAccounts`, which answers [-32601](https://carbium.sh/docs#errors), and a supply chart has no use for it anyway.

Every supply read names `finalized`, so a stored row never needs correcting later.

## Choosing the mints

The tracked set is a list of mint addresses. The script starts with three, and adding an issuer means adding one line.

| Symbol | Mint | Token program | Decimals |
|---|---|---|---|
| USDC | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v | Token | 6 |
| USDT | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB | Token | 6 |
| PYUSD | 2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo | Token-2022 | 6 |

The address is the one input you have to get right. A look-alike token with the same ticker has its own mint and its own supply, and the chart would happily plot it. Copy each address from the issuer's own list of Solana mints and open it in an explorer before you trust it. The script stores the `decimals` the node returns beside every amount, so a wrong assumption about decimals cannot hide in the data.

PYUSD is a Token-2022 mint, and `getTokenSupply` answers for either token program in the same shape, so the script has no branch for it. Token-2022 mints can carry extensions, and two of them touch a supply reading. An interest-bearing or scaled-amount mint turns raw base units into a displayed amount through a rate, so compare the raw `amount` between runs and treat `uiAmountString` as a display value. A transfer-fee mint keeps its withheld fees inside token accounts, and those fees stay part of the supply. For a first look at one mint and its authorities, [Token mint supply and authorities](https://carbium.sh/library/howsolana/token-mint-supply-and-authorities) goes through the mint account field by field.

## Snapshot, delta and share

The script reads each mint inside `Promise.allSettled`, so one failing mint prints its error and the others still land. The transport is kit's `createDefaultRpcTransport` pointed at the [RPC endpoint](https://carbium.sh/docs#endpoints), with the key in the [`x-api-key` header](https://carbium.sh/docs#auth). Rows go into a `supply.db` file in the working directory through `node:sqlite`. The amount is stored as text and read back as a BigInt, since a supply in base units can outgrow what a JavaScript number holds exactly.

`main.ts` (run: `CARBIUM_KEY=$CARBIUM_KEY node main.ts`)

```ts
// UC0066 · Stablecoin supply dashboard
// https://carbium.sh/library/usecase/stablecoin-supply-dashboard
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

// Read-only: stablecoin supply per mint, stored in SQLite, with each mint's share of the set and change since its last row.
import { DatabaseSync } from "node:sqlite";
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 } }));

// Copy each address from the issuer's own list before you trust it. PYUSD is a Token-2022 mint.
const MINTS: [string, string][] = [
  ["USDC", "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"],
  ["USDT", "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"],
  ["PYUSD", "2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo"],
];
type Row = { symbol: string; slot: bigint; amount: bigint; decimals: number };

const results = await Promise.allSettled(MINTS.map(async ([symbol, mint]): Promise<Row> => {
  const { context, value } = await rpc.getTokenSupply(address(mint), { commitment: "finalized" }).send();
  return { symbol, slot: context.slot, amount: BigInt(value.amount), decimals: value.decimals };
}));
const rows: Row[] = [];
results.forEach((r, i) => {
  if (r.status === "fulfilled") rows.push(r.value);
  else console.error(`${MINTS[i]![0]} failed: ${r.reason instanceof Error ? r.reason.message : String(r.reason)}`);
});
if (rows.length === 0) process.exit(1);

// Scale every amount to 18 decimals so mints with different decimals compare fairly.
const scale = (r: Row) => r.amount * 10n ** BigInt(18 - r.decimals);
const total = rows.reduce((s, r) => s + scale(r), 0n);

const db = new DatabaseSync("supply.db");
db.exec("CREATE TABLE IF NOT EXISTS supply (taken_at TEXT, symbol TEXT, slot INTEGER, amount TEXT, decimals INTEGER)");
const last = db.prepare("SELECT amount FROM supply WHERE symbol = ? ORDER BY rowid DESC LIMIT 1");
const put = db.prepare("INSERT INTO supply VALUES (?, ?, ?, ?, ?)");
const units = (n: bigint, d: number) => (Number(n) / 10 ** d).toLocaleString("en-US", { maximumFractionDigits: 2 });
const taken = new Date().toISOString();

for (const r of rows) {
  const prev = last.get(r.symbol) as { amount: string } | undefined;
  const change = prev ? r.amount - BigInt(prev.amount) : undefined;
  const share = (Number((scale(r) * 10000n) / total) / 100).toFixed(2);
  const delta = change === undefined ? "first row" : `${change > 0n ? "+" : ""}${units(change, r.decimals)}`;
  console.log(`${r.symbol.padEnd(6)} ${units(r.amount, r.decimals).padStart(18)} ${share.padStart(6)}%  ${delta}`);
  put.run(taken, r.symbol, r.slot, r.amount.toString(), r.decimals);
}
const slots = rows.map((r) => r.slot);
const lo = slots.reduce((a, b) => (a < b ? a : b));
const hi = slots.reduce((a, b) => (a > b ? a : b));
console.log(`finalized slots ${lo} to ${hi}; shares cover ${rows.length} of ${MINTS.length} mints`);
```

Each run prints three columns per mint. Supply is printed in token units to two decimals. Share is the mint's slice of the tracked set, computed in integer math after every amount is scaled to 18 decimals, so mints with different decimals compare fairly. Change is the difference from the last stored row for that mint, or `first row` on a new database. Run it twice and the second run shows what moved in between. Put it on a cron job or a systemd timer and the file becomes your series.

A share only has meaning inside its set. Add a mint and every share shifts, so keep the list of tracked mints with the chart. The script stores amounts and computes shares at print time, which lets you change the set later and rebuild the whole history from the raw rows. To carry the series into a warehouse, [Token supply time series](https://carbium.sh/library/integrate/token-supply-time-series) shows the same data in a time-series store.

## Reading issuance and burns from deltas

Between two rows, a positive change means more was minted than burned in that interval, and a negative change means the reverse. The net is all the supply field can tell you. A mint of 50 million and a burn of 50 million between two rows looks like zero.

- Rows far apart hide churn. Rows closer together expose more of it, down to single mint and burn events, and cost more calls.
- A share can fall while the mint behind it is unchanged, because another tracked mint grew. Read the supply column before you blame the issuer whose share moved.
- Compare changes on the same footing. The script prints the span of finalized slots each run read, and a row taken far from the others should be flagged in your chart.
- To see the transaction behind a jump, list the mint's recent transactions with `getSignaturesForAddress` on the mint address, then read them with `getTransaction` and `maxSupportedTransactionVersion: 1`, since mainnet carries v1 transactions and Carbium answers -32015 for one when the value is absent or 0. A mint or burn lists the mint account, and so does every checked transfer, so filter by instruction type.

Carbium keeps those signature pages in its own [address index](https://carbium.sh/docs#migrate), which reaches back 30 days. A page that comes back empty past that is the index's age limit, and the mint may have older transactions. Your own table is therefore the long record: an issuance event from last quarter is visible only as a step between two of your rows.

## Where it ends

- On-chain supply is the Solana slice of an issuer. The same stablecoin on other chains is a separate supply, and this chart cannot add it.
- Supply says nothing about reserves. It counts tokens that exist, and whether an issuer holds assets behind them is a question for its own attestations.
- Supply is not circulation. Tokens sitting in issuer or treasury accounts count in full.
- A wrapped version of a stablecoin has its own mint and is invisible until you add that mint to the list.
- The call answers for the present. History before your first row has to come from your own earlier snapshots.
- A freeze, a pause or a blocked account leaves the supply number untouched.
- The script is read-only. It signs and sends nothing.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| A holder concentration view is attempted with getTokenLargestAccounts and every call fails. | Carbium does not serve it and answers -32601. Do not retry. A supply chart only needs getTokenSupply on the mint. |
| One mint's call fails and the shares of the others look inflated. | The script sums only the mints that answered and prints how many it covered. Shares come from the amounts read in that run, so rerun once the missing mint answers and read the covered count first. |
| Supply is compared as a float, or two mints with different decimals are compared in raw base units. | Keep the amount as a BigInt of base units, store it as text, and scale to a common number of decimals before computing a share. |
| The chart plots the wrong token because a mint address came from a search result. | Copy the address from the issuer's own list of Solana mints, then check it in an explorer. A look-alike with the same ticker has a different mint. |
| A longer list of mints starts to return 429. | `Promise.allSettled` sends every mint at once, so a long list can pass the rate limit together. Split the list into groups, and when a call gets [429](https://carbium.sh/docs#limits) wait the retry-after hint it carries before sending the next group. |

## Questions

### How do I read the supply of a stablecoin on Solana?

Call `getTokenSupply` with the mint address. It returns the raw `amount`, the `decimals` and the slot it answered at. One call per mint is enough.

### Is on-chain supply the same as circulating supply?

No. It counts every token that exists, including those held in issuer or treasury accounts, and it covers Solana only. Circulation and reserves come from the issuer.

### How do I add an issuer or a wrapped mint to the tracked set?

Add one line to the `MINTS` list with a symbol and the mint address copied from the issuer's own list of Solana mints. The new mint prints `first row` on its first run, and every other share shifts because a share is a slice of the set.

### Does a Token-2022 mint need different code?

Not for supply. `getTokenSupply` answers for either token program in the same shape. Compare the raw `amount` between runs, since an interest-bearing or scaled-amount extension changes the displayed value.

### Can I get the supply as it was last month?

Not from this call, which reports the present. Store a row each run and the history is yours from the first row on.

## Related

- [Token mint supply and authorities](https://carbium.sh/library/howsolana/token-mint-supply-and-authorities) (How to use Solana, HS0005)
- [Token supply time series](https://carbium.sh/library/integrate/token-supply-time-series) (Integrations, I0006)
- [carbium.sh/docs#rpc](https://carbium.sh/docs#rpc)
- [carbium.sh/docs#endpoints](https://carbium.sh/docs#endpoints)
- [carbium.sh/docs#auth](https://carbium.sh/docs#auth)
- [carbium.sh/docs#errors](https://carbium.sh/docs#errors)
- [carbium.sh/docs#migrate](https://carbium.sh/docs#migrate)
- [carbium.sh/docs#limits](https://carbium.sh/docs#limits)
