services
Get a key

library / How to use Solana / Versioned transactions and lookup tables / HS0103

Lookup table usage finder

One TypeScript file samples a busy program's newest transactions, picks the ones that use an address lookup table, and lists the pubkeys they resolved from it with a use count. With no argument it chooses the most used table in the sample.

By Carbium · Versioned transactions and lookup tables · HS0103 · updated 2026-11-23

01

What the finder answers

An address lookup table is a list of up to 256 addresses stored in one account. A v0 transaction names a table and then points at entries by one-byte index, so the transaction itself never spells out the pubkeys it pulled from the table. A reader sees a table address and a few small numbers, nothing that says which wallets, mints or programs were involved.

The finder turns those numbers back into pubkeys and counts them. Given a table, it answers which pubkeys recent transactions loaded from it, how many transactions loaded each one, and whether the transaction asked for write access or read-only access. That is the usual shape of the job when you hold a table address and want to know what is really being touched through it.

Solana has no call that lists the transactions using a given table, so the file works from a sample. It takes the newest signatures of one busy program, fetches those transactions, and reads the lookups each one declares. Everything it prints is about that sample.

02

The code

Install @solana/kit at 8.6.0, export CARBIUM_KEY and run the file with Node 24, which strips the types on load. Pass a table address to inspect it, or pass nothing and the file counts the tables seen in the sample and takes the one used most.

main.ts
// HS0103 · Lookup table usage finder// https://carbium.sh/library/howsolana/lookup-table-usage-finder// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { address, createDefaultRpcTransport, createSolanaRpcFromTransport, getBase58Decoder, isAddress } from "@solana/kit";function fail(msg: string): never {  console.error(msg);  process.exit(1);}const apiKey = process.env.CARBIUM_KEY ?? fail("Set CARBIUM_KEY to your Carbium API key.");const client = createSolanaRpcFromTransport(  createDefaultRpcTransport({    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",    headers: { "x-api-key": apiKey },  }),);const PROGRAM = address("JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4");const TABLE_PROGRAM = "AddressLookupTab1e1111111111111111111111111";const SAMPLE = 15;const HEADER_BYTES = 56;const base58 = getBase58Decoder();type Lookup = { accountKey: string; writableIndexes: number[]; readonlyIndexes: number[] };const given = process.argv[2];if (given && !isAddress(given)) fail(`${given} is not an address.`);const sigs = await client  .getSignaturesForAddress(PROGRAM, { limit: SAMPLE })  .send()  .catch((e: Error) => fail(`getSignaturesForAddress failed: ${e.message}`));const settled = await Promise.allSettled(  sigs.map((s) =>    client.getTransaction(s.signature, { encoding: "json", maxSupportedTransactionVersion: 1 }).send(),  ),);const found: Lookup[] = [];let nulls = 0;let errors = 0;for (const r of settled) {  if (r.status === "rejected") {    errors++;    console.error(`getTransaction failed: ${(r.reason as Error).message}`);  } else if (!r.value) {    nulls++;  } else {    const msg = r.value.transaction.message as unknown as { addressTableLookups?: Lookup[] };    found.push(...(msg.addressTableLookups ?? []));  }}const perTable = new Map<string, number>();for (const l of found) perTable.set(l.accountKey, (perTable.get(l.accountKey) ?? 0) + 1);const table =  given ??  [...perTable].sort((a, b) => b[1] - a[1])[0]?.[0] ??  fail("No lookup table in the sampled transactions; run again or pass a table address.");const { value: account } = await client  .getAccountInfo(address(table), { encoding: "base64" })  .send()  .catch((e: Error) => fail(`getAccountInfo failed: ${e.message}`));if (!account || account.owner !== TABLE_PROGRAM) fail(`${table} is not an address lookup table account.`);const raw = new Uint8Array(Buffer.from(account.data[0], "base64"));const count = (raw.length - HEADER_BYTES) / 32;if (raw.length < HEADER_BYTES || !Number.isInteger(count) || new DataView(raw.buffer).getUint32(0, true) !== 1) {  fail("The account data does not have the lookup table layout.");}const entry = (i: number) => base58.decode(raw.subarray(HEADER_BYTES + i * 32, HEADER_BYTES + (i + 1) * 32));const mine = found.filter((l) => l.accountKey === table);const uses = new Map<string, { n: number; mode: string }>();for (const [list, mode] of [["writableIndexes", "w"], ["readonlyIndexes", "r"]] as const) {  for (const l of mine) {    for (const i of l[list]) {      if (i >= count) continue;      const key = entry(i);      const u = uses.get(key) ?? { n: 0, mode: "" };      u.n++;      if (!u.mode.includes(mode)) u.mode += mode;      uses.set(key, u);    }  }}console.log(`table ${table}: ${count} addresses, used by ${mine.length} of ${sigs.length} sampled transactions (${nulls} null, ${errors} failed)`);for (const [key, u] of [...uses].sort((a, b) => b[1].n - a[1].n).slice(0, 20)) {  console.log(`  ${String(u.n).padStart(3)}x ${key} ${u.mode}`);}

run: node main.ts [lookup-table-address]

The sample is the 15 newest signatures of the Jupiter v6 program. The transactions are fetched together with Promise.allSettled, so one failed fetch is counted and reported while the others carry on. Each fetch sends maxSupportedTransactionVersion: 1, which lets v0 and v1 transactions come back. Every call runs at confirmed, the commitment @solana/kit 8.6.0 fills in when a call leaves it out.

The table is read once with getAccountInfo in base64. The file checks the owner and the layout before it decodes anything, so a wallet address or a token account stops with a plain message. Failed on-chain transactions stay in the sample, because a failed transaction still carries its full message, lookups included.

03

Turning indexes into pubkeys

Each entry of addressTableLookups holds three things: the table address as accountKey, a list of writableIndexes and a list of readonlyIndexes. Index 0 is the first address stored in the table. The file reads the table bytes once, so every index from every sampled transaction resolves against the same snapshot.

A table is a 56-byte header followed by the addresses, 32 bytes each, to the end of the data. The count is the remaining length divided by 32. If that division leaves a remainder, or the first four bytes do not hold the number 1, the account is not a table and the file stops. An index at or past the count is skipped, which only happens when a table was read at a different moment than the transaction ran.

The result is a map from pubkey to a use count and a mode. The mode is w when some sampled transaction loaded the address as writable, r when one loaded it read-only, and wr when both happened. Sorting by count puts the addresses everyone touches at the top: token programs, the program's own authority account, popular mints.

Output partMeaning
Header lineThe table address, how many addresses it stores, and how many of the sampled transactions used it.
Null and failed countsSignatures whose transaction came back null, and fetches that raised an error.
Count columnThe number of transactions in the sample that loaded this pubkey from the table. The file prints the 20 highest.
Modew, r or wr, from the writable and readonly index lists.
$A transaction that loads one pubkey twice, through two indexes or through a static key and an index, fails sanitization as a duplicate and never lands, so one pubkey counts at most once per transaction.
04

On Carbium

One run makes one getSignaturesForAddress at 50 cells, fifteen getTransaction calls at 50 cells each, and one getAccountInfo at 10 cells. That is 810 cells. Each rate class absorbs a burst of at least 1,024 cells, so a single run fits even on Free, where getTransaction runs at 0.24 req/s and getSignaturesForAddress at 0.24 req/s. Dev gets 1.2 req/s for both, Business 5 and 100, Pro 25 and 500.

Running the file again right away spends the burst a second time. On a low plan the second run can end in HTTP 429 with a retry-after hint. Lower SAMPLE to shrink the bill. The getTransaction calls all go out at once, so a SAMPLE above 20 passes the 1,024-cell burst on Free and Dev, and the extra fetches come back as failures. The plan limits set the rates and every RPC method lists its own cell cost.

05

Where it ends

The counts describe 15 transactions of one program. A table used mostly by another program can come out with zero hits, and the file says so instead of guessing. Raise SAMPLE or change PROGRAM to a program that actually uses the table.

The signature listing comes from an address index that keeps up to 30 days, so no sample can reach further back, and a listed signature below the validator's ledger floor can answer null from getTransaction. The file counts those nulls. Use it on the newest signatures.

The table is read as it stands now. Entries are only appended, so an index from an earlier transaction still maps to the same address, but a table that was deactivated and closed leaves no account to read.

The file reads and never signs. Creating, extending or closing a table needs a signed transaction, and for the full contents of one table see Lookup table contents reader.

06

When it goes wrong

what goes wrongwhat to do
The file prints that no lookup table turned up in the sampled transactions.None of the 15 transactions used a table, or each came back null or failed. Run it again for newer signatures, or pass a table address and set PROGRAM in the file to a program that uses it.
The file says the address is not an address lookup table account.The account is missing, closed, or owned by another program. Pass the accountKey found inside addressTableLookups of a recent transaction.
getTransaction answers -32015 for some signatures.The call lacks maxSupportedTransactionVersion: 1. With it absent or 0, a v1 transaction or a block holding one fails with -32015. The file already sends 1.
Several fetches come back null.The signature listing reaches below the validator's ledger floor, so an old signature can list and still have no transaction. Use the newest signatures and keep counting nulls.
HTTP 429 with a retry-after hint after a second run.The first run spent most of the cell burst. Wait for the hint, lower SAMPLE, or move to a plan with a higher rate.
The table reports used by 0 transactions even though you know it is busy.The sampled program never touches that table. Change PROGRAM to one that does.
07

Questions

Can I list every transaction that ever used a lookup table?

No call does that. You choose a program or an address, pull its newest signatures, and read the lookups in each transaction, which is what the file does. History reaches back 30 days at most.

Why does the count column use transactions and not instructions?

A lookup loads an address once per transaction no matter how many instructions use it. The count says how many sampled transactions loaded the pubkey.

Why are writable and read-only shown separately?

They come from two index lists in each lookup. Write access is what makes an account contended, so the mode tells you which pubkeys a transaction could change.

Do I need to know the table address first?

No. With no argument the file takes the table used by the most sampled transactions and reports on that one.