One-paragraph summary
AMM v4 is the program Raydium launched with. It maintains a constant-product invariant (x · y = k). It was originally designed as a hybrid AMM: each pool sat on top of an OpenBook (formerly Serum) limit-order-book market and mirrored portions of its curve as limit orders on that book, so users and aggregators could swap directly against the pool (AMM path) or against the limit orders the pool owned on OpenBook (CLOB path). The OpenBook dependency has since been removed from the program — pools no longer post or maintain orders on OpenBook, and all current swap traffic flows through the AMM-only V2 swap entrypoints. Token-2022 is not supported. AMM v4 is still fully operational as a constant-product AMM — every pool keeps trading, fees still accrue, LPs still earn — but the UI and SDK default new pool creation to CPMM because CPMM is cheaper and supports more mint types.
Hybrid history (context)
At launch, standing up a pool alongside Serum’s order book risked fragmenting liquidity. The hybrid design published the AMM’s curve onto the book as limit orders, so order-book routers saw the pool’s depth for free. After OpenBook forked Serum in late 2022, the program continued working against OpenBook with minimal changes. As CPMM and on-chain aggregators matured, the orderbook-side benefit faded, and AMM v4’s OpenBook integration was eventually turned off — the curve is now the pool’s only execution surface.What AMM v4 gives you (that CPMM does not)
- Deep liquidity for legacy pairs. Major pairs (SOL-USDC, mSOL-USDC, etc.) with large AMM v4 TVL remain the deepest venue for those trades.
What AMM v4 does not give you
- Token-2022. Not supported. AMM v4 was written before Token-2022 existed; its account layouts presume classic SPL Token.
- Low account count on v1 swaps. The legacy
SwapBaseIn/SwapBaseOutlayouts still carry the OpenBook market accounts as positional placeholders (they are accepted but no longer validated or used). UseSwapBaseInV2/SwapBaseOutV2to drop them and shrink the transaction. - Low compute usage. Even a V2 swap costs more than a CPMM swap.
- Default new-pool flow. New pools are created with
Initialize2(the legacyInitialize/PreInitializeentrypoints have been removed and now revert). The Raydium UI, SDK, andapi-v3.raydium.iono longer surface a “create AMM v4 pool” button — the default path for new pools is CPMM.
How AMM v4 differs from CPMM
More detail on fees:
products/amm-v4/fees and reference/fee-comparison.
Mental model
An AMM v4 pool today is a constant-productx · y = k AMM. Both vaults are entirely available to the curve — no fraction is committed to OpenBook orders, because the OpenBook integration has been removed. Operations are swap (user ↔ pool, via SwapBaseInV2 / SwapBaseOutV2) and deposit / withdraw (LP ops). The old crank (MonitorStep) has been removed and now reverts if called.
Historical mental model (pre-deactivation): a fraction of each vault was escrowed as open-book orders; settlement of filled orders happened during swap and LP operations; routed swaps could fill against the pool’s own OpenBook orders. None of this is in operation today.
Why CPMM is the recommended default
CPMM drops the OpenBook dependency. The tradeoffs:- CPMM transactions are 2×–3× cheaper in compute.
- CPMM supports Token-2022 mints.
- Aggregators now integrate CPMM directly via Raydium SDK, so the order-book-visibility benefit is largely moot.
- Operational risk: historically OpenBook outages or pauses could degrade AMM v4 pools (stale orders). With the OpenBook dependency now removed from the program, that coupling is gone — but CPMM remains the recommended, lower-cost default.
protocol-overview/versions-and-migration for the migration guidance.
When AMM v4 is the right choice
- You are routing a swap and one of the candidate pools is an AMM v4 pool with the best price.
- You are providing or managing liquidity in an existing AMM v4 pool — migration is a choice, not required; the pool continues to function as a pure AMM.
- You maintain an integration built against AMM v4 and have no reason to migrate.
Where to go next
- Accounts — the AMM’s accounts, plus the (now-vestigial) OpenBook reference fields.
- Math — constant-product swap math with AMM v4’s fee convention.
- Instructions — the instruction surface:
Initialize2,Swap(v1 / V2),Deposit,Withdraw,WithdrawPnl,SetParams. - Fees — the 0.25% split and how it’s collected.
- Code demos — TypeScript examples for swap and LP flows.
reference/program-addressesfor the canonical program ID- OpenBook program repository for the counterparty accounts this page references

