5/5
## Understanding Centralized vs. Decentralized Exchanges (CEXs vs. DEXs) In our previous lesson, we explored different types of crypto tokens, focusing on **fungible tokens**. These fall into two main categories: native tokens like ETH on Ethereum, which are built into a blockchain’s protocol, and ERC20 tokens, which are created by smart contracts on top of a blockchain. This raises a fundamental question: How do you acquire and trade these tokens? If you want to swap your ETH for a stablecoin like USDC or buy a governance token to participate in a protocol's future, you need a marketplace. That marketplace is called an **exchange**. In the world of web3, exchanges are broadly divided into two types: Centralized Exchanges (CEXs) and Decentralized Exchanges (DEXs). Understanding their differences is crucial for navigating the crypto ecosystem safely and effectively. ### What are Centralized Exchanges (CEXs)? Centralized exchanges are private companies that act as trusted intermediaries to facilitate the buying, selling, and trading of cryptocurrencies. Think of them as the digital equivalent of a traditional stock brokerage or bank. Well-known examples include Coinbase and Binance. To use a CEX, you typically follow a standard onboarding process: 1. **Create an Account:** You sign up using an email address and password. 2. **Complete KYC:** You must complete a "Know Your Customer" (KYC) process, which involves verifying your identity by submitting personal documents like a driver's license or passport. 3. **Deposit Funds:** You use an **on-ramp** to move traditional money (fiat currency like USD or EUR) from your bank account onto the exchange. A critical characteristic of CEXs is **custody**. When you deposit funds, you are transferring control of your assets to the exchange. The company holds your crypto in their wallets, meaning they control the private keys. This reality is captured by the popular crypto maxim: **"Not your keys, not your coins."** You are trusting the exchange to secure your funds and honor your withdrawal requests. Trading on a CEX is typically handled through a traditional **order book system**. Buyers place "buy" orders at specific prices, and sellers place "sell" orders. The exchange’s centralized system matches these orders to execute trades. **Advantages of CEXs:** * **Speed and Liquidity:** CEXs can execute trades almost instantly and often have deep liquidity, meaning there are large volumes of assets available. This allows users to execute large trades without drastically affecting the token's price. * **User Experience:** They generally offer polished, user-friendly interfaces that are easy for beginners to navigate. * **On-ramps and Off-ramps:** This is their most vital function. CEXs serve as the primary bridge between the traditional financial system and the crypto economy. An on-ramp lets you convert fiat to crypto, and an off-ramp lets you convert crypto back to fiat and withdraw it to your bank. The primary disadvantage is **custodial risk**. You are completely reliant on the exchange's solvency and security. If the exchange is hacked, becomes insolvent, or freezes your account, your funds can be lost forever. The catastrophic collapse of FTX, where billions in user funds were lost, serves as a powerful reminder of this risk. ### What are Decentralized Exchanges (DEXs)? Decentralized exchanges are not operated by a single company. Instead, they are protocols built from smart contracts that run directly on the blockchain. They facilitate peer-to-peer trading without any intermediary. The user experience on a DEX is fundamentally different: 1. **No Account or KYC:** You do not need to create an account or provide any personal information. Access is permissionless. 2. **Connect Your Wallet:** You interact with a DEX by simply connecting your self-custody crypto wallet, such as MetaMask. 3. **Trade Directly:** You execute trades directly from your wallet. Your assets never leave your control until the moment a trade is executed. This brings us to the core principle of a DEX: **self-custody**. You, and only you, hold the private keys to your wallet. Your tokens remain in your possession at all times, giving you full control over your assets. Most modern DEXs, like the popular **Uniswap**, do not use an order book. Instead, they use a model called an **Automated Market Maker (AMM)**. This system relies on **liquidity pools**, which are smart contracts containing reserves of two or more tokens. Users known as **Liquidity Providers (LPs)** supply these pools by depositing an equal value of each token. When you make a trade, you are swapping your tokens directly with the pool, not with another person. The price is determined automatically by a mathematical formula based on the ratio of tokens in the pool. For instance, as more people buy ETH from an ETH/USDC pool, the supply of ETH in the pool decreases, making it more expensive relative to USDC. **Examples of DEXs and related tools:** * **Uniswap:** The largest DEX, allowing for the trade of thousands of ERC20 tokens. * **Curve:** A DEX specializing in trades between similar assets, like stablecoins, offering very low fees and slippage. * **Balancer:** A DEX that enables multi-token liquidity pools with customizable weights. * **DEX Aggregators:** Platforms like **1inch** and **Matcha** search across multiple DEXs to find the most efficient trading route and best possible price for your swap. The main risk associated with DEXs is **smart contract risk**. Because a DEX is just code, a bug or vulnerability in its smart contracts could be exploited by a hacker to drain funds from its liquidity pools. To mitigate this, reputable DEX protocols undergo rigorous security audits from firms like **Cyfrin**. ### Conclusion Both centralized and decentralized exchanges are essential tools for anyone interacting with fungible tokens. CEXs offer a user-friendly bridge to the traditional financial world with their crucial on-ramp and off-ramp services, but they come with significant custodial risk. DEXs offer self-custody and permissionless access, but they require a greater understanding of wallet security and carry smart contract risk. Now that you understand the theory, our next lesson will be a hands-on tutorial where we will use Uniswap to execute our first trade on a decentralized exchange.
In our previous lesson, we explored different types of crypto tokens, focusing on fungible tokens. These fall into two main categories: native tokens like ETH on Ethereum, which are built into a blockchain’s protocol, and ERC20 tokens, which are created by smart contracts on top of a blockchain.
This raises a fundamental question: How do you acquire and trade these tokens? If you want to swap your ETH for a stablecoin like USDC or buy a governance token to participate in a protocol's future, you need a marketplace. That marketplace is called an exchange. In the world of web3, exchanges are broadly divided into two types: Centralized Exchanges (CEXs) and Decentralized Exchanges (DEXs). Understanding their differences is crucial for navigating the crypto ecosystem safely and effectively.
Centralized exchanges are private companies that act as trusted intermediaries to facilitate the buying, selling, and trading of cryptocurrencies. Think of them as the digital equivalent of a traditional stock brokerage or bank. Well-known examples include Coinbase and Binance.
To use a CEX, you typically follow a standard onboarding process:
Create an Account: You sign up using an email address and password.
Complete KYC: You must complete a "Know Your Customer" (KYC) process, which involves verifying your identity by submitting personal documents like a driver's license or passport.
Deposit Funds: You use an on-ramp to move traditional money (fiat currency like USD or EUR) from your bank account onto the exchange.
A critical characteristic of CEXs is custody. When you deposit funds, you are transferring control of your assets to the exchange. The company holds your crypto in their wallets, meaning they control the private keys. This reality is captured by the popular crypto maxim: "Not your keys, not your coins." You are trusting the exchange to secure your funds and honor your withdrawal requests.
Trading on a CEX is typically handled through a traditional order book system. Buyers place "buy" orders at specific prices, and sellers place "sell" orders. The exchange’s centralized system matches these orders to execute trades.
Advantages of CEXs:
Speed and Liquidity: CEXs can execute trades almost instantly and often have deep liquidity, meaning there are large volumes of assets available. This allows users to execute large trades without drastically affecting the token's price.
User Experience: They generally offer polished, user-friendly interfaces that are easy for beginners to navigate.
On-ramps and Off-ramps: This is their most vital function. CEXs serve as the primary bridge between the traditional financial system and the crypto economy. An on-ramp lets you convert fiat to crypto, and an off-ramp lets you convert crypto back to fiat and withdraw it to your bank.
The primary disadvantage is custodial risk. You are completely reliant on the exchange's solvency and security. If the exchange is hacked, becomes insolvent, or freezes your account, your funds can be lost forever. The catastrophic collapse of FTX, where billions in user funds were lost, serves as a powerful reminder of this risk.
Decentralized exchanges are not operated by a single company. Instead, they are protocols built from smart contracts that run directly on the blockchain. They facilitate peer-to-peer trading without any intermediary.
The user experience on a DEX is fundamentally different:
No Account or KYC: You do not need to create an account or provide any personal information. Access is permissionless.
Connect Your Wallet: You interact with a DEX by simply connecting your self-custody crypto wallet, such as MetaMask.
Trade Directly: You execute trades directly from your wallet. Your assets never leave your control until the moment a trade is executed.
This brings us to the core principle of a DEX: self-custody. You, and only you, hold the private keys to your wallet. Your tokens remain in your possession at all times, giving you full control over your assets.
Most modern DEXs, like the popular Uniswap, do not use an order book. Instead, they use a model called an Automated Market Maker (AMM). This system relies on liquidity pools, which are smart contracts containing reserves of two or more tokens. Users known as Liquidity Providers (LPs) supply these pools by depositing an equal value of each token. When you make a trade, you are swapping your tokens directly with the pool, not with another person. The price is determined automatically by a mathematical formula based on the ratio of tokens in the pool. For instance, as more people buy ETH from an ETH/USDC pool, the supply of ETH in the pool decreases, making it more expensive relative to USDC.
Examples of DEXs and related tools:
Uniswap: The largest DEX, allowing for the trade of thousands of ERC20 tokens.
Curve: A DEX specializing in trades between similar assets, like stablecoins, offering very low fees and slippage.
Balancer: A DEX that enables multi-token liquidity pools with customizable weights.
DEX Aggregators: Platforms like 1inch and Matcha search across multiple DEXs to find the most efficient trading route and best possible price for your swap.
The main risk associated with DEXs is smart contract risk. Because a DEX is just code, a bug or vulnerability in its smart contracts could be exploited by a hacker to drain funds from its liquidity pools. To mitigate this, reputable DEX protocols undergo rigorous security audits from firms like Cyfrin.
Both centralized and decentralized exchanges are essential tools for anyone interacting with fungible tokens. CEXs offer a user-friendly bridge to the traditional financial world with their crucial on-ramp and off-ramp services, but they come with significant custodial risk. DEXs offer self-custody and permissionless access, but they require a greater understanding of wallet security and carry smart contract risk.
Now that you understand the theory, our next lesson will be a hands-on tutorial where we will use Uniswap to execute our first trade on a decentralized exchange.
A crucial breakdown of Understanding Centralized vs. Decentralized Exchanges (CEXs vs. DEXs) - This lesson contrasts the custodial risks of centralized exchanges with the self-sovereign control offered by decentralized protocols. Learn the critical trade-offs between user-friendly on-ramps and the security of holding your own keys.
Previous lesson
Previous
Next lesson
Next
Give us feedback
Course Overview
About the course
What blockchains are and how they work
Key blockchain components: wallets, gas, nodes, consensus
How to send transactions
The role and risks of smart contracts
How blockchains scale with L2 rollups
Real-world use cases like DEXs, RWAs, stablecoins, and NFTs
Blockchain threats like MEV and Sybil attacks
The lifecycle of a blockchain transaction
Security researcher
$49,999 - $120,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on October 17, 2025
Duration: 20min
Duration: 1h 16min
Duration: 50min
Duration: 2h 02min
Duration: 41min
Duration: 36min
Duration: 7min
Certification: Blockchain Basics
This proficiency exam is designed to confirm your understanding of all key concepts and learnings presented in the course material. You will have 45 minutes to answer 30 questions and score 18 to pass and earn a Certificate of Completion.
Course Overview
About the course
What blockchains are and how they work
Key blockchain components: wallets, gas, nodes, consensus
How to send transactions
The role and risks of smart contracts
How blockchains scale with L2 rollups
Real-world use cases like DEXs, RWAs, stablecoins, and NFTs
Blockchain threats like MEV and Sybil attacks
The lifecycle of a blockchain transaction
Security researcher
$49,999 - $120,000 (avg. salary)
Web3 developer
$60,000 - $150,000 (avg. salary)
Smart Contract Engineer
$100,000 - $150,000 (avg. salary)
Smart Contract Auditor
$100,000 - $200,000 (avg. salary)
Web3 Developer Relations
$85,000 - $125,000 (avg. salary)
Last updated on October 17, 2025