What this does. Creates a brand-new CPMM pool for two mints you specify, picks the 0.25% fee tier, seeds initial liquidity at the price implied by the seed amounts, and prints the new pool ID and tx signature.
Setup
Make sure you’ve read the Quick start prerequisites and haveRPC_URL, KEYPAIR, and the deps installed.
You’ll also need to fund the wallet with the seed amounts of both mints, plus enough SOL to cover the one-time pool-creation fee (~0.15 SOL on mainnet, see reference/program-addresses for the current value).
The script
Save ascreate-cpmm.mjs:
Run it
Example: create a SOL/USDC pool with 1 SOL and 160 USDC seed:What just happened
getCpmmConfigspulled the live list of fee tiers fromapi-v3.raydium.ioand picked index 0 (the 0.25% tier — seereference/fee-comparisonfor the full set).getTokenInforesolved each mint’s metadata, including which token program owns it. CPMM accepts both SPL Token and Token-2022 mints; the SDK routes automatically.createPoolbuilt one transaction that:- sorts the mints into canonical order,
- derives the pool PDA, vaults, LP mint, and authority,
- pays the one-time
create_pool_feetoCREATE_CPMM_POOL_FEE_ACC, - creates the caller’s ATAs if missing,
- seeds the vaults with
AMOUNT_AandAMOUNT_B.
- The initial price is set by the seed ratio:
price = AMOUNT_B / AMOUNT_Aafter decimal adjustment. Pick this carefully — bots will arbitrage any mispricing within seconds of the pool opening. startTime: new BN(0)opens trading immediately. To stage liquidity before opening to the public, set a future Unix timestamp.
Common errors
pool already exists— A pool already exists for this mint pair at this fee tier. Look it up before creating.insufficient funds— Your wallet doesn’t have enough ofMINT_A,MINT_B, or SOL (for the create-pool fee + rent).Token-2022 extension not supported— One of your mints uses an extension CPMM doesn’t accept. Seereference/token-2022-support.
After deploy
You can immediately swap against the new pool — the Swap from CLI script accepts your newPOOL_ID directly. Aggregators (Jupiter, etc.) will index the new pool within minutes.
Next
products/cpmm/overview— what CPMM is and when to choose it.user-flows/create-cpmm-pool— the same flow with screenshots, via the Raydium UI.user-flows/choosing-a-pool-type— should you have used CLMM instead?

