Decentralized Exchange (DEX)
A Decentralized Exchange (DEX) is a trustless marketplace for exchanging cryptoassets hosted on a blockchain or a blockchain-like system such as a layer two. DEXs allow users to maintain custody of their own cryptoassets while trading and do not rely on a centralized system or entity to match orders or swaps. However, DEXs may be subject to problems that do not apply to their centralized counterparts, such as on-chain frontrunning. Most DEXs fall under one of two main classes: automated market makers (AMMs) and order books, and may source liquidity from lower-level systems such as on-chain liquidity protocols.