> ## Documentation Index
> Fetch the complete documentation index at: https://docs.theblockchainlibrary.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DEX

> A Decentralized Exchange (DEX) is a peer-to-peer marketplace where users trade cryptocurrencies without an intermediary or central authority. Unlike centralized exchanges (CEXs) that hold user funds and process trades internally, DEXs utilize smart contracts to execute trades dir

# DEX

A Decentralized Exchange (DEX) is a peer-to-peer marketplace where users trade cryptocurrencies without an intermediary or central authority. Unlike centralized exchanges (CEXs) that hold user funds and process trades internally, DEXs utilize smart contracts to execute trades directly between wallets. This setup ensures that users maintain custody of their assets until the moment of the trade, promoting censorship resistance and financial sovereignty.

## Definition

A Decentralized Exchange (DEX) is a peer-to-peer marketplace where users trade cryptocurrencies without an intermediary or central authority. Unlike centralized exchanges (CEXs) that hold user funds and process trades internally, DEXs utilize smart contracts to execute trades directly between wallets. This setup ensures that users maintain custody of their assets until the moment of the trade, promoting censorship resistance and financial sovereignty.

## Simple explanation

A DEX is like an open-air marketplace where you trade items directly with others using a magic box (a smart contract) that guarantees the trade happens safely. Nobody is in charge, and you always hold your own keys.

## Why it matters

DEXs remove the need for centralized intermediaries, reducing the risk of fund theft or platform manipulation. They are essential for the vision of a censorship-resistant financial system.

## How it works

DEXs operate using smart contracts on a blockchain. Traders connect their self-custody wallets and trade against liquidity pools. The smart contract automatically swaps the tokens from the user's wallet and returns the requested asset once the terms of the trade are verified.

## Real-world example

Uniswap, the leading decentralized exchange on Ethereum, facilitating automated swaps via liquidity pools.

## Advantages

* Full user asset custody
* Permissionless access
* No KYC required

## Limitations

* High transaction fees during congestion
* Slippage during low liquidity
* No customer support

## Common misconceptions

* Many think all exchanges with 'swap' features are DEXs.
* People assume DEXs are safer than CEXs without considering smart contract risk.

## Related knowledge

* [AMM](https://docs.theblockchainlibrary.com/generated/v2/glossary/amm) — term
* [DeFi](https://docs.theblockchainlibrary.com/categories/defi) — term
* [Liquidity Pool](https://docs.theblockchainlibrary.com/generated/v2/glossary/liquidity-pool) — term
* [Self-Custody](https://docs.theblockchainlibrary.com/generated/v2/glossary/self-custody) — term
* [Smart Contract](https://docs.theblockchainlibrary.com/generated/v2/glossary/smart-contract) — term

***

**Canonical knowledge ID:** `glossary:dex`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.