A DEX is a Decentralized Crypto Exchange
Decentralized crypto exchanges (DEXs) are blockchain-based apps that coordinate trading of crypto assets directly between users. This is done entirely through automated algorithms, instead of the conventional approach of acting as financial intermediary between buyers and sellers.
The algorithms that DEXs use are examples of smart contracts. They are pieces of code written on top of blockchain networks like Ethereum that trigger various outputs when given certain inputs.
The idea behind a DEX is "disintermediation," which means removing middlemen to allow regular people to do business directly with each another. A DEX doesn't offer custody of users’ crypto assets. Instead, users directly hold all their assets in their own wallets at all times.
In a DEX, there is direct updating and no database entries, and there are lesser volumes of transactions, whereas in CEX (Centralized Exchanges) such as Coinbase or TDAmeritrade, entries are done in the database, and there is a heavy volume of transactions.
DEXs do away with conventional exchange order books – where buyers and sellers are matched based on order prices and volume – in favor of "liquidity pools." These are pots of crypto assets sitting under the surface of the exchange, waiting to clear any buy or sell orders that appear. The assets in the pool are sourced from investors, who deposit them in order to earn a yield from transaction fees charged to users of the pool.