Crypto 101 · DeFi
Crypto Swaps and AMMs: How Trading Without an Exchange Works
Abstract
An automated market maker (AMM) lets you swap tokens against a pool of two assets instead of matching buyers and sellers. Its price follows a formula, so larger trades move the price more. We explain swaps in plain terms, work a numeric example with a constant-product pool, define slippage and price impact and show a live pool.
Keywords: swap, AMM, constant product, slippage, price impact, Raydium
1. In plain English
A swap turns one token into another. On a traditional exchange, you place an order and wait for someone to take the other side. In DeFi there is usually no counterparty waiting. Instead there is a liquidity pool: a pot holding two tokens, for example wLKY and SOL. When you swap, you put one token in and take the other out, and a formula decides the rate.
That system is called an automated market maker, or AMM. It is always open, needs no account, and settles in one transaction from your own wallet.
2. How the formula sets the price
The classic rule is the constant product: the pool's two reserves multiplied together stay constant, x * y = k [1]. If you buy token X, you add token Y to the pool and remove some X, so X becomes scarcer in the pool and its price rises.
Worked example (fees ignored). A pool holds 100,000 USDC and 1,000,000 tokens, so 1 token costs 0.10 USDC. You add 1,000 USDC. The USDC reserve becomes 101,000, so the token reserve must fall to 100,000,000,000 / 101,000 = 990,099.01, and you receive 9,900.99 tokens. You paid about 0.1010 USDC per token, roughly 1% more than the starting price. That gap is price impact.
3. Try it on a real pool
4. Go deeper: slippage, fees and depth
- Price impact depends on trade size relative to the pool's reserves: the same trade moves a shallow pool much more than a deep one.
- Slippage is the difference between the quoted and the executed price. Wallets let you set a maximum tolerance so a trade fails instead of filling badly.
- Fees are taken from each trade and go mostly to liquidity providers; Raydium's constant-product (CPMM) pools describe fee tiers such as 0.01%, 0.25% and 1% [2, 3].
On Solana the small network fee is paid in SOL [4]; on Ethereum it is paid as gas [5]. See crypto network fees.
5. In Scrypt Wallet
You can trade from a wallet you control, with the rate and price impact shown before you confirm. The other side of the pool, the people who supply the tokens, is covered in liquidity pools explained.
References
- Adams, H., Zinsmeister, N., Salem, M., Keefer, R., & Robinson, D. (2020). Uniswap v2 Core. Whitepaper: constant-product automated market maker with fees paid to liquidity providers. https://uniswap.org/whitepaper-v2.pdf
- Raydium (2025). Choosing a pool type. Raydium documentation: CPMM pools are standard xy=k constant-product pools; liquidity providers receive LP tokens. https://docs.raydium.io/user-flows/choosing-a-pool-type
- Raydium (2025). Protocol fees. Raydium documentation: how trading fees on its pools are split. https://docs.raydium.io/ray/protocol-fees
- Solana Foundation (2024). Transaction fees. Solana documentation: every transaction pays a small base fee per signature, plus an optional priority fee, in SOL. https://solana.com/docs/core/fees
- ethereum.org (2023). Gas and fees. Ethereum developer documentation: transaction fees, the base fee and tips. https://ethereum.org/en/developers/docs/gas/
Common questions
What is slippage?
The difference between the price you expected and the price you get, caused by the pool moving while your trade executes and by your trade's own size.
Is a swap the same as an exchange trade?
No. A swap trades against a pool at a formula-set price. An exchange matches your order with another trader's order on an order book.
General education, not financial, tax or legal advice. Figures are schematic. Protocol parameters are cited to primary sources and can change; verify against the linked source before relying on them.
Solana live price
Ethereum live price