DeFi Explained
Understanding How Decentralized Finance Protocols Work

How do DeFi protocols work?
DeFi, or decentralized finance, works through smart contracts that coordinate financial activity on-chain. Instead of relying on a centralized intermediary, DeFi protocols use liquidity pools, automated market makers, collateral rules, oracles, governance systems, and composable protocol integrations to support trading, lending, yield strategies, derivatives, and other financial functions.
DeFi 201 is intended for readers who already understand crypto basics and want to understand how DeFi protocols actually work. It moves beyond beginner definitions and into the systems that keep decentralized finance running: exchanges, lending markets, yield strategies, oracle networks, derivatives, governance, and composability.
What you’ll learn
DeFi is best understood as a connected protocol system rather than a list of isolated apps. Its main components include decentralized exchanges, lending protocols, yield aggregators, oracles, decentralized derivatives, governance, and composability.
-
how decentralized exchanges enable on-chain trading through order books, AMMs, liquidity pools, and intent-based execution;
-
how DeFi lending markets use collateral, pooled liquidity, utilization, interest rates, and liquidations;
-
how yield aggregators use vaults, strategy routing, managers, and keepers to automate DeFi strategies;
-
why oracles are critical for prices, collateral values, liquidations, derivatives, and synthetic assets;
-
how decentralized derivatives create synthetic exposure through collateral, margin, funding, and liquidation mechanics;
-
how DAOs and governance tokens coordinate proposals, voting, delegation, treasuries, and protocol upgrades;
-
how composability lets protocols build on each other while creating dependency and systemic-risk trade-offs.
Learning outcomes
-
Explain how DEX architectures route trades and allocate liquidity.
-
Describe the mechanics and risks of DeFi lending protocols.
-
Explain the role of vaults and automated yield strategies.
-
Identify oracle dependencies and manipulation risk.
-
Describe how DeFi protocols package derivative exposure without centralized intermediaries.
-
Explain how DAOs coordinate protocol upgrades and incentives.
-
Analyze both the benefits and risks of DeFi composability.
Course lesson summaries
The lesson summaries below are a short overview of the full course content. Take the full interactive DeFi 201 course to explore each lesson in more depth through guided explanations, examples, and activities.
Lesson 1 - DEXs
Compares on-chain order books, constant-product, concentrated-liquidity, constant-sum, and hybrid AMMs with intent-based routing by competing solvers.
Lesson 2 - Lending Protocols
Follows collateralized borrowing through pooled liquidity, utilization-based rates, supply and borrow APY, health factors, and liquidation mechanics.
Lesson 3 - Yield Aggregators
Shows how vaults route deposits across strategies and automate compounding while adding smart-contract, strategy, fee, governance, and automation risk.
Lesson 4 - Oracles
Explains how smart contracts obtain price and other external data and why source quality, aggregation, latency, manipulation resistance, and failure modes matter across DeFi.
Lesson 5 - Decentralized Derivatives
Introduces perpetuals, options, and synthetic assets and connects their design to collateral, margin, funding, liquidation, oracle, and leverage risks.
Lesson 6 - Governance
Covers governance tokens, proposals, delegation, quorum, voting power, treasuries, protocol upgrades, and the risks of low participation or concentrated control.
Lesson 7 - Composability
Explains how protocols combine as money legos to create new products while dependencies can transmit smart-contract, oracle, collateral, bridge, or governance failures across DeFi.
What Is DeFi?
DeFi means decentralized finance. It refers to financial protocols that run through blockchains and smart contracts rather than traditional intermediaries. In DeFi, users can trade, lend, borrow, supply liquidity, manage collateral, vote on protocol changes, or build products by connecting multiple protocols together.
The important idea is not that DeFi removes every kind of intermediation. It changes where coordination happens. Rules that would usually be enforced by a platform, broker, exchange, or bank can be encoded into smart contracts, governance systems, oracle feeds, and liquidity mechanisms.
How DeFi Protocols Work
Most DeFi protocols combine a few common building blocks: users, smart contracts, liquidity providers, traders, borrowers, lenders, governance participants, and external data providers. The exact mix depends on the protocol type.
The main building blocks include:
-
Smart contracts: Encode the rules for trading, lending, collateral, fees, voting, or settlement.
-
Liquidity pools: Hold assets that traders or borrowers interact with.
-
Liquidity providers: Supply assets to pools and take protocol-specific risks.
-
Oracles: Bring external data, such as prices, into smart contracts.
-
Governance: Coordinates upgrades, parameters, incentives, and treasury decisions.
-
Composability: Lets protocols plug into each other and create new products.
Decentralized Exchanges and AMMs
Decentralized exchanges allow users to trade on-chain through smart contracts. Early exchange design borrowed from order books, where buyers and sellers post bids and asks. But on-chain order books can be expensive and capital-inefficient because each order update consumes gas and liquidity may sit idle.
Automated market makers changed that model. In an AMM, traders do not need to match with another person’s order. They trade against a shared liquidity pool supplied by liquidity providers. A liquidity pool is a smart contract that holds tokens, and an algorithmic formula determines prices based on the pool’s reserves.
The constant product AMM model uses the formula x times y equals k. It keeps the product of the two token reserves constant, so prices move automatically as traders buy one asset and add another. This model is simple and resilient, but it spreads liquidity across all possible prices, which can make capital inefficient.
DEX and AMM models: Key differences
-
Order book
-
Core idea: Matches bids and asks directly.
-
Strength: Familiar market structure.
-
Trade-off: Costly and capital-inefficient on-chain.
-
-
Constant product AMM
-
Core idea: Uses x*y=k across a pool.
-
Strength: Simple, always provides liquidity.
-
Trade-off: Capital may sit unused far from market price.
-
-
Concentrated liquidity
-
Core idea: LPs choose price ranges.
-
Strength: Higher capital efficiency and tighter spreads.
-
Trade-off: Requires more active liquidity management.
-
-
Constant sum AMM
-
Core idea: Keeps exchange rate near fixed parity.
-
Strength: Low slippage for stable pairs.
-
Trade-off: Can break if one side of the pool is drained.
-
-
Hybrid AMM
-
Core idea: Blends product and sum curves.
-
Strength: Useful for stable or pegged assets.
-
Trade-off: More complex and less intuitive.
-
-
Intent-based DEX
-
Core idea: Users express desired outcomes; solvers compete to fulfill them.
-
Strength: Can improve routing and user experience.
-
Trade-off: Depends on solver competition and execution quality.
-
Liquidity Pools and Liquidity Providers
Liquidity providers deposit assets into pools so other users can trade. In return, LPs may earn a share of trading fees. But providing liquidity is not passive income without risk. LP returns depend on trading volume, fee tiers, price movement, pool design, and impermanent loss.
LP profitability can be expressed as trading fees earned minus impermanent loss, if any.
DeFi Lending and Borrowing
DeFi lending protocols let users supply assets to earn yield and borrow against collateral without a traditional bank. Smart contracts replace bilateral lending relationships with pooled markets that set rules, manage collateral, and enforce liquidations automatically.
A typical lending protocol uses overcollateralization. A borrower deposits collateral, borrows a smaller value against it, and must keep the position healthy. If collateral value falls too far, the protocol can liquidate the position to protect the lending pool.
Key lending concepts
-
Collateral: Assets pledged to secure a loan or leveraged position.
-
Utilization: How much of a lending pool is currently borrowed.
-
Supply APY: The rate suppliers may earn for lending assets.
-
Borrow APY: The rate borrowers pay to use borrowed assets.
-
Health factor: A measure of whether a position is safely collateralized.
-
Liquidation: Forced sale or closure when a position becomes unsafe.
Yield Aggregators
Yield aggregators simplify DeFi yield generation by routing deposits across strategies and automating parts of the process. Instead of manually moving funds between pools or protocols, users deposit into a vault. The aggregator then follows a strategy, compounds returns, and abstracts away some of the operational work.
This does not remove risk. Aggregators add another layer of smart-contract exposure, strategy risk, fee policy, governance risk, and dependence on keepers or automation agents. Yield optimization is a mechanism to understand, not a recommendation.
Oracles and DeFi Security
DeFi protocols often need information that does not naturally live on-chain. Lending markets need asset prices to value collateral. Derivatives need reference prices. Synthetic assets need external data. Liquidations depend on timely and accurate price information.
Oracles provide this data to smart contracts. Because smart contracts can execute automatically based on oracle inputs, oracle design is a core security issue. Bad data, delayed data, manipulation, or concentrated data sources can create losses across trading, lending, derivatives, and liquidation systems.
More resilient designs combine multiple sources and aggregate observations before publishing a value on-chain. That can reduce dependence on one provider, but it does not eliminate latency, source correlation, or governance risk.
Decentralized Derivatives
Decentralized derivatives create exposure to assets or market outcomes without necessarily requiring users to hold the underlying asset directly. Common examples include perpetual futures, options, synthetic assets, and other collateralized instruments.
The key mechanics include collateral, margin, funding rates, liquidation thresholds, and protocol risk controls. Perpetual futures have no expiry and use funding payments to help keep contract prices aligned with spot prices. Like other DeFi products, derivatives can increase capital efficiency but also introduce leverage, liquidation, oracle, and systemic-risk concerns.
Governance and DAOs
Many DeFi protocols are governed through DAOs, governance tokens, proposals, voting systems, delegation, and treasuries. Governance determines how protocols update parameters, allocate incentives, manage upgrades, and respond to risk.
Proposals may need a quorum or other participation threshold before a vote can take effect. The exact rules determine how voting power is counted, how delegates act, and how quickly a protocol can respond to changing conditions.
Governance can make protocols more community-driven, but it can also create concentration and coordination problems. Token-weighted voting may give large holders outsized influence. Low voter participation can make decisions fragile. Delegation can improve expertise but may also centralize practical control.
Composability and Systemic Risk
Composability is the ability for DeFi protocols to plug into and build on top of one another. This is why DeFi is often described as money legos. A lending protocol can use an oracle, a yield aggregator can route deposits across lending markets, and a derivatives protocol can depend on multiple liquidity and data systems.
Composability accelerates innovation because developers can reuse existing liquidity, infrastructure, and protocol primitives. But it also creates dependency risk. If one widely used protocol, oracle, bridge, collateral asset, or governance decision fails, the effects can cascade across many connected applications.
Key DeFi Protocol Types
-
DEX / AMM
-
What it does: Enables on-chain trading through pools, curves, routing, or intents.
-
Main risk: Slippage, LP risk, smart-contract risk, solver/routing risk.
-
-
Lending protocol
-
What it does: Lets users supply assets and borrow against collateral.
-
Main risk: Liquidation, collateral volatility, oracle risk.
-
-
Yield aggregator
-
What it does: Automates deposits, routing, strategies, and compounding.
-
Main risk: Strategy risk, contract risk, fee/governance risk.
-
-
Oracle network
-
What it does: Supplies external data to smart contracts.
-
Main risk: Data manipulation, latency, source concentration.
-
-
Derivatives protocol
-
What it does: Creates synthetic or leveraged exposure.
-
Main risk: Funding, liquidation, margin, oracle, and leverage risk.
-
-
DAO governance
-
What it does: Coordinates protocol decisions and upgrades.
-
Main risk: Voter concentration, low participation, governance capture.
-
-
Composable integration
-
What it does: Connects multiple protocols into new products.
-
Main risk: Dependency and cascading failure risk.
-
Risks and Trade-offs in DeFi
DeFi replaces some intermediaries with code, liquidity systems, and governance. That does not remove risk. It changes the form of risk.
-
Smart contract risk: code can contain bugs or be exploited.
-
Oracle risk: bad or delayed data can trigger wrong pricing, lending, or liquidation outcomes.
-
Liquidity risk: pools can become shallow, imbalanced, or expensive to trade against.
-
Liquidation risk: collateralized positions can be closed when markets move quickly.
-
Governance risk: token voting can be captured, delayed, or dominated by large holders.
-
Composability risk: protocols that depend on one another can transmit failures across the system.
-
Regulatory risk: DeFi protocols, interfaces, and participants may face changing legal treatment.
This page is for educational purposes and explains protocol mechanics. It does not provide investment, trading, tax, or legal advice.
Simple example: a DeFi swap through an AMM
A user wants to trade ETH for USDC through a decentralized exchange. Instead of matching with a specific seller, the user trades against an ETH/USDC liquidity pool. Liquidity providers have deposited both assets into the pool. The smart contract calculates the trade based on the pool’s pricing formula, updates the token reserves, charges a trading fee, and sends the output token to the user.
The user gets an on-chain swap. LPs earn fees. The pool’s price changes because its reserves changed. If the trade is large relative to pool liquidity, the user may experience slippage. If the pool is part of a larger aggregator or intent-based route, solvers or routers may search across multiple liquidity sources to improve execution.
Key takeaways
-
DeFi protocols use smart contracts to coordinate financial activity without a traditional centralized intermediary.
-
DEXs and AMMs use liquidity pools and algorithmic pricing to support on-chain trading.
-
DeFi lending protocols use collateral, utilization, rates, and liquidations to manage risk.
-
Yield aggregators automate strategy routing and compounding, but they add another layer of protocol risk.
-
Oracles are critical because many DeFi systems depend on accurate external data.
-
Decentralized derivatives introduce collateral, margin, funding, leverage, and liquidation dynamics.
-
Governance and composability are major strengths of DeFi, but they also create coordination and systemic-risk trade-offs.
Before you start
This is an intermediate topic. Helpful background knowledge includes blockchain basics, Ethereum basics, wallets, tokens, smart contracts, basic trading terms, and basic lending vocabulary.
Continue learning
Related Campus topics include Ethereum & Layer 1s 201 for smart contracts, gas, and token standards; Market Structure 201 for liquidity, order books, derivatives, and institutions; Scaling & Layer 2s 201 for cheaper execution environments and rollup context; and stablecoins, RWAs, and glossary pages for collateral, settlement, and liquidity context.
Glossary
DEX: A decentralized exchange that lets users trade through smart contracts rather than a centralized intermediary.
AMM: An automated market maker that prices trades algorithmically using pooled liquidity.
Liquidity pool: A smart contract holding tokens supplied by liquidity providers for traders to swap against.
Liquidity provider: A user or entity that deposits assets into a pool and earns fees while taking pool risk.
Constant product AMM: An AMM model that preserves the invariant x times y equals k.
Concentrated liquidity: A liquidity design that lets LPs provide capital inside selected price ranges.
Intent-based DEX: A DEX model where users express desired outcomes and solvers compete to execute them.
Collateral: Assets pledged to secure a DeFi loan or leveraged position.
Liquidation: The forced closing or sale of collateral when a position becomes unsafe.
Yield aggregator: A protocol that routes funds across strategies to optimize yield.
Oracle: A service that provides external data, such as prices, to smart contracts.
Perpetual futures: Derivative contracts with no expiry that use funding rates to track spot prices.
DAO: A decentralized organization governed through proposals, votes, and smart-contract rules.
Governance token: A token used to vote on protocol decisions or delegate voting power.
Composability: The ability for protocols to plug into and build on top of one another.
Start the full interactive course
This guide covers decentralized finance beyond the basics. The full interactive course goes deeper with visual walkthroughs, guided examples, applied exercises, knowledge checks, feedback, progress tracking, and completion.
Start the full interactive DeFi 201 course below.
Continue on Campus
Ready to take the full course?
Get access to Campus for free. Create an account to explore courses, track your progress and earn a certificate.
- Build your knowledge
- Track your progress
- Get certified
Campus is a premium platform – start with a free trial. You'll be redirected to Campus to sign in.
Frequently asked questions
DeFi works through smart contracts that coordinate activity such as trading, lending, collateral management, yield strategies, derivatives, and governance on-chain.
An AMM is an automated market maker. It lets traders swap tokens against a liquidity pool, with prices set by an algorithmic formula rather than a traditional order book.
DeFi lending protocols let users supply assets to earn yield or borrow against collateral through smart-contract-based lending markets.
Yield aggregators are protocols that route deposits across strategies and automate parts of yield generation, such as strategy selection and compounding.
DeFi protocols need oracles because many smart contracts depend on external data, especially asset prices used for collateral values, derivatives, and liquidations.
DAO governance uses proposals, voting, delegation, tokens, and treasuries to coordinate protocol decisions and upgrades.
Composability means protocols can connect and build on each other, creating new products while also introducing dependency and systemic-risk trade-offs.







