Automated Market Making Explained

Understand how automated market makers price Solana swaps, why liquidity depth and slippage matter, and where Carbium routing fits in the trade path.

Automated Market Making Explained

Automated market makers are the pool-based trading systems behind many Solana swaps. Instead of matching one buyer against one seller in an order book, an AMM lets a trader exchange against liquidity that other users have deposited into an on-chain pool.

This page is the concept layer. It explains the mechanics that make a quote move, then maps those mechanics to Carbium's DEX and Swap API surfaces. For route-source behavior and provider IDs, use Supported DEXs and Routing Sources.

Part of the Carbium Solana infrastructure stack.


The pool decides the price

An AMM pool usually holds two assets, such as SOL and USDC. Traders add one asset to the pool and remove the other. Liquidity providers deposit both assets and earn fees when trades use that pool.

The important developer takeaway is simple: the pool's inventory changes during the trade, so the price is not fixed like a static API value.

In a constant-product pool, the simplified pricing model is:

x * y = k
SymbolMeaning
xAmount of token A in the pool
yAmount of token B in the pool
kProduct that the pool tries to preserve after the trade

If a trader buys SOL with USDC, the pool loses SOL and gains USDC. As SOL becomes scarcer inside that pool, the marginal price rises. That is why larger trades usually receive a worse average price than smaller trades against the same pool.


Slippage is a boundary, not a guess

Slippage is the difference between the quote a user accepts and the execution price the transaction is allowed to tolerate. It can come from the trade size itself, price movement between quote and signing, or a route changing before the transaction lands.

For application builders, slippage should be treated as a user-risk boundary:

MistakeBetter policy
Increasing slippage until a route appearsExplain the route miss or ask for explicit user approval
Displaying only the expected outputAlso display the minimum received amount when available
Treating a quote as final executionRe-check the signed transaction result on-chain
Hiding route changes from logsLog route, output amount, minimum amount, and failure reason

Carbium's Q1 guide documents slippage_bps on the current executable quote flow. The older v1 quote and swap surfaces use slippage. Keep those request families separate when debugging.


AMM designs you will meet on Solana

Solana liquidity is not one uniform pool type. A route can pass through different market designs, each with a different risk profile.

DesignWhat changes for the traderWhy developers care
Constant-product poolPrice moves along the pool inventory curveLarge trades can move price quickly on shallow pools
Concentrated liquidity poolLiquidity is concentrated around selected price rangesGood depth near the active price, weaker depth outside it
Stable or pegged-asset poolCurve is shaped for assets expected to trade near parityBetter for pairs such as stablecoins or liquid staking assets when the peg holds
Launch or bonding-curve marketPrice follows launch-specific rules before normal pool liquidity existsSwap API routing may not behave like a mature AMM pair

The route source matters, but the exact pool state matters more. A supported venue can still fail to serve a specific pair, amount, or pool hint.

📘

Supported provider does not mean every route is available at every size. Treat route availability as dynamic market state, not as a static feature flag.


Where Carbium fits

Carbium sits above individual liquidity sources. The browser DEX gives users a wallet-signed swap path, while the Swap API gives builders quote and transaction-building surfaces for apps, wallets, and bots.

Carbium surfaceUse it forDo not use it for
Carbium DEXUser-facing swaps, route review, wallet signingBackend API-key handling
Q1Current quote flow and optional executable txn when user_account is providedOlder fromMint / toMint request paths
All QuoteProvider-level quote visibility and diagnosticsMain executable swap flow
Supported DEXs and Routing SourcesProvider IDs, route misses, and routing policyGeneral AMM education
Executing SwapsSigning, submission, and confirmation after a transaction payload existsQuote selection

For most new API integrations, start with Q1 instead of a provider-pinned legacy path.

curl --request GET \
  --url 'https://api.carbium.io/api/v2/quote?src_mint=So11111111111111111111111111111111111111112&dst_mint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount_in=1000000&slippage_bps=50&user_account=YOUR_WALLET' \
  --header 'X-API-KEY: YOUR_API_KEY'

That request asks Carbium for a SOL -> USDC quote using raw token units. If user_account is included and the route can be built, the response can include a base64 txn payload for the signing flow.


How to read an AMM-backed quote

Before a wallet or bot signs, inspect the quote like an operator rather than only checking whether a response exists.

Field or signalWhat it tells you
Input and output mintConfirms the pair is the one the user intended
Raw input amountConfirms the quote uses base units, not UI-rounded token units
Expected outputShows the route's best estimate before execution
Minimum outputShows the slippage-bounded floor
Route planExplains which liquidity source or split was selected
Price impactFlags trades that are too large for available liquidity
Missing routeSignals that the pair, amount, provider, pool, or market state cannot serve the request

If the quote looks acceptable, move to signing and confirmation. If it does not, do not hide the issue by widening slippage silently.


Common failure patterns

SymptomLikely explanationFirst place to go
No route for a pairNo documented route source can serve that exact requestSupported DEXs and Routing Sources
Quote succeeds but no transaction payload appearsThe request did not include the fields needed for executable build, or the path is quote-onlyQ1
Transaction payload exists but execution failsThe problem moved to signing, blockhash freshness, simulation, or RPC submissionExecuting Swaps
Large trades price badlyPool depth is not enough for the requested sizeReduce size, split intentionally, or change product policy
The same symbol points to the wrong assetToken symbol matching is unsafeVerify mint addresses before quoting or signing

That split keeps the concept clear: AMMs explain why price and liquidity move; Carbium docs explain how to request, route, sign, and confirm a trade through the right product surface.

🔶

Use this page to understand the market mechanics, then use Q1 or the browser DEX depending on whether you are building an integration or making a wallet-signed swap. Platform access starts at carbium.io.