Launch pools (LNCH)
Token launch pools: a bonding curve and a constant-product pool in one contract output, with accounts in its state; transactions, costs and the launch module.
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 the curve is sold out, anyone can turn the same output into a constant-product pool. The pool is a contract made of the opcodes that activate with Napoleon; it is not a consensus rule and not a node policy. The launch module follows the pools and serves them over REST.
Full specification: doc/contracts/launchpad.md (template version 1). REST reference: doc/contracts/launchpad-api.md, with a mock of every answer in doc/contracts/launchpad-mock.json.
In short #
- The creator mints a fixed supply (ALP GENESIS, no mint baton) and keeps at most 2% of it as real ALP (taken from the curve, not from the graduated pool). A second transaction, the seed, sends the rest to the pool output and publishes the parameters in a
LNCHeMPP section. - While the token trades in the 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; the pool never receives tokens.
- A script cannot see ALP amounts, so the pool never pays XPI for tokens it receives. Real ALP comes out of the pool by a withdraw, sent from the pool's own reserve; withdrawn tokens cannot be sold back to the pool.
- Prices: constant product on virtual reserves during the curve, on the real reserves after graduation. Every trade rounds in the pool's favour by at least one satoshi.
- Fees, fixed in the contract: 0.5% of the XPI of a buy or a sell to the creator, 0.5% burnt. The burnt fee also pays the data price of the trade.
- Fair start: trading opens at a height announced in the seed (at least 30 blocks later by default), and during the first blocks the tokens sold can be at most a fixed amount per block since the start.
- 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.
Transactions #
| Transaction | Output 0 | Output 1 | Other outputs |
|---|---|---|---|
| GENESIS | ALP GENESIS [W0, creator share], no baton | creator, W0 tokens (until the seed) | 2: creator share |
| seed | eMPP: ALP SEND [W0], then LNCH section | the pool, initial state | change |
| buy | ALP SEND [W]; value = burnt fee + data price | the pool, new state and value | 2: creator fee; change |
| sell | ALP SEND [W]; value = burnt fee + data price | the pool | 2: creator fee; payout |
| transfer | ALP SEND [W] | the pool | change |
| withdraw | ALP SEND [W − d, d] | the pool | 2: the d real tokens; change |
| graduate | ALP SEND [W] | the pool, mode 1 | change |
The pool is always input 0. A trade spends the exact pool output it was built on; if another trade spent it first, the network refuses the second one (first seen) and the wallet builds it again on the new pool output.
Sizes and costs (regtest) #
Measured by test/functional/feature_contracts_launchpad.py (its launchpad_measurements.json): about 1,400 bytes for a buy or a sell, of which about 1,100 are the pool input's script, so about 6.7 XPI of data price when the transaction uses its free bytes (11.6 XPI when the block's 2,000 free bytes are taken). The operation cost of a buy is about 126,000 units against a budget of about 910,000. The fallback buy-only curve (kind 2) uses about 640 bytes and fits the free bytes.
Module #
- Module name
launch, opt-in with-launchindex=1; database<datadir>/modules/launch.sqlite. Registered after the ALP module: after each block it asks the ALP index whether each new pool output holds the tokens its state says. - Indexes confirmed blocks; the REST answers follow the pool through the mempool (
tip), so a wallet always builds on the newest pool output. - Lists a pool only when every check passes: GENESIS without baton, creator share at most 2% and as declared, the open height 30 to 5,042 blocks after the seed, the seed spends GENESIS output 1, the rebuilt contract equals the pool output's, the initial state, and the ALP balance of every pool output.
- Routes:
GET /api/v1/launch,/launch/stats,/launch/<tokenId>,/launch/<tokenId>/tip,/quote,/accounts,/accounts/<pubkey>,/trades,/candles. - Tests:
launch_tests(templates, states and trades against the shared vectorsdoc/contracts/vectors/launchpad.json),feature_contracts_launchpad.py(regtest, attacks); REST, mempool tip, reorg and restart in the same functional test.
What the pool page should show #
Supply, the creator share, both fees, the curve and the graduation rule, the start height, the early cap, every account. Most launches end near zero; no figure on the page should suggest a return.
