Decentralized exchange overview
A decentralized exchange, or DEX, is a peer-to-peer marketplace where transactions are executed directly between parties. There is no central intermediary that executes the transaction, such as a bank, broker, or other institution. Each transaction is recorded directly on-chain. DEXs are primarily used to trade or swap cryptocurrencies.
Centralized exchanges versus decentralized exchanges
A centralized exchange allows for fiat currencies and cryptocurrencies to be exchanged for one another. On a centralized exchange such as Coinbase, you can trade ICP for its worth in USD, then transfer that USD directly to your bank.
A decentralized exchange only allows for cryptocurrencies to be traded for other cryptocurrencies through crypto pairs. They may also support more advanced actions like limit orders and margin trades. Each transaction is handled by the decentralized exchange via an order book, which uses the current buy and sell orders for that token to establish the price. Decentralized exchanges use a set of smart contracts to establish the price of different cryptocurrencies against each other. They also use liquidity pools, where investors can facilitate trades by locking funds within an exchange in return for rewards.
ICP decentralized exchanges
ICP enables decentralized exchanges and order books to run on-chain, utilizing ICP's cheap storage and computation. The DEX's internal balance and transactions can be stored in a canister, alongside user balances and data.
Some examples of DEXs running on ICP include: