Launch pools for integrators
Token launch pools from an integrator's side: the launch index and the checks it runs before listing a pool, the curve and its fees, and every REST route of /api/v1/launch.
A launch pool sells a new ALP token along a bonding curve, and buys it back, from one Taproot contract output that nobody holds a key to. When every token of the curve is sold, anyone can turn the same output into a constant-product pool. The byte layouts, the leaves and the measured costs are in Launch pools; this page is what a wallet, an explorer or a market page needs to read pools from a node.
A pool is a contract, not a consensus rule and not a node policy. There is no new consensus rule in 12.5.11: the pools use the contract opcodes and extensions that activate with Napoleon.
Pools can trade where those rules are active. Mainnet: from the Napoleon activation (date to be announced). Napoleon test network: from median time past 1795867200 (28 November 2026, 12:00 UTC). See Network upgrades.
How a pool works #
- The creator mints a fixed supply (ALP GENESIS, no mint baton) and keeps at most 2% of it as real ALP. A second transaction, the seed, sends the rest to the pool output and publishes the parameters in a
LNCHeMPP section. - A script cannot see ALP amounts, so the pool never pays XPI for tokens it receives. While a token trades in a pool, holdings are accounts (public key, balance) in a Merkle tree of 65,536 slots whose root is part of the pool's state. Buy, sell and transfer change the tree and the XPI the pool holds.
- A withdraw turns an account balance into real ALP, sent from the pool's own reserve. Withdrawn tokens cannot be sold back to the pool.
- No admin key, no admin leaf, no LP tokens: the internal key is the NUMS point and the leaves are exactly buy, sell, transfer, withdraw and graduate.
- The pool is always input 0 of a trade. A trade spends the exact pool output it was built on; if another trade spent it first, the network refuses the second one and the wallet builds it again on the new pool output.
Two kinds exist: ledger (kind 1, the pool above) and curve (kind 2, a fallback that only sells real ALP; the XPI paid is burnt and nothing can be sold back).
The curve #
Prices follow a constant product on virtual reserves during the curve, and on the real reserves after graduation:
curve: x = value - base + X0 y = R + Y0
graduated: x = value - base y = R
buy of d tokens: x' > MULDIV(x, y, y - d)
sell of d tokens: x' > MULDIV(x, y, y + d)value is the pool output's satoshis, base the satoshis it always keeps (10,000 by default), R the tokens still for sale (after graduation: the pool's token reserve), X0 and Y0 the virtual reserves. The strict inequality rounds every trade in the pool's favour by at least one satoshi. The price at a pool output is x / y satoshis per token atom; the API gives x, y and a display value satsPerToken.
Graduation needs R = 0 (the curve sold out): anyone can then switch the output to mode 1, with R set to the tokens set aside for the graduated pool (G). The designer's defaults put 79.31% of the supply on the curve, minus the creator share, and 20.69% in the graduated pool, with X0 and Y0 chosen so that the graduated pool opens at the last price of the curve.
Fees, fixed in the contract, on the XPI that moves, rounded up ((amount × bps + 9999) / 10000): 0.5% to the creator (output 2, at least 546 satoshis) and 0.5% burnt (the value of output 0). The burnt fee also counts toward the trade's data price.
Fair start. Trades need a lock time of at least the open height minus 1, so the first trade can be in the block at the open height, set 30 to 5,040 blocks after the seed by the designer. Until the cap end height, the tokens sold so far may be at most cap × (lock time − open height + 2): at most cap per block since the start, in total.
What the index checks #
The launch module lists a pool only when every check passes. GET /launch/<tokenId> reports each one:
| Check | Passes when |
|---|---|
genesis | The token's ALP GENESIS is known |
noBaton | It has no mint baton |
creatorShare | The GENESIS amounts are [W0, creator share] as the LNCH section declares, and the share is at most 2% of the supply |
seed | The seed's ALP SEND gives exactly W0 to output 1 |
template | The contract rebuilt from the parameters (NUMS internal key, the exact leaves of the kind) has the commitment of the pool output |
initialState | The pool output starts in the initial state (mode 0, R0, W0, empty account tree) |
startHeight | The open height is 30 to 5,042 blocks after the seed's block |
alpBalance | The ALP index agrees that every pool output holds the tokens its state says |
Only the transaction that spends GENESIS output 1 can seed a token's pool, so nobody else can register a pool for it first. A copy of the contract with any state is not in the pool's lineage and holds no tokens: it fails alpBalance. A pool with an extra leaf has another commitment and fails template. When the LNCH section does not parse, checks also has error.
Enable the index #
launchindex=1The module is opt-in: without launchindex=1 the routes do not exist (404). It needs the ALP module (on by default). The first start on an existing chain replays it from genesis. The database is modules/launch.sqlite in the data directory.
The module indexes confirmed blocks. The answers follow the pool through the mempool: tip is the newest pool output, mempool included, so a wallet always builds on it.
REST #
Under /api/v1, read only, JSON. Token amounts in atoms (decimals gives the display unit), XPI amounts in satoshis, as integers below 2^53. Txids in display order; states, roots and commitments in script byte order; keys as 33-byte compressed hex. <tokenId> is the GENESIS txid. Errors are {"error": "<code>", "message": "<text>", "status": n}. Full fields: REST API.
| Method | Path | Answer |
|---|---|---|
| GET | /launch?status=&q=&sort=&page=&pageSize= | Listed pools, most recent activity first: pools, page, pageSize, total, numPages, lastIndexedHeight |
| GET | /launch/stats | pools, listed, trades, graduated, lastIndexedHeight |
| GET | /launch/<tokenId> | pool, checks, listed, template (each leaf's script, control, leafHash; internalKey), tradesPreview (5 newest) |
| GET | /launch/<tokenId>/tip | tip, confirmed, price: poll this before signing |
| GET | /launch/<tokenId>/quote?side=buy&amount=<atoms> | Exact figures of a trade at the tip (side=sell for a ledger pool) |
| GET | /launch/<tokenId>/accounts?page=&pageSize= | Accounts with a balance, largest first |
| GET | /launch/<tokenId>/accounts/<pubkey> | One account at the tip, with its Merkle path |
| GET | /launch/<tokenId>/trades?page=&pageSize= | Mempool trades first, then confirmed ones, newest first |
| GET | /launch/<tokenId>/candles?interval=<blocks> | Price candles from the confirmed trades, 1 to 720 blocks each (default 30) |
List parameters: status is upcoming (the next block is below the open height), curve, graduated or soldout (curve kind, nothing left); q searches the ticker and the name (at most 48 characters); sort is recent (default), created, marketcap or progress. Pages are 25 rows by default, at most 100. There is no ranking by volume.
curl -s "$API/launch?status=curve&sort=progress"
curl -s $API/launch/<tokenId>/tip
curl -s "$API/launch/<tokenId>/quote?side=buy&amount=10000000"const q = await (await fetch(`${API}/launch/${tokenId}/quote?side=buy&amount=${atoms}`)).json();
if (q.error) show(q.error); else show(q.total);The pool object #
tokenId, ticker, name, url, decimals, description, imageSha256, imageOnChain, locked (from the GENESIS), kind, templateVersion (1), commitment, status, params (supply, creatorShare, creatorShareBps, r0, g, x0, y0, base, feeCreatorBps, feeBurnBps, creatorScript, creatorAddress, openHeight, cap, capEnd), genesis and seed (txid, height), tip and confirmed (pool outputs), price (satsPerToken, x, y), marketCap (supply × price, satoshis), raised (satoshis beyond base), sold and progress (null and 1 after graduation), holders, accounts, trades, volume24h (satoshis in the last 720 blocks), lastTradeHeight.
A pool output: txid, vout, height (null in the mempool), confirmations, mempoolDepth (unconfirmed pool spends since the confirmed output), value, state; for a ledger pool also fullState (what the next spend reveals), mode, r, w, root; for a curve pool mode 0, r, w and x.
Quotes #
{"side": "buy", "amount": 10000000,
"basedOn": {"txid": "...", "vout": 1, "mempool": true},
"poolValueAfter": 123456, "xpi": 45678,
"feeCreator": 229, "feeCreatorPaid": 546, "feeBurn": 229,
"dataBytes": 1152, "freeBytes": 483, "dataBurn": 6689771, "dataBurnNoFree": 11519771,
"total": 6736224,
"priceAfter": {"satsPerToken": 0.028, "x": 30045678, "y": 10719000000000},
"stateAfter": {"mode": 0, "r": 7921000000000, "w": 10000000000000, "root": null},
"error": null}- Buy:
xpigoes into the pool;total = xpi + feeCreatorPaid + feeBurn + dataBurn, plus the network fee. - Sell:
xpiis the gross payout andnet = xpi − feeCreatorPaid − feeBurn − dataBurnreplacestotal. A sell whose payout is below the data price needs another input from the seller. dataBurnassumes the transaction uses its free data bytes;dataBurnNoFreeis the burn when the block's 2,000 free bytes are taken.- An impossible trade answers 200 with
errorset (not_open,early_cap,amount,reserve,balance) and the figures null.400 bad_sideand400 bad_amount(a positive integer of at most 15 digits) are for malformed queries.
Accounts and trades #
/accounts/<pubkey> answers pubkey, slot, exists, balance (at the tip), balanceConfirmed, path (16 sibling hashes, leaf level first) and root, with basedOn. A key without an account gets the first empty slot, balance 0 and exists: false: what a buy for a new account needs.
A trade: txid, height, kind (buy, sell, transfer, withdraw, graduate), pubkey, slot, amount, xpi, feeCreator, feeBurn, poolValue, r, mode, priceAfter, pubkeyTo, slotTo. A mempool trade has pending: true, height null and only txid, kind, pubkey, slot, amount, xpi and poolValue; it is shown on every page, and total counts the confirmed trades.
Errors #
| Status | error | When |
|---|---|---|
| 400 | bad_paging | page or pageSize is not a positive integer (every launch route reads them) |
| 400 | bad_query, bad_sort | List parameters |
| 400 | bad_token_id | Not 64 hex characters |
| 400 | bad_side, bad_amount | Quote parameters |
| 400 | bad_pubkey | Not 66 hex characters |
| 400 | bad_interval | Candles interval not 1 to 720 |
| 404 | not_found | Unknown pool, unknown sub-route, or a pool with no output to trade with |
| 503 | module_closed | The module's database is not open |
What a wallet does #
- Read the pool tip (mempool included) and, for a ledger pool, the account path.
- Rebuild the leaves from
paramsand compare them withtemplate; build the trade with the exact pool value the price asks. - Show the tokens, the XPI, both fees, the data price and the total before signing, and the countdown to
openHeightfor a pool that has not opened. - When the network refuses the trade because another one spent the pool output first, rebuild it on the new tip and ask again.
- Show trades as pending until they are confirmed: a reorg can drop a chain of unconfirmed trades.
Pool pages should state the supply, the creator share, both fees, the curve and the graduation rule, the start height, the early cap and the accounts. They should show no figure that suggests a return.
