All posts
xAxios AIDEX Explained

What Is a DEX and How Does It Work?

Decentralized exchanges price your trade with a pool instead of an order book, route it through an aggregator, and settle it without ever holding your funds. Here is what actually happens when you press swap, and the one check no DEX runs for you.

xAxios AI
DEX Explained

What Is a DEX and How Does It Work?

You paste a token address, pick an amount, press swap, and a few seconds later the token is in your wallet. Nobody approved the trade. There was no account to open, no deposit to clear, no order sitting on a book waiting for someone on the other side to show up.

That is a decentralized exchange. The reason it can feel like sleight of hand is that almost all of the work happens in places the interface never shows you.

A DEX is a crypto exchange that runs as a smart contract instead of a company. You trade directly from your own wallet against tokens locked in that contract, and the contract sets the price and settles the trade with no order matching engine and no custodian in between.

No custody, no counter, no listing team

A centralized exchange works the way a bank does. You send it your coins, it holds them, and your balance is a row in its internal database. Trades between users are bookkeeping entries that never touch a blockchain. The company decides which tokens get listed, who may open an account, and what happens when something goes wrong.

A DEX inverts all three. Your funds stay in your wallet until the swap executes and land back in it inside the same transaction. There is no account and no withdrawal request, because there was never a deposit. The contract, the reserves it holds and every trade that passes through it are public, and anyone can read them without permission.

The tradeoff shows up in what nobody does on your behalf. No support desk can reverse a fat-fingered trade. No compliance team screens what gets listed. The exchange has no opinion about whether the token you just bought is real.

This model stopped being niche a while ago. In July 2026 DEXs handled 176 billion dollars of spot volume against 727 billion on centralized venues, which works out to a record 19.5 percent of all spot trading and roughly 24 percent of CEX volume, up from about 17 percent a year earlier. Worth reading that honestly: both numbers fell in absolute terms that month. DEXs gained share because centralized volume fell faster.

The liquidity pool replaced the order book

On a traditional exchange, buyers and sellers post orders and a matching engine pairs them off. It works beautifully when both sides are crowded and stops working entirely when they are not. A token nobody is currently quoting simply cannot be traded.

Automated market makers threw that structure out. Instead of matching two traders, a pool holds a reserve of both tokens and a formula prices the swap. Liquidity providers deposit both sides and earn a cut of every trade that touches the pool.

Uniswap's constant product formula is the version most others descend from: multiply the two reserves together and keep that product constant. Price is nothing more than the ratio between them. Sell SOL into the pool and take USDC out, the ratio shifts, and the price of SOL in that pool falls. Buy in the other direction and it rises. There is always a counterparty because the pool itself is the counterparty.

A liquidity pool is a smart contract holding reserves of two tokens that traders swap against. The price comes from the ratio between those reserves rather than from matched buy and sell orders, so a trade can execute at any time as long as the pool holds anything at all.

Newer designs make that capital work harder. Uniswap v3 and Orca's Whirlpools let providers concentrate liquidity inside a chosen price band rather than spreading it thin across every price from zero to infinity, which reaches the same depth with a fraction of the capital. Uniswap v4 pushes further with hooks, plugin contracts that run custom logic at set points in a pool's lifecycle, so a pool can carry its own fee model or limit order behavior without anyone forking the protocol.

Why your price gets worse as your order gets bigger

Every swap moves the pool it touches. Take enough of one token out and the remaining reserve is smaller, so each additional unit costs more than the last. That is price impact, and it is a property of the design rather than a fee anyone charges you.

A small trade against a deep pool barely registers. The same trade against a pool holding a few thousand dollars can move the price several percent on its own, and the quote you saw is not the price you get.

Slippage is the gap between the price you were quoted and the price you actually receive. It scales with your trade size relative to how deep the pool is, which is why an identical swap costs almost nothing in a liquid market and a great deal in a thin one.

Slippage tolerance is the setting that decides how much of that gap you will accept before the transaction reverts. Set it too tight and your swap fails in a fast market. Set it too loose and you have signed a blank cheque, which is precisely what sandwich bots look for. A bot spots your pending trade, buys in front of it to push the price up, lets your swap fill at the worse level, then sells into the price you just created. Your slippage tolerance was the budget it spent.

Order books came back, just on chain this time

The AMM is not the whole story anymore. Hyperliquid runs a full order book on a purpose-built chain, matching and settling every order, cancellation and liquidation on chain with one-block finality at throughput measured in the hundreds of thousands of orders per second. It has taken the largest share of on-chain perpetuals volume by a wide margin. Phoenix does something similar for spot trading on Solana.

The useful takeaway is that decentralized describes custody and settlement, not one particular market structure. A venue can hold an order book and still never touch your coins.

The router is doing more work than the exchange

Liquidity on any active chain is scattered. Solana alone has Raydium, Orca, Meteora, Lifinity and dozens of smaller venues, and the same pair can sit in half a dozen pools at slightly different prices with very different depth.

Aggregators exist to solve that, and they now sit in front of most trading. Jupiter handles roughly 95 percent of Solana's aggregator volume by scanning every venue at once, comparing quoted price against likely slippage and price impact, and assembling the best path. When no single pool can fill an order cleanly, it splits the order across several pools in parallel or routes through an intermediate token to get there.

A DEX aggregator holds no liquidity of its own. It scans the pools across every venue on a chain and builds the cheapest execution path for your swap, frequently splitting one order across several pools at once to keep price impact down.

Most people who describe themselves as using a DEX are really using an aggregator front end, which is why the same swap can quote noticeably better on one site than another.

What a DEX will never check for you

Listing on a DEX is permissionless. Anyone with a token and something to pair it against can create a pool and be trading within minutes, with no application and no review. That is the property that lets a genuine project launch on a Tuesday afternoon without asking anyone, and it is the same property that lets a scam launch on the same Tuesday afternoon.

The contract will quote you a perfectly good price on a token whose mint authority is still live, whose freeze authority means you can buy and never sell, or whose supply is 40 percent held by wallets funded from a single source three minutes before launch. None of that is a malfunction. Pricing a token is what a DEX does. Judging one was never part of the job.

Two related things are also yours to manage. On EVM chains a token approval you signed once stays live until you revoke it, which is why a malicious front end can drain a wallet long after you stopped using it. And because pending transactions are public on most chains, a large swap is visible to anyone watching before it settles.

Doing the check the exchange does not do

Everything above can be verified by hand in a block explorer if you know where to look and have the time. Most swap decisions get made in under a minute, which is the gap tooling fills.

xAxios AI's Rug Check runs more than 150 wallet-level checks on any Solana token and reduces them to a single score across eight signal categories, covering the standard contract flags alongside sniper, bundler, insider and bot behavior. It also surfaces the deployer's launch history, so a serial launcher shows up before you swap rather than after. The browser extension runs the same scan directly on DexScreener, DexTools, GeckoTerminal and OKX Web3, on the page where you were already looking.

Scan any Solana token for coordinated wallets, insider supply and contract risk before you swap.

Open Rug Check

The mechanics stop being mysterious once you separate them. A pool prices your trade, a router finds the cheapest way through it, your wallet signs it, and the whole thing settles without anyone holding your money. The first three problems have been solved well. The fourth one, whether the token deserved your money in the first place, is still yours.

Frequently asked questions

Not for the contract itself. There is no account and no identity check, you connect a wallet and trade. Front ends are a different matter and some block users by region or country, and a growing number of jurisdictions regulate the interface even when they cannot regulate the contract. Keep in mind that the chain records every trade against your address permanently, so this is pseudonymous rather than anonymous.

It depends entirely on your trade size and the pool. The pool fee is often comparable to or lower than a centralized taker fee, but you also pay network fees and price impact, and price impact is the one that can dominate everything else. Small trades in deep pools on a cheap chain are very cheap. A large trade in a thin pool can cost far more than any exchange fee schedule would.

It affects liquidity providers, not traders. When the price of one pooled token moves, arbitrageurs rebalance the pool, and you end up holding more of the asset that fell and less of the one that rose. The loss is measured against simply having held both tokens instead. It is called impermanent because it reverses if the price comes back, and it becomes permanent the moment you withdraw.

Smart contracts have bugs and several protocols have been exploited for large sums, so the risk is real. In practice though, most money lost around DEXs is not lost to a protocol exploit. It goes to tokens that were built to take it, or to a malicious approval signed on a front end that looked like the real one.

プレミアムが2週間無料

期間限定で全員に公開:Rug Checkを含む全プレミアム機能を無料で利用可能。