All Collections
Learning Hub
WTF is...?
What is a Decentralised Exchange?
What is a Decentralised Exchange?

Learn about Decentralised Exchanges (DEXs)

Trader Joe avatar
Written by Trader Joe
Updated over a week ago

A decentralised economy needs decentralised exchanges. They are at the centre of every ecosystem, and DeFi can't live and breathe without them.

But WTF exactly is a DEX?

When trading tokens on centralised exchanges (CEXes), users don't have custody of their funds and can't control what happens to them. Moreover, CEXes have limits on what assets they can list and may restrict withdrawals/deposits at will.

"Not your keys - not your crypto".

The solution to these and other problems comes in the form of decentralised exchanges that run as smart contracts on public blockchains. Anyone can list their tokens or trade on them.

DEXes started by copying an order book model from CEXes. In order books, users can place their buy or sell orders at any price, resulting in a list organised by price levels. When buy and sell orders are placed at the same price they are "matched" and exchange occurs.

Order books are perfect for CEXes and have been used in traditional markets for ages. However, they are expensive to run on-chain (each order placement requires gas payment), are slow and not very user-friendly.

As a result, many modern DEXes use Automated Market Makers (AMMs) instead.

While order books require two users at each side of the trade to operate, the AMMs rely on automated liquidity pools that users can interact with.

The liquidity pool in AMM will buy and sell assets using its internal algorithm to calculate the current price. For example, it can be a bonding curve like a famous x*y=k or an oracle that pulls prices from CEXes, with both approaches having their own pros and cons.

The AMM that the next generation of Trader Joe's DEX uses is called Liquidity Book and uses discrete liquidity with price bins to calculate current market prices automatically.


Did this answer your question?