DeFi for D̶e̶g̶e̶n̶s̶ Dummies #1: Decentralized Exchanges

Or, how I tried to understand what all the DeFi buzz was about 🤔, got lost in the rabbithole 🕳️🐇, and decided to share what I’ve learned so far… 🤯

DeFi has grown immensely over the last year and made a lot of people a lot of money 💰🤑…

But if you’re new to all this, and anything like me you must be like what the *$😵# is all this about??

I’ve spent the last few months trying to understand DeFi and am sharing my learnings here.

I’m going to be breaking this course down in a few building blocks:

It helps if you understand the basics of blockchains and if you’ve bought and sold some crypto before. That said, no deep knowledge is needed.

Let’s dive right in as we start with the first block. Today we’ll be covering:

Block 1: Decentralized Exchanges

  • 🏦 What are a CEXs, DEXs and AMMs?
  • 🤔 Why are they needed?
  • ⚙️ How do they work?
  • 📊 Which ones are the best to use and why?

Ok, so you’re probably familiar with Centralized Exchanges like Coinbase, Binance, Kraken, FTX etc.

  • Centralized exchanges are a great way to get onboarded into crypto.
  • You can use these exchanges to trade your $USD for crypto.
  • (Or trade crypto against other crypto)

On a CEX, BUY and SELL orders are put in the order book and a trade happens when two bids match:

  1. You deposit $USD from your bank account 💸
  2. You put in a BUY order to buy some crypto 💱
  3. Your BUY order gets matched with a SELL order 🔀
  4. And voila, you just bought yourself some crypto 🤑 (And the seller just bought himself some $USD in exchange for his crypto)

The vast majority of crypto trades are done this way. And while it’s efficient and a great way to onboard from fiat, it’s not really in the crypto spirit of decentralization. Exchanges are corporations which can be censored and you need permission to use them.

So people tried to create decentralized exchanges (DEXs) that live on the blockchain and are impossible to censor. The problem they ran into however is that smart contracts on Ethereum are actually pretty dumb 🙊

Basically it’s like a slow computer from the 80s and it’s hard to build order books in there. (Yes I’m taking some shortcuts here)

However, after a few tries, Uniswap became the first mainstream DEX using the novel Automated Market Maker (AMM) model.

So how does Uniswap work? At first sight, it seems pretty simple:

Now that was pretty simple no? However, under the hood some crypto magic happened 🎩✨:

  • Instead of buying a token from a seller directly in a bid that matches (like on a CEX)
  • You actually swapped 0.1 ETH for 336 USDC in a so called Liquidity Pool smart contract
  • Or in other words: You put your 0.1 ETH into the pool, and you took 336 USDC tokens out (and paid a small swapping fee)
  • No order books needed, and above all: decentralized & uncensorable on the blockchain 🎩✨

Ok, so you just swapped ETH for USDC, But where do the tokens in the liquidity pool come from?

Well, actually anybody can put tokens into a liquidity pool and earn swapping fees in return:

  • Liquidity providers are people who deposit both ETH and USDC tokens in the pool’s smart contract
  • They get a claim on their share of the pool in the form of LP tokens so they can get their original two tokens back in the future
  • And as a reward in the meantime, they share in the profits of the swapping fees
  • And again, this all happens decentralized & uncensorable 🎩✨
  • Liquidity pools like these can get created for every token pair that you can imagine

Pro tip: Liquidity pools with the most money locked (TVL), will offer the least amount of slippage

  • When you trade on a DEX, typically you will pay a trading fee of 0.05%-0.3%
  • But next to that you might pay extra in slippage
  • When you do big trades compared to the total value locked (TVL) in a pool, the price will ‘slip’ and you will get less USDC per ETH than with a small trade in effect adding extra cost to your trade.
  • When you’re a normal user and use popular trading pairs this won’t affect you much, but it’s good to be aware of the effect.
  • Especially when you’re trading exotic pairs in small liquidity pools, you should be aware of this dynamic

So what are the most popular and liquid DEXs on Ethereum?

Just like there is competition in the world of centralized exchanges, there are tons of competitors to Uniswap:

Data source: DeFi LLama
  • Typically, it’s better to exchange on DEXs with high TVL where fees are lowest and slippage the least.
  • Curve is the biggest pool but currently works best only for assets pairs that are highly linked like USDC/USDT or stETH/ETH pairs .
  • Overall, Uniswap has the best combination of ease-of-use and deep liquidity for most users

Ok, so that’s how a DEX works at a high level. (in the easiest way I can explain it at least 🙇‍♂️).

There’s a lot more interesting details and maths behind it, but I’ll dive into those another time.

Actually, if you’ve made it this far, follow me on Twitter: @0xGrecko and I’ll update you when I release them.

If you liked this article, spread the love and share it with your friends 🔥




DeFi for D̶e̶g̶e̶n̶s̶ Dummies | BTC since 2012, DeFi in 2022 | I demystify DeFi so you can get alpha

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Tokenize Everything

Designing Random Number Generators

what is Phuture?

SEC Enforcement Weighs in on Variable Annuity Exchanges for the First Time

Cryptocurrency exchanges in India on hiring frenzy as user base grows, IT News, ET CIO

Ecosystem of Decentralized Exchanges

Coinbase CEO’s 7 Words That Could Mean Billions for Investors

Announcing Tezos Israel Community Grant Program

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


DeFi for D̶e̶g̶e̶n̶s̶ Dummies | BTC since 2012, DeFi in 2022 | I demystify DeFi so you can get alpha

More from Medium

Polygon (MATIC) Explained in 60 Seconds

The Ethereum Merge

How Secure is Blockchain?

BSC to Ethereum cross chain