How to get a pump.fun token's market cap and bonding curve progress without an API
pump.fun has no public price API, and you do not need one. Every coin's price lives in one small account on Solana. This guide shows where it is, how to decode it, and how to turn it into a market cap, a progress percentage and a migration signal.
Where the price lives
While a pump.fun coin is new it trades against a bonding curve: an account owned by the pump.fun program (6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P) that holds the coin's reserves. Its address is a program-derived address made from the text bonding-curve and the mint, so you can work it out offline from the mint alone.
What is in the account
| Bytes | Field | Unit |
|---|---|---|
| 8–15 | virtual token reserves | tokens × 106 |
| 16–23 | virtual SOL reserves | lamports |
| 24–31 | real token reserves | tokens × 106 |
| 32–39 | real SOL reserves | lamports |
| 40–47 | token total supply | tokens × 106 |
| 48 | complete | 1 once the curve has finished |
| 49–80 | creator (newer accounts) | address |
The maths
- Price in SOL per token = virtual SOL ÷ virtual tokens.
- Market cap = price × total supply (one billion for a pump.fun coin).
- Progress = tokens sold ÷ (tokens sold + real tokens left). A standard curve starts with 1,073,000,000 virtual tokens, so tokens sold is that minus the current virtual tokens.
- Migration cap: the curve keeps virtual SOL × virtual tokens constant. Once the remaining real tokens are sold, virtual tokens are (virtual − real), so the cap there is (virtual SOL × virtual tokens) ÷ (virtual − real)² × supply. For a standard curve that is about 411 SOL.
- Migrated: the
completebyte is 1. The coin now trades on a pool and the curve no longer prices it.
A fresh curve has 30 virtual SOL and 1,073,000,000 virtual tokens, which is a market cap of about 28 SOL before anyone has bought.
Doing it by hand
const res = await fetch("https://api.mainnet-beta.solana.com", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "getAccountInfo",
params: [curveAddress, { encoding: "base64" }] }),
});
const data = Buffer.from((await res.json()).result.value.data[0], "base64");
const virtualTokens = Number(data.readBigUInt64LE(8)) / 1e6;
const virtualSol = Number(data.readBigUInt64LE(16)) / 1e9;
const complete = data[48] !== 0;
const marketCapSol = (virtualSol / virtualTokens) * 1e9;
The fiddly part is curveAddress: deriving a program-derived address needs a SHA-256 and an ed25519 on-curve check.
Doing it in one line
pump-curve does the derivation, the decoding and the maths, with no dependencies:
npx github:blixvip/pump-curve <mint>
import { readCurve, readCurves, watchCurve } from "pump-curve";
const coin = await readCurve("<mint>");
// { status: "curve", marketCapSol: 285.36, progressPct: 92.94, migrationMarketCapSol: 410.88, creator, ... }
const many = await readCurves([mintA, mintB, mintC]); // up to 100 coins in one RPC call
watchCurve("<mint>", (now) => {
if (now.status === "migrated") console.log("migrated");
});
Things that will trip you up
- Not every curve is priced in SOL. Some newer curves are quoted in another token. Their reserves are in that token's units, so the SOL maths above does not apply. pump-curve reports the quote token instead of a wrong price.
- After migration, stop reading the curve. The price comes from the pool from then on.
- Dollars need a SOL price. The chain gives you SOL. Multiply by a SOL price from wherever you trust.