---
id: BI0023
title: "Liquidity lock checker"
url: https://carbium.sh/library/blockchainideas/liquidity-lock-checker
collection: Blockchain ideas
category: Token tools
revision: 1
updated: 2026-11-22
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Liquidity lock checker

A read-only checker that takes an LP mint and a deployer wallet, reads what the wallet and the incinerator hold against the mint's supply, and prints each share. A token buyer or a launch team can see who can still pull the liquidity.

## What locked means on chain

Liquidity in a constant-product pool is a claim, and the claim is an LP token. The pool's LP mint creates tokens when someone deposits and burns them when someone withdraws, so whoever holds the LP tokens can pull that deposit back out. A buyer asking whether liquidity is locked is asking who holds the LP supply and whether they can move it.

An LP token can sit in one of three places.

- Burned: the tokens sit in a token account owned by the incinerator address, which nobody holds a key for, or they were destroyed with a `Burn` instruction. Nobody can withdraw that share.
- Held by a locker program: a program owns the token account and releases it on its own schedule. The lock is as good as that program's rules, and the release date lives in the program's own accounts.
- Held by a wallet: the deployer or anyone else can sign a withdrawal at any time. This is the case where the liquidity is free to move.

A balance read sees the incinerator and every owner you name. A `Burn` leaves no balance, so the code compares the pool's own LP count with the supply to find it.

## The reads

You need two addresses: the pool's LP mint, a separate address from the token you want to buy, and the pool account itself. The pool account names the mint, and an explorer shows both on the pool's page.

| Read | Method | What it gives |
|---|---|---|
| Supply | `getTokenSupply` | Every LP token in existence, the 100% line |
| Authority | `getAccountInfo` on the mint, parsed | The mint authority and freeze authority. For a pool's LP mint, the mint authority is the AMM's own authority |
| Pool | `getAccountInfo` on the Raydium v4 pool | `lpReserve`, the LP amount the pool itself minted, at byte 720 of its state |
| Holdings | `getTokenAccountsByOwner` with a `mint` filter | Every token account a wallet owns for that mint, with amounts |

There is no ranked list of holders to start from: `getTokenLargestAccounts` is not served and answers `-32601`. The check starts from wallets you name instead. It runs the holdings read once for the deployer and once for the incinerator. A wallet can own more than one token account for a mint, so the code adds them up.

A withdrawal lowers `lpReserve` and the supply together, and a `Burn` lowers only the supply. The gap between them is what `Burn` destroyed.

## Reading the shares

The code prints the supply, one line per owner with its share, what no named owner explains, then the pool's `lpReserve` and the share a `Burn` destroyed.

- The deployer holds most of the supply and the incinerator holds little: the liquidity is free to move. A buyer should assume the deployer can pull it.
- The incinerator holds most of the supply: that part is burned. Only what is left of the deployer's share can still move.
- Both are near zero and the unexplained share is large: the LP tokens went to some other owner. Name that owner and run again.
- The pool line shows a large destroyed share: that part was burned with `Burn`, whoever holds the rest.

Shares are integer math on raw amounts, summed per owner and cut down to at most two decimals, so 0.12% means at least 0.12% and under 0.13%, and a share under 0.01% prints `0%`.

> A mint authority other than the AMM's authority means the LP supply can still grow outside normal deposits. The code prints the authority so you can compare it with the pool's.

## The build

One file, `@solana/kit` and what Node 24 ships. It is read-only: no signing key, nothing signed, nothing sent.

1. Take an LP mint and a wallet from the arguments, then the pool address and any number of extra owner addresses.
2. With no arguments, walk the newest signatures of a busy AMM program (Raydium's v4) until a transaction's token balances hold a mint whose mint authority is that program's pool authority, and take the transaction's fee payer as the wallet. One `getMultipleAccounts` call checks all the mints of a transaction, and a second picks the pool out of its first 30 accounts.
3. If the program walk finds nothing inside its time budget, walk the newest signatures of a busy pool's LP mint, whose transactions name that mint.
4. Read the supply, the mint's authorities, the pool's `lpReserve` and each owner's token accounts for the mint in one settled batch, so a failed read prints its reason and the others still print. When the supply read fails, the owner lines show raw amounts.
5. Print the supply, each owner's share, the unexplained remainder and the share a `Burn` destroyed.

`main.ts` (run: `CARBIUM_KEY=<YOUR_KEY> node main.ts [LP_MINT WALLET [POOL [LOCKER_OWNER ...]]]`)

```ts
// BI0023 · Liquidity lock checker
// https://carbium.sh/library/blockchainideas/liquidity-lock-checker
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

import { address, createDefaultRpcTransport, createSolanaRpcFromTransport, getAddressDecoder, type Address } 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 rpc = createSolanaRpcFromTransport(createDefaultRpcTransport({
  url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh", headers: { "x-api-key": key },
}));

const INCINERATOR = "1nc1nerator11111111111111111111111111111111";
// Raydium AMM v4: its pool authority is the mint authority of every LP mint it creates.
const AMM = address("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8");
const AMM_AUTHORITY = "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1";
// A busy pool's LP mint: the fallback source of liquidity transactions.
const BUSY_LP_MINT = "8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu";
const POOL_LEN = 752; // v4 pool state: lpMint at byte 464, lpReserve (LP the AMM itself minted) at byte 720

type Acct = { data: { parsed?: { info: { mintAuthority?: string | null; tokenAmount?: { amount: string } } } } } | null;
type Target = { mint: Address; wallet: Address; label: string; pool?: Address };
const why = (e: unknown) => (e instanceof Error ? e.message : String(e));

// Walks a source's newest signatures for a transaction that holds an LP mint; its fee payer is the wallet.
async function scan(source: string, until: number): Promise<Target | undefined> {
  const sigs = await rpc.getSignaturesForAddress(address(source), { limit: 20 }).send();
  for (const s of sigs.filter((x) => !x.err)) {
    if (Date.now() > until) break;
    try {
      const tx = await rpc.getTransaction(s.signature, { encoding: "json", maxSupportedTransactionVersion: 1 }).send();
      const mints = Array.from(new Set((tx?.meta?.postTokenBalances ?? []).map((b) => b.mint)));
      if (!tx || !mints.length) continue;
      const res = await rpc.getMultipleAccounts(mints, { encoding: "jsonParsed" }).send();
      const i = (res.value as unknown as Acct[]).findIndex((a) => a?.data.parsed?.info.mintAuthority === AMM_AUTHORITY);
      if (i < 0) continue;
      const keys = tx.transaction.message.accountKeys.slice(0, 30);
      const found = await rpc.getMultipleAccounts(keys, { encoding: "base64" }).send();
      const j = found.value.findIndex((a) => a?.owner === AMM && Buffer.from(a.data[0], "base64").length === POOL_LEN);
      return { mint: mints[i], wallet: keys[0], label: "fee payer", pool: j >= 0 ? keys[j] : undefined };
    } catch (e) {
      console.error(`${s.signature.slice(0, 8)} failed: ${why(e)}`);
    }
  }
}

async function lpReserve(pool: Address, mint: Address): Promise<bigint> {
  const res = await rpc.getAccountInfo(pool, { encoding: "base64" }).send();
  const buf = Buffer.from(res.value?.data[0] ?? "", "base64");
  if (res.value?.owner !== AMM || buf.length !== POOL_LEN || getAddressDecoder().decode(buf, 464) !== mint) throw new Error("not the Raydium v4 pool of this mint");
  return buf.readBigUInt64LE(720);
}

async function report({ mint, wallet, label, pool }: Target, lockers: Address[]) {
  const owners: [string, Address][] = [[label, wallet], ["incinerator", address(INCINERATOR)], ...lockers.map((a, i): [string, Address] => [`locker ${i + 1}`, a])];
  const [[supplyR, mintR, poolR], held] = await Promise.all([
    Promise.allSettled([rpc.getTokenSupply(mint).send(), rpc.getAccountInfo(mint, { encoding: "jsonParsed" }).send(), pool ? lpReserve(pool, mint) : Promise.resolve(undefined)]),
    Promise.allSettled(owners.map(([, o]) => rpc.getTokenAccountsByOwner(o, { mint }, { encoding: "jsonParsed" }).send())),
  ]);
  const supply = supplyR.status === "fulfilled" ? BigInt(supplyR.value.value.amount) : undefined;
  const authority = mintR.status === "rejected" ? `read failed: ${why(mintR.reason)}` : (mintR.value.value as unknown as Acct)?.data.parsed?.info.mintAuthority ?? "none";
  console.log(`mint ${mint}\n  supply ${supplyR.status === "fulfilled" ? supplyR.value.value.uiAmountString : `read failed: ${why(supplyR.reason)}`}, mint authority ${authority}`);
  const pct = (n: bigint, d = supply) => (d === undefined ? `${n} raw` : d > 0n ? `${Number((n * 10000n) / d) / 100}%` : "n/a");
  let known = 0n;
  held.forEach((r, i) => {
    const [name, owner] = owners[i];
    if (r.status === "rejected") return console.error(`  ${name} read failed: ${why(r.reason)}`);
    const rows = r.value.value as unknown as { account: Acct }[];
    const sum = rows.reduce((t, x) => t + BigInt(x.account?.data.parsed?.info.tokenAmount?.amount ?? 0), 0n);
    known += sum;
    console.log(`  ${name} ${owner} holds ${pct(sum)} in ${rows.length} token accounts`);
  });
  if (supply !== undefined) console.log(`  unexplained ${pct(supply - known)}`);
  if (poolR.status === "rejected") console.error(`  pool read failed: ${why(poolR.reason)}`);
  else if (poolR.value === undefined) console.log("  no pool address, so a Burn is not counted");
  else if (supply !== undefined) console.log(`  pool ${pool} lpReserve ${poolR.value}, destroyed by Burn ${pct(poolR.value > supply ? poolR.value - supply : 0n, poolR.value)}`);
}

const [mintArg, walletArg, poolArg, ...lockers] = process.argv.slice(2);
let target: Target | undefined = mintArg && walletArg ? { mint: address(mintArg), wallet: address(walletArg), label: "wallet", pool: poolArg ? address(poolArg) : undefined } : undefined;
const t0 = Date.now();
for (const [source, ms] of [[AMM, 10_000], [BUSY_LP_MINT, 22_000]] as const) {
  target ??= await scan(source, t0 + ms).catch((e) => (console.error(`${source.slice(0, 8)} scan failed: ${why(e)}`), undefined));
}
if (!target) { console.error("No LP mint found. Pass <LP_MINT> <WALLET> [POOL [LOCKER_OWNER ...]]."); process.exit(1); }
await report(target, lockers.map((a) => address(a)));
```

Reads leave commitment out, so `@solana/kit` fills in `confirmed`. `getTransaction` carries `maxSupportedTransactionVersion: 1`, since mainnet carries v1 transactions and a lower value answers `-32015`.

To run it: `CARBIUM_KEY=<YOUR_KEY> node main.ts`. Add `<LP_MINT> <WALLET> <POOL>` and any locker owners after them to check a pool you care about.

## What it costs

A check of a known pool is one `getTokenSupply`, two `getAccountInfo` calls (the mint and the pool) and one `getTokenAccountsByOwner` per owner. `getAccountInfo` is an account read at 10 cells, and the plans allow it at these rates.

| Plan | getAccountInfo |
|---|---|
| Free ($0) | 0.5 req/s |
| Dev ($20) | 15 req/s |
| Business ($250) | 50 req/s |
| Pro ($500) | 400 req/s |

Discovery is where the cells go. `getSignaturesForAddress` and every `getTransaction` cost 50 cells, each mint in a transaction adds 10 cells to its `getMultipleAccounts` call, and the pool search reads up to 30 of the transaction's accounts at 10 cells each. The code stops walking at its time budget, so a Free key at 0.24 req/s on those two methods reads only a few transactions before it stops. A product that checks tokens users paste in skips discovery, since the mint, wallet and pool come from the user.

## Build it out with a locker list

A locker holds LP tokens in a token account that its program owns. The owner address of that account is what the check needs, and the locker's own documentation or a past lock transaction names it. Pass those owners after the pool and each gets its own line.

- Keep a small file of known locker owners with labels, and load it as the extra owners on every run.
- Read the lock record for the release date and for who can cancel. Those sit in the locker program's own account layout, and the checker does not decode them.
- Re-run on a timer and print when the deployer's share rises, which means LP tokens moved back or more were minted.
- Read the token's own mint authority the same way, since a buyer cares about both.

## Where it ends

- A `Burn` instruction lowers the supply and leaves no balance to see. For a Raydium v4 pool the pool's `lpReserve` still counts those tokens, so the check prints the gap as the destroyed share. For any other AMM a burn shows only as a smaller supply and larger shares for everyone left.
- It reads owners you name. LP tokens in a wallet you did not name land in the unexplained share, and the check cannot say whether that wallet is a person, a locker or a second deployer wallet.
- A locker line shows where the tokens sit now. The terms are in the locker program's accounts.
- Pools that hold positions as NFTs, such as concentrated-liquidity pools, have no LP mint to check. For the authorities of the token itself, see [Token mint supply and authorities](https://carbium.sh/library/howsolana/token-mint-supply-and-authorities).
- It is a snapshot at `confirmed`. A withdrawal signed after the read is not in it.
- The no-argument path uses `getSignaturesForAddress`, whose pages come from an address index that keeps up to 30 days, and `getTransaction` can answer null for an older signature it lists. Both only affect discovery. A mint you name is read at its current state.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| A holdings line says the read failed. | The line names the owner and the error. The other lines still print, but that owner's tokens sit in the unexplained share until a rerun reads it. |
| The first call answers 401 with UNKNOWN_KEY. | The key is wrong or cut short. Attach the whole key in CARBIUM_KEY; the code sends it in the x-api-key header. |
| The supply prints but every owner shows 0 token accounts. | Check that the first argument is the pool's LP mint, a separate address from the token you plan to buy, and that the second is a wallet address; a token account address returns no accounts. |
| The pool line says the account is not the Raydium v4 pool of this mint. | The third argument is a different account. Copy the pool address from the explorer page of the pool that minted that LP mint. |
| getTokenLargestAccounts answers -32601. | The method is not served and a retry changes nothing. Name the wallets to check, which is what this code does. |
| The run ends with No LP mint found. | The scan stops at its time budget, and a throttled key reads fewer transactions in that time. Pass the LP mint and wallet as arguments. |

## Questions

### Where do I find the LP mint of a token I want to buy?

Open the token's pool on an explorer or read the pool account, which names the LP mint next to the two token mints. The LP mint is a separate address from the token itself.

### Does a Burn instruction count as locked?

The liquidity is gone for good, so it is the strongest result. The pool's `lpReserve` still counts the burned tokens, so the burned share is `lpReserve` minus the current supply, and the code prints it for a Raydium v4 pool.

### Why check the incinerator by owner?

A token account owned by the incinerator address can never be signed for, since nobody holds a key for it. `getTokenAccountsByOwner` lists those accounts for a mint, and their sum is the burned share that sits in a balance.

### Can a locked share still be pulled out?

Only by the locker program's own rules. Read its release date and cancel rights from its documentation or accounts before relying on the lock.

### Does it work for Token-2022 mints?

The mint filter on getTokenAccountsByOwner matches accounts under whichever token program owns the mint, so the holdings read covers both.

## Related

- [Token mint supply and authorities](https://carbium.sh/library/howsolana/token-mint-supply-and-authorities) (How to use Solana, HS0005)
- [Rug-risk token scorer](https://carbium.sh/library/si/rug-risk-token-scorer) (AI and blockchain, SI0035)
- [carbium.sh/docs#rpc](https://carbium.sh/docs#rpc)
- [carbium.sh/docs#errors](https://carbium.sh/docs#errors)
- [carbium.sh/docs#limits](https://carbium.sh/docs#limits)
- [carbium.sh/docs#auth](https://carbium.sh/docs#auth)
