On this page
- What DeFi Is
- How It Works
- The Core Primitives
- DEXes & AMMs
- Lending & Borrowing
- Stablecoins in DeFi
- Oracles & the Oracle Problem
- Leverage & Derivatives
- Yield & Liquidity Mining
- Composability & Its Risks
- Security & Exploits
- Governance & DAOs
- Regulation & Decentralization
- Risks & Criticisms
- History & Milestones
- The State & Road Ahead
Sources
This page explains how decentralized finance works — the primitives, the mechanics, the risks — and is candid about how often it has broken. It is not investment advice. DeFi is genuinely risky: smart contracts can be exploited, collateral can be liquidated, and there is rarely a safety net. Read this as background, not as a recommendation to put money anywhere.
What DeFi is
(decentralized finance) is financial software built on public blockchains — mostly Ethereum — as smart contracts. Instead of a bank holding your money and a broker matching your trades, a set of programs holds the assets and executes the rules: lending, borrowing, trading, hedging, earning yield, minting stablecoins. Anyone can use them, no one can gatekeep them, and the code is public.
The defining properties are (no account application, no KYC at the protocol layer), (the contract holds the assets, not a company), and composability (any protocol can call any other, like building blocks). Together these let financial primitives be assembled permissionlessly and recombined — the property that earned the sector the nickname money legos. The cost is that everything runs on code that can be wrong, and there is usually no one to call when it is.
DeFi is the clearest expression of the programmable-blockchain thesis. Where Bitcoin is a ledger for one asset and Ethereum is a general computer, DeFi is what people actually built on that computer — an entire parallel financial stack that runs without an operator. Most of it lives on Ethereum and its Layer 2s, with smaller outposts on Solana and other chains.
How it works
Every DeFi protocol is one or more smart contracts deployed on a blockchain. A user interacts through a wallet: they sign a transaction that calls a function on the contract (deposit, swap, borrow), the contract executes its logic, and the chain records the new state. No server, no intermediary — the contract is the service.
A few mechanics are common to almost all of it. Assets are held by contracts, not people, so “your” balance is really a record the contract tracks for your address — withdrawable only by you. Most protocols issue receipt tokens representing what you deposited or are owed (aToken, cToken, LP token, stETH), and those receipts are themselves assets that can be used elsewhere — the root of composability. And everything is paid for in , so when the chain is congested DeFi becomes expensive or unusable for small positions.
The one piece DeFi cannot get from the chain alone is outside data — prices, interest rates, events. That comes from , and it is where a lot of the risk enters, because a DeFi protocol is only as trustworthy as the data it consumes. We come back to that.
The core primitives
The DeFi stack is made of a handful of reusable building blocks, and most protocols are a combination of them.
- DEXes / AMMs — swap one token for another against a liquidity pool, no counterparty or order book needed.
- Lending & money markets — supply assets to earn yield, borrow against collateral, with rates set by supply and demand.
- Stablecoins — a dollar-pegged unit of account that the rest of DeFi prices things in.
- Derivatives & leverage — perps, options, and borrowed leverage that let users get long or short with collateral.
- Yield aggregators & vaults — auto-compound rewards and route deposits to the highest-yield protocol, often via the vault standard.
- Liquid staking — turn staked ETH into a liquid, yield-bearing token usable as collateral throughout DeFi.
The distinctive thing is that these compose: a stablecoin minted from collateral can be supplied to a lending market, whose receipt token can be pooled in a DEX, whose LP token can back a leveraged position. Each link is a real dependency, and when one breaks the whole stack built on it can break too.
DEXes & AMMs
A decentralized exchange () lets you swap tokens on chain without a custodian. The dominant design is the , popularized by Uniswap: a holds two tokens, and a formula keeps their reserves in balance. The constant-product rule (x · y = k) means every trade moves the price along a curve — buy a lot and the price slips, exactly as it would against any finite market.
Liquidity is provided by who deposit both tokens and earn the trading fees, receiving LP tokens representing their share. The catch is : when the two tokens' relative price moves, the pool auto-rebalances to the worse-performing side, and LPs can end up with less value than if they'd simply held. Uniswap v3 let LPs concentrate liquidity in chosen ranges (), raising capital efficiency at the cost of active management. DEX volume now routinely rivals centralized exchanges on major pairs.
Lending & borrowing
DeFi lending is almost always overcollateralized: you deposit collateral worth more than you borrow, and the protocol lets you draw a loan against it. Why would anyone deposit $200 to borrow $150? To get liquidity without selling (avoiding a taxable event or keeping upside exposure), to short an asset, or to lever up. Aave and Compound are the reference , with set algorithmically by utilization — when a market is nearly fully borrowed, rates rise to attract suppliers and cool demand.
Because the chain cannot chase you for a margin call, the protocol protects itself with : if your falls below a threshold, anyone can repay part of your debt and claim a slice of your collateral (plus a ). This is the self-policing mechanism that lets trustless lending work — and also the mechanism that, under stress, can cascade. When collateral prices crash and liquidators can't keep up, positions go bad and protocols take losses, as MakerDAO found on Black Thursday in 2020.
The most DeFi-native primitive is the : borrow any amount with no collateral, on the single condition that you repay it within the same transaction (or the whole thing reverts). Flash loans are a legitimate arbitrage and refinancing tool, and also the favorite weapon of exploiters, who use them to manipulate thin markets or fund attacks they couldn't otherwise afford.
Stablecoins in DeFi
DeFi needs a stable unit of account, because pricing everything in a volatile asset like ETH makes lending and risk math impossible. That unit is a pegged to the dollar. The three families:
- Fiat-backed — USDC, USDT: tokens issued by a custodian holding dollars in reserve. Centralized but auditable and the most robust peg. Tether deep dive →
- Crypto-collateralized — : minted against crypto collateral in , overcollateralized and decentralized but exposed to collateral-price crashes. MakerDAO deep dive →
- Algorithmic — UST (Terra): peg maintained by an incentive/arbitrage mechanic rather than reserves. The riskiest design, demonstrated catastrophically when Terra's $40B death-spiral in 2022 wiped it out. Terra/Luna deep dive →
The stablecoin wars deep dive compares all three models head to head. The throughline for DeFi: the stablecoin is the foundation, and a failed stablecoin takes down everything priced in it.
Oracles & the oracle problem
A blockchain is a closed system — it cannot reach outside to check a price or read an event. But DeFi constantly needs outside data: lending needs collateral prices to trigger liquidations, derivatives need settlement prices, synthetic assets need the price of the thing they track. An is the bridge that feeds that data on chain, and the oracle problem is that the trustless chain now depends on something it cannot itself verify.
The dominant solution (Chainlink) aggregates many independent data sources so no single one can corrupt the result. But the attack surface remains real: oracles can be stale, manipulated on thin off-chain markets, or — in some designs — governed by a small set of signers. A wave of early exploits used flash loans to manipulate the on-chain price feeds of thin liquidity pools that some protocols naively trusted as oracles. The lesson baked in across DeFi is to never use a manipulable market as a price source for anything that can be exploited through it.
Leverage & derivatives
DeFi lets you borrow to lever up (deposit collateral, borrow, deposit again), and it lets you trade synthetic exposure without owning the underlying. Perpetual futures () — contracts that track an asset's price with no expiry, kept in line by a — are the most traded derivative on chain, dominated by order-book perp venues like dYdX and GMX-style liquidity-pool designs.
Leverage is a force multiplier in both directions. It amplifies returns, and it also amplifies the that mark every major crypto crash: price falls, leveraged positions get liquidated, the liquidation selling pushes price further down, more positions fall below threshold, and the loop runs until the leverage is cleared. The "" boom and the 2022 unwind were both, at root, leverage cycles. The risk module covers this in depth →
Yield & liquidity mining
in DeFi comes from a few real sources: trading fees on liquidity you provide, interest from lending markets, and protocol incentives. The 2020 innovation was liquidity mining — paying users a protocol's governance token to supply liquidity or borrow, effectively bootstrapping usage by printing rewards. The metric exploded as capital chased the highest farming .
The honest framing is that much of that yield was inflationary — paid in tokens whose value depended on continued demand — rather than from actual economic activity. The post-2022 shift toward fee-sharing and models (where rewards go to long-term lockers who vote on emissions) was partly a reaction to the realization that pure farming was a Ponzi-ish loop. Real yield — sustainable fees from real usage — is the metric the maturing sector now tries to optimize.
Composability & its risks
Composability is DeFi's superpower and its systemic-risk engine at once. Because any contract can call any other, a dollar of collateral can be reused across three protocols, and a single integration can turn a niche app into a full product overnight. This is why DeFi built as much as it did as fast as it did.
The flip side is cascading dependency. If protocol A relies on protocol B's price feed, an oracle bug in B can drain A. If a stablecoin depegs, every lending market using it as collateral is suddenly undercollateralized. If a liquid staking token that backs half of DeFi's collateral fails, the shock propagates everywhere that token is accepted. The 2020 bZx exploit showed this early — a flash loan manipulated a price in one protocol to exploit another — and every major event since has been a variation on the theme: a failure in one primitive breaking everything bolted to it. The "" and "" classes recur because composability keeps creating new ways to combine protocols into an attack.
Security & exploits
DeFi's security story is unusual: the chain is secure, the contracts usually aren't. Billions have been lost not to network attacks but to application-layer bugs in the contracts people put on top. The recurring classes:
- — a contract calls an external address before updating its state, and that address re-enters to exploit the stale state. The DAO hack's bug, and it still appears.
- Oracle manipulation — driving a thin on-chain price feed to misvalue collateral and extract the difference. The flash-loan attack vector.
- — not a bug class themselves, but the funding mechanism that lets anyone weaponize the above at scale with no capital.
- — upgradeable proxy patterns that let a bug or a malicious upgrade drain a contract after the fact.
- Access control & governance attacks — a small governance token holder set, or a flash-loan-acquired voting bloc, passes a malicious proposal. Beanstalk was drained this way in 2022.
The mitigations are real but incomplete: audits (multiple, from reputable firms), , , , time-locked governance, and circuit breakers. None is a guarantee — Euler was audited and still lost nearly $200M to a reentrancy bug in 2023. The honest position is that using DeFi means accepting smart-contract risk you cannot fully quantify. The exploits deep dive walks through the major ones →
Governance & DAOs
Most DeFi protocols are run by a — a holder body that votes on parameter changes, upgrades, and treasury use, with execution typically carried out by plus an on-chain timelock that gives a window to react before a proposal executes. The appeal is that the protocol is governed by its users rather than a company; the reality is more complicated.
Governance tokens are usually not equity — they confer no claim on revenue or assets, only voting rights, a legal distinction that matters a great deal (see below). And turnout is typically low, voting power is concentrated (large holders and lockers dominate), and via -bribe markets is an open practice. The result is that “decentralized” governance often means control by a small, sophisticated set — the decentralization theater critique that has shadowed DeFi since the SEC's DAO Report flagged it in 2017. DAOs module →
Regulation & decentralization
The central legal question is whether a DeFi token is a security. Under the Howey test, an investment of money in a common enterprise with an expectation of profit from the efforts of others is a security, and the SEC's 2017 DAO Report found that a token whose value depends on a promoter's efforts can be one even without a company. That puts many governance and yield tokens in ambiguous territory.
The counter-argument is the “sufficiently decentralized” doctrine: if no identifiable team is essential to the protocol's success, there is no “effort of others” to rely on, and the token may not be a security. It is a compelling theory and an unsettled one — regulators have largely pursued the operators and front-ends (the people and interfaces users actually touch) rather than the autonomous contracts, because the contracts have no one to serve. The regulation module covers the landscape; the practical upshot for DeFi is a slow drift toward compliance at the edges (front-end KYC, licensed wrappers) even as the protocol layer stays permissionless.
Risks & criticisms
- Smart-contract risk. The irreducible one: a bug in a contract you depend on can drain your position, and there is no recourse. Audits reduce but do not eliminate this.
- Systemic / cascade risk. Composability means a failure propagates. A depeg, a liquidation cascade, or an LST failure can hit a dozen protocols at once. Nobody fully maps the dependency graph.
- MEV. — searchers reordering, inserting, or censoring your transaction to extract profit — is a tax on every DeFi user, most visibly as on swaps. MEV deep dive →
- Counterparty hidden in “decentralized.” Many “DeFi” products quietly rely on a foundation, a multisig, an oracle committee, or a stablecoin issuer that can be subpoenaed. Decentralization is a spectrum, and a lot of DeFi sits in the middle of it.
- “Shadow banking.” The outside critique is that DeFi recreates leverage, rehypothecation, and runs with none of the safeguards — and the 2022 cascade (Terra, Celsius) is the exhibit. The rebuttal is that the transparency is itself a safeguard: every position and reserve is on chain and inspectable, which is more than can be said of the traditional shadow system. Both are partly right.
- UX & key risk. Self-custody means a lost key is a lost position, and DeFi's interface complexity is a real barrier and a real source of user error. Account abstraction is the long-run answer, still arriving.
History & milestones
Tap any event to expand its story.
MakerDAO launches a stablecoin (DAI) backed by ether collateral in a collateralized debt position. It is the first major DeFi primitive: a dollar-pegged asset with no bank, no reserves, just smart contracts and overcollateralization. DAI becomes DeFi's reserve asset.
On-chain order-book exchanges let users swap tokens without a custodian. They are slow and clunky, but they prove the model: peer-to-peer token trading settled on chain, no middleman.
Uniswap popularizes the automated market maker — a liquidity pool priced by a constant-product formula, no order book, no market maker firm. It is the design that makes on-chain trading actually work and the template almost every DEX follows.
Compound distributes its governance token COMP to users, inventing "liquidity mining": pay people to use your protocol. Within weeks yield farming explodes, TVL roughly 10x's, and "DeFi" becomes a household term in crypto. The boom also lights up gas fees and the first wave of exploits.
bZx is drained twice in days via flash-loan-aided oracle manipulation, demonstrating that composability is a two-edged sword. The recurring bug classes — reentrancy, oracle manipulation, flash loans — become the defining risk story of DeFi.
Curve (January 2020) refines AMM design for stablecoin pairs with near-flat curves; Uniswap v3 (May 2021) lets LPs concentrate liquidity in chosen price ranges, raising capital efficiency dramatically. DEX volume begins rivaling centralized exchanges on some pairs.
Terra's algorithmic stablecoin UST loses its peg and the Luna token that backed it death-spirals, wiping out roughly $40 billion in 72 hours. It is the largest DeFi failure to date and a watershed for stablecoin design and regulation.
A cascade of failures (Celsius, FTX) and high-profile exploits (Beanstalk, Euler) forces DeFi to confront leverage, opacity, and audit quality. TVL falls from its peak; the survivors are generally the larger, more-scrutinized protocols.
Liquid staking tokens (Lido's stETH) become DeFi's largest collateral type; restaking (EigenLayer) turns staked ETH into reusable security. Meanwhile TradFi begins tokenizing treasuries and money-market funds on-chain — DeFi's slow-motion encounter with regulated finance.
The state & road ahead
DeFi today is a working but battered parallel financial stack. recovered from the 2022 trough but is concentrated in a few large, audited protocols; the long tail of high-yield farms has mostly been shaken out. Liquid staking and () made staked ETH the dominant DeFi collateral and turned security itself into a composable primitive — a powerful idea whose systemic risks are still being mapped.
Two trends define the next phase. First, real-world-asset collateral: tokenized treasuries and money-market funds brought on chain as stable yield collateral, blurring the line between DeFi and regulated finance. Second, institutional DeFi: the same TradFi firms that dismissed DeFi in 2020 are now building permissioned wrappers around public protocols, and the question is whether that integrates DeFi into the existing system or merely domesticates a fringe of it.
The deeper question is the one DeFi has always faced: can a financial system run on permissionless code, with no operator to call, be both efficient and safe? The 2022 failures said “not yet”; the survival and growth of the core protocols since says “maybe.” The honest answer is that DeFi is a live, decade-long experiment in removing intermediaries from finance, and the results — both the successes and the spectacular failures — are the data on whether that idea actually works.