Skip to main content
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 have RPC_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 as create-cpmm.mjs:

Run it

Example: create a SOL/USDC pool with 1 SOL and 160 USDC seed:
Expected output:

What just happened

  1. getCpmmConfigs pulled the live list of fee tiers from api-v3.raydium.io and picked index 0 (the 0.25% tier — see reference/fee-comparison for the full set).
  2. getTokenInfo resolved each mint’s metadata, including which token program owns it. CPMM accepts both SPL Token and Token-2022 mints; the SDK routes automatically.
  3. createPool built one transaction that:
    • sorts the mints into canonical order,
    • derives the pool PDA, vaults, LP mint, and authority,
    • pays the one-time create_pool_fee to CREATE_CPMM_POOL_FEE_ACC,
    • creates the caller’s ATAs if missing,
    • seeds the vaults with AMOUNT_A and AMOUNT_B.
  4. The initial price is set by the seed ratio: price = AMOUNT_B / AMOUNT_A after decimal adjustment. Pick this carefully — bots will arbitrage any mispricing within seconds of the pool opening.
  5. 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 of MINT_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. See reference/token-2022-support.

After deploy

You can immediately swap against the new pool — the Swap from CLI script accepts your new POOL_ID directly. Aggregators (Jupiter, etc.) will index the new pool within minutes.

Next