services
Get a key

library / How to use Solana / HS0005

Token mint supply and authorities

One TypeScript file takes a mint address, makes a single getAccountInfo read, and prints the token's supply, decimals, mint authority, freeze authority and owning program. It only reads: no keypair, no signature, no transaction.

By Carbium · SPL tokens · HS0005 · updated 2026-11-22

01

What a mint account holds

Every SPL token starts as a mint, one small on-chain account that defines the token. Balances sit in separate token accounts. The mint holds the facts every holder shares: how many units exist, how many decimals they carry, and who is still allowed to change that. Reading it answers the first questions anyone asks about an unfamiliar token.

A classic mint stores five fields: the supply as a raw integer, the decimals, an initialized flag, an optional mint authority and an optional freeze authority. It stores no name, symbol or logo. Those sit in a separate metadata account, or in an extension on a Token-2022 mint, and the file does not print them.

One getAccountInfo call with jsonParsed encoding returns the whole mint. The node decodes the bytes into named fields, so the file needs no byte-layout code and no extra package. The two authorities matter most:

  • Mint authority: the one address that can create new units. When it is null, the supply can only fall, through burns, and the field cannot be set again.
  • Freeze authority: the address that can freeze any token account of this mint, which stops its owner from moving the balance. Null means nobody can.
02

The code

Install @solana/kit at 8.6.0 and export CARBIUM_KEY. Node 24 strips the TypeScript types by itself, so node main.ts is the whole run command. The mint is an optional first argument and defaults to USDC.

main.ts
// HS0005 · Token mint supply and authorities// https://carbium.sh/library/howsolana/token-mint-supply-and-authorities// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { setTimeout as pause } from "node:timers/promises";import {  address,  createDefaultRpcTransport,  createSolanaRpcFromTransport,  isSolanaError,  SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR,} from "@solana/kit";const apiKey = process.env.CARBIUM_KEY;if (!apiKey) {  console.error("CARBIUM_KEY is missing: export your Carbium key and run again.");  process.exit(1);}const rpc = createSolanaRpcFromTransport(  createDefaultRpcTransport({    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",    headers: { "x-api-key": apiKey },  }),);const DEFAULT_MINT = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";const target = address(process.argv[2] ?? DEFAULT_MINT);type MintFields = {  decimals: number;  supply: string;  isInitialized: boolean;  mintAuthority: string | null;  freezeAuthority: string | null;  extensions?: { extension: string }[];};type ParsedData = { program: string; parsed?: { type: string; info: MintFields } };// Place the decimal point inside the text so no digit passes through a float.function withPoint(raw: string, decimals: number): string {  const padded = raw.padStart(decimals + 1, "0");  if (decimals === 0) return padded;  return padded.slice(0, -decimals) + "." + padded.slice(-decimals);}// Run a call; on one HTTP 429 sleep for the hinted seconds and run it again.async function retryOn429<T>(run: () => Promise<T>): Promise<T> {  try {    return await run();  } catch (err) {    if (!isSolanaError(err, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR) || err.context.statusCode !== 429) throw err;    const wait = Number(err.context.headers.get("retry-after")) || 1;    console.error(`rate limited, retrying in ${wait}s`);    await pause(wait * 1000);    return run();  }}const { value } = await retryOn429(() =>  rpc.getAccountInfo(target, { encoding: "jsonParsed", commitment: "finalized" }).send(),);if (!value) {  console.error(`No account at ${target}.`);  process.exit(1);}const data = value.data as unknown as ParsedData;if (data.parsed?.type !== "mint") {  console.error(`${target} is not a token mint (owner ${value.owner}).`);  process.exit(1);}const m = data.parsed.info;const rows: [string, string][] = [  ["mint", target],  ["program", `${value.owner} (${data.program})`],  ["supply", `${withPoint(m.supply, m.decimals)} (raw ${m.supply}, decimals ${m.decimals})`],  ["mint authority", m.mintAuthority ?? "none, supply cannot grow"],  ["freeze authority", m.freezeAuthority ?? "none, nobody can freeze accounts"],];if (m.extensions?.length) rows.push(["extensions", m.extensions.map((x) => x.extension).join(", ")]);for (const [label, text] of rows) console.log(`${label.padEnd(17)}${text}`);

run: node main.ts [mint-address]

The read passes commitment: "finalized". @solana/kit 8.6.0 fills in confirmed when a call leaves commitment out, so the file names the level it wants. Authorities change rarely, and you may act on the answer.

The withPoint function moves the decimal point inside the supply text, so no digit passes through a float. The cast on value.data is there because the node can answer with raw bytes when it cannot parse an account, and the check on type catches that case along with wallets and token accounts.

03

Reading the answer

The program that owns the account comes separately from the parsed fields, as owner.

FieldTypeMeaning
supplystringThe raw total as an integer, in the token's smallest unit.
decimalsnumberDigits after the decimal point. USDC uses 6.
isInitializedbooleanTrue for a usable mint.
mintAuthoritystring or nullAddress allowed to create new units, or null.
freezeAuthoritystring or nullAddress allowed to freeze token accounts of this mint, or null.
extensionsarrayToken-2022 only: one entry per extension, such as transferFeeConfig or permanentDelegate.

A supply of 1234567 with decimals of 6 reads as 1.234567. A u64 can hold 18,446,744,073,709,551,615, far above the 2^53 that a JavaScript number keeps exact, so the node sends supply as text. Keep it as a string or a BigInt in your own code too, and format it with the mint's own decimals at the end.

$A null authority says only that nobody holds that power. It says nothing about who holds most of the supply.

The supply is a snapshot. A live mint authority can raise it a moment later, and any holder can burn units, so two reads at different times can differ.

04

Classic and Token-2022 mints

Token-2022 is a second token program with its own program id, TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb. The classic program is TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA. The owner of the mint account says which one created it, and the file prints it next to the parsed program name. The same call and the same fields work for both.

A Token-2022 mint may carry extensions, and some change what holding the token means. transferFeeConfig takes a fee on every transfer. permanentDelegate names an address that can move or burn any holder's tokens. transferHook runs another program on each transfer. The file prints extension names so you know when to look closer. It does not print their settings.

!A Token-2022 mint with a permanentDelegate can still list both authorities as null. Check the extension list before you read the authorities as a clean bill.
05

On Carbium

Requests go to the URL in CARBIUM_RPC_URL, with https://services.carbium.sh as the fallback. The file builds one rpc client up front and sends every call through it.

An account read such as getAccountInfo costs 10 cells, and so do getMultipleAccounts and getTokenAccountBalance. The account-read allowance is 0.5 requests per second on Free, 15 on Dev, 50 on Business and 400 on Pro, so a Free key reads one mint every two seconds.

For a list of mints, hand the addresses to getMultipleAccounts with jsonParsed encoding: up to 300 pubkeys per call on Pro and 100 on Free, Dev and Business, where the 1,024-cell burst caps a call. Each pubkey costs 10 cells, and you get one parsed mint or null back per address. A JSON-RPC batch of up to 100 calls also works. @solana/kit has no batch method, so that route is a raw fetch POST with a JSON array body.

06

Where it ends

This reads the mint and nothing about its holders. Who holds the supply, and how concentrated it is, needs a ranking of holders. getTokenLargestAccounts does that on a full node and is not served on Carbium. It answers -32601, method not found, and a retry changes nothing.

Authorities are addresses, and the file prints them as given. A mint authority can be a wallet, a multisig or a program. One getAccountInfo on that address shows which, through its owner, and the file does not take that step.

There is no name, symbol or logo here. Those come from the token's metadata, which the file does not print.

07

When it goes wrong

what goes wrongwhat to do
No account at <mint>. and exit code 1.The node returned a null value: the address has a typo, was never created or has been closed. Check the string against an explorer.
<address> is not a token mint.You passed a wallet or a token account. A token account parses as type account. Use the mint address, which the token account's parsed info lists as mint.
An error thrown before any request leaves, naming the address.address() rejects a string that is not a base58 public key of 32 to 44 characters. Copy the address again without spaces or a trailing character.
HTTP 429 with a retry-after hint.The file has already waited and retried once, so a 429 that reaches you means the loop is too fast. Space the calls out, or pick a plan with a higher account-read allowance.
Error -32601 method not found from getTokenLargestAccounts.Carbium does not serve that method, so it will keep answering -32601. Do not retry it. Read the mint with this file and find holders from an index you own.
A supply that is off by a power of ten.You divided by the wrong decimals, or you went through a float. Use the decimals of this mint and keep supply as text or a BigInt until the last step.
08

Questions

Do I need a private key to read a token's info?

No. The call takes the mint address and returns its state. The Carbium key only identifies your account to the RPC.

Why finalized and not confirmed?

The file reads authorities, and an answer you act on should be settled. Finalized is also the level the node itself uses when a call names none.

Does a null mint authority fix the supply forever?

For minting, yes: the authority cannot be set again, so no new units appear. Holders can still burn units, and a Token-2022 mint can carry extensions that change transfers, so read the extension list too.

Where do I get the token's name and symbol?

Not from this file's output. They sit in the token's metadata account, or in a metadata extension on a Token-2022 mint. Both are account reads at the same 10 cells.

How do I check many mints at once?

Pass them to getMultipleAccounts with jsonParsed encoding, up to 100 pubkeys per call below Pro and 300 on Pro. It charges 10 cells per pubkey, so a 100-pubkey call costs 1,000 cells, or 1,001 with a body over 4 KiB.