Raydium AMM V4 — Program ID & Overview
675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 Raydium AMM V4 is a constant-product (x*y=k) automated market maker on Solana. It was the first major AMM on Solana and remains widely used for token launches and liquidity bootstrapping.
Program ID
675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8
Pool structure
Each AMM V4 pool consists of:
| Account | Description |
|---|---|
| AMM account | Pool state: nonce, token balances, fees |
| Pool token mint | LP token mint address |
| Token A vault | SPL Token account holding token A reserves |
| Token B vault | SPL Token account holding token B reserves |
| OpenBook market | Linked OpenBook (Serum) orderbook market |
AMM V4 pools are linked to an OpenBook market, which provides on-chain orderbook liquidity alongside the AMM curve.
Key instructions
| Instruction | Description |
|---|---|
Initialize | Creates a new AMM pool linked to an OpenBook market |
SwapBaseIn | Swap a fixed input amount for variable output |
SwapBaseOut | Swap variable input for a fixed output amount |
Deposit | Add liquidity to the pool, receive LP tokens |
Withdraw | Remove liquidity, burn LP tokens |
Swap mechanics
AMM V4 uses the constant-product formula with fees:
amountOut = (reserveOut * amountIn * (10000 - feeBps)) / (reserveIn * 10000 + amountIn * (10000 - feeBps))
Default swap fee is 25 basis points (0.25%).
Finding pool accounts
Pool accounts for a token pair can be found by querying the AMM program’s accounts with the correct discriminator and token mint filters.
const RAYDIUM_AMM_V4 = new PublicKey("675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8");
const accounts = await connection.getProgramAccounts(RAYDIUM_AMM_V4, {
filters: [
{ dataSize: 752 },
{ memcmp: { offset: 400, bytes: tokenAMint.toBase58() } },
{ memcmp: { offset: 432, bytes: tokenBMint.toBase58() } },
],
});
FAQ
Is Raydium AMM V4 still actively used? Yes. Despite newer pool types (CLMM, CPMM), AMM V4 remains the default for new token launches on Raydium and is heavily used by trading bots.
What is the relationship between AMM V4 and OpenBook? Each AMM V4 pool is linked to an OpenBook market. The AMM places orders on the orderbook to provide deeper liquidity. This hybrid model is unique to Raydium’s V4 design.
How much are the fees? The standard swap fee is 0.25% (25 bps). Of this, 0.22% goes to LPs and 0.03% goes to RAY buybacks.
Updated: