DeFi Basics
Explore decentralized finance — how DEXs, lending protocols, yield farming, and liquidity pools work, and what TVL really means.
The basics
What Is DeFi?
DeFi (Decentralized Finance) is an ecosystem of financial applications built on blockchains that offer services like trading, lending, borrowing, and earning interest — without banks, brokers, or other traditional intermediaries. Instead of a bank deciding whether to approve your loan, a smart contract automatically processes it based on code. DeFi is open 24/7, available to anyone with an internet connection and a crypto wallet, and fully transparent since all transactions are on-chain.
Decentralized Exchanges (DEXs)
A DEX lets you swap one cryptocurrency for another directly from your wallet, without creating an account or trusting an exchange with your funds. Uniswap (on Ethereum) and Jupiter (on Solana) are among the most widely used. Instead of matching buyers and sellers like a stock exchange, most DEXs use "liquidity pools" — shared pots of tokens that enable instant swaps using a mathematical formula to determine prices.
Lending and Borrowing
DeFi lending platforms like Aave and Compound let you deposit crypto to earn interest (like a savings account) or borrow crypto by providing collateral. The interest rates adjust automatically based on supply and demand. Because there is no credit check, most DeFi loans are over-collateralized — you usually deposit more value than you borrow (flash loans, covered below, are one exception because they must be repaid within a single transaction).
Start Small
DeFi is powerful but complex. Start with small amounts to learn how swapping, depositing, and wallet approvals work before committing significant funds. Gas fees on Ethereum can be high, so consider starting on lower-cost chains like Arbitrum, Base, or Solana.
Key Takeaways
- DeFi replaces banks and brokers with smart contracts that execute automatically
- DEXs let you trade directly from your wallet using liquidity pools
- DeFi lending is typically over-collateralized — no credit checks, but you usually deposit more than you borrow
- Start with small amounts on lower-fee networks to learn safely
Going deeper
Yield Farming and Liquidity Pools
Yield farming is the practice of depositing crypto into DeFi protocols to earn returns. The simplest form is providing liquidity to a DEX: you deposit a pair of tokens (e.g., ETH + USDC) into a liquidity pool, and you earn a share of the trading fees every time someone swaps between those tokens. Many protocols also distribute their own governance tokens as additional incentives to liquidity providers.
Liquidity pools use Automated Market Maker (AMM) algorithms — most commonly the constant product formula (x * y = k) — to price assets. When someone swaps ETH for USDC, they add ETH to the pool and remove USDC, which changes the ratio and automatically adjusts the price. Liquidity providers earn fees but face impermanent loss risk when the token ratio diverges from their deposit ratio.
Understanding TVL
TVL (Total Value Locked) is the most-cited metric in DeFi, representing the total dollar value of assets deposited in a protocol's smart contracts. A lending protocol with $2 billion TVL has $2 billion worth of crypto deposited by users. TVL indicates adoption and trust, but it is not the same as revenue or profit — high TVL can be driven by unsustainable token incentives rather than genuine demand.
Impermanent Loss Explained Simply
If you provide ETH/USDC liquidity and ETH's price doubles, you end up with less ETH and more USDC than if you had just held both tokens. This difference is impermanent loss. It is "impermanent" because it reverses if prices return to their original ratio, but it becomes permanent if you withdraw while prices are diverged. The larger the price movement, the greater the loss.
Key DeFi Protocol Types
- DEXs (Uniswap, Jupiter, Curve) — token swapping via liquidity pools
- Lending/Borrowing (Aave, Compound, Morpho) — deposit to earn interest, borrow against collateral
- Stablecoins (MakerDAO/Sky, Ethena) — protocols that create decentralized stablecoins
- Yield Aggregators (Yearn, Beefy) — automatically move funds to the highest-yielding strategies
- Liquid Staking (Lido, Rocket Pool) — stake ETH and receive a liquid token (stETH) usable in DeFi
Key Takeaways
- Yield farming earns returns by providing liquidity or staking in DeFi protocols
- AMMs use mathematical formulas to price assets in liquidity pools
- TVL measures adoption but can be inflated by unsustainable incentives
- Impermanent loss is the key risk for liquidity providers — it increases with price divergence
Under the hood
Concentrated Liquidity and Advanced AMM Design
Uniswap V3 introduced concentrated liquidity, allowing LPs to allocate capital within custom price ranges rather than across the entire price curve (0 to infinity). This dramatically improves capital efficiency — a concentrated position can provide the same depth as a V2 position with a fraction of the capital. However, it increases impermanent loss risk and requires active management, as positions earn zero fees when the price moves outside the selected range.
Curve Finance pioneered the StableSwap invariant, optimized for assets that should trade near 1:1 (stablecoin-stablecoin or wrapped asset pairs). By concentrating liquidity around the peg, Curve achieves extremely low slippage for same-peg swaps. Curve V2 extended this to volatile pairs with an internally updating price oracle. Other designs include Balancer's weighted pools (custom token ratios), Trader Joe's (now LFJ) Liquidity Book (discrete bins), and Maverick's directional LPing.
Flash Loans and Composability
DeFi's most unique property is composability — protocols can interact with each other within a single transaction. Flash loans epitomize this: a user borrows millions of dollars from Aave, uses the funds to execute an arbitrage across Uniswap and Curve, repays the loan plus fees, and keeps the profit — all atomically in one transaction. If any step fails, the entire transaction reverts, meaning the borrower risks nothing but gas fees.
Flash Loan Attacks
Composability is a double-edged sword. Flash loans have been used to exploit vulnerable protocols by manipulating oracle prices within a single transaction. Hundreds of millions of dollars have been lost to price-manipulation attacks on protocols that relied on easily-manipulated spot prices as their price oracle, and flash loans make the capital for such attacks cheap to borrow. This is why robust oracle design (using TWAPs or Chainlink feeds) is critical.
Protocol Revenue vs. Token Emissions
A critical distinction in evaluating DeFi protocols is the difference between real yield (revenue from actual usage, like trading fees) and emission-subsidized yield (from inflationary token rewards). During DeFi summer (2020-2021), many protocols offered sky-high APYs funded entirely by token emissions, which collapsed once emissions slowed. Sustainable DeFi protocols generate enough organic revenue to reward participants without relying on inflation. DeFi Llama's "Fees" and "Revenue" dashboards are essential for this analysis.
Key Takeaways
- Concentrated liquidity (Uniswap V3) improves capital efficiency but requires active management
- Different AMM invariants (constant product, StableSwap, weighted) optimize for different use cases
- Flash loans enable atomic arbitrage but have been weaponized against protocols with weak oracles
- Sustainable DeFi protocols generate real revenue from fees, not just inflationary token rewards
Related Content
Related Coins
Related Scams
Useful Tools
2026 Trends
More Topics
Browse all 189 topicsBlockchain 101
Understand the foundational technology behind cryptocurrency — what a blockchain is, how blocks and transactions work, the role of nodes, and why distributed ledgers are revolutionary.
Consensus Mechanisms
Learn how blockchain networks agree on a single source of truth — from Proof of Work mining to Proof of Stake validation, Delegated PoS, and Proof of Authority.
Crypto Wallets
Everything about storing cryptocurrency safely — hot vs. cold wallets, custodial vs. non-custodial, seed phrases, hardware wallets, and best practices for protecting your assets.
Mining & Staking
How mining works in Proof of Work, staking mechanics in Proof of Stake, validator requirements, rewards, and the economics behind securing blockchain networks.
Smart Contracts
What smart contracts are, how they work, writing in Solidity, the importance of audits, and how self-executing code powers DeFi, NFTs, and DAOs.
Trading Basics
Learn the fundamentals of crypto trading — exchanges, trading pairs, order types, market and limit orders, fees, and how to avoid common beginner mistakes.
Security 101
Protect your crypto — learn about 2FA, hardware wallets, seed phrase storage, common scams, and operational security practices that keep your assets safe.
Regulation & Taxes
Navigate the complex and evolving landscape of crypto regulation — KYC/AML requirements, SEC enforcement, MiCA in Europe, tax treatment of crypto transactions, and DeFi-specific tax challenges.
References & further reading
- primaryethereum.org — Decentralized finance
Official overview of the DeFi application landscape.
archived copy ↗ - primary
- primaryAave documentation
Reference docs for over-collateralised lending markets.
- primaryAave - Flash loans guide
Official description of uncollateralised, single-transaction flash loans.