Skip to main content

What Is Decentralized Finance (DeFi)? How It Works

DeFi is financial services on public blockchains — no banks, no custodians. Lending, trading, stablecoins, and yield all run on smart contracts. How it works and what the risks are.

Written by Eco

What Is DeFi

Decentralized finance (DeFi) is financial services built on public blockchains and governed entirely by smart contracts. No bank holds your funds, no brokerage clears your trades, no custodian approves withdrawals. Code executes the rules. Anyone with a wallet and internet access can lend, borrow, trade, or earn yield without an account application.

DeFi emerged from Ethereum in 2017 and accelerated sharply after 2020, when protocols like Uniswap, Aave, and Compound proved that open-source financial primitives could handle billions in daily volume. The core thesis: financial services should be globally accessible, non-custodial, and verifiable by anyone who can read a block explorer. At its 2021 peak, DeFi protocols locked over $180 billion in total value. As of early 2026, the category holds more than $90 billion across Ethereum, Arbitrum, Base, Solana, and a dozen other chains.

What separates DeFi from prior fintech innovation is composability. Because every protocol publishes its logic onchain, developers can stack them. A yield aggregator can call a lending market, which calls a DEX, which calls a price oracle, all inside a single transaction. This "money lego" architecture produces products no single company could build alone and collapses the boundary between infrastructure and application.

For users, DeFi replaces counterparty trust with cryptographic verification. You do not need to believe a protocol is solvent. You can read its contract, inspect its collateral ratios, and trace every transaction in real time. That transparency is both DeFi's biggest advantage over traditional finance and the source of its most serious risks.

How DeFi Protocols Work

DeFi protocols run on smart contracts that hold assets, enforce rules, and settle transactions without human intermediaries. The three mechanical pillars are automated market makers, liquidity pools, and lending markets. Understanding these explains roughly 80 percent of what happens inside the ecosystem.

Automated market makers (AMMs) replace the order book with a mathematical formula. Uniswap's constant-product model (x * y = k) keeps the product of two token reserves constant. When a trader buys token A, they deposit token B into the pool and withdraw token A. Price adjusts automatically based on the ratio of reserves. No seller needs to be waiting on the other side. This design enables 24/7 permissionless trading on any token pair, including highly illiquid assets that no centralized exchange would list.

AMMs evolved through several generations. Uniswap v3 introduced concentrated liquidity, letting liquidity providers specify a price range where their capital is active. Curve Finance optimized for stablecoin-to-stablecoin swaps with a hybrid invariant that minimizes slippage near the peg. Balancer generalized the model to allow weighted multi-asset pools. Each innovation trades off simplicity for capital efficiency. External reference: Uniswap v3 concentrated liquidity whitepaper.

Liquidity pools are the funding mechanism underlying AMMs and many other DeFi primitives. Users deposit token pairs into a pool contract and receive LP tokens representing their proportional share. Those LP tokens accrue trading fees pro-rata. When an LP exits, they burn the LP tokens and receive their share of the pool plus accumulated fees, minus any impermanent loss from price divergence between the two assets.

Liquidity pools extend beyond DEXs. Lending protocols like Aave maintain supply pools from which borrowers draw. Yield aggregators route user deposits across multiple pools to maximize returns. Options protocols use pools as collateral vaults. In each case, the pool is a smart contract that enforces rules autonomously. No fund manager allocates capital; the contract's logic does.

Lending markets let users deposit collateral and borrow a different asset, typically a stablecoin. Aave and Compound dominate this category. The core mechanic is over-collateralization: a borrower who wants $1,000 in USDC might lock $1,500 in ETH. If ETH's price falls and the collateral ratio drops below a liquidation threshold, a liquidator bot repays part of the debt and claims a bonus portion of the collateral. This keeps the protocol solvent without human intervention.

Interest rates in DeFi lending markets update algorithmically in real time based on utilization rate. When 90 percent of a pool is borrowed, rates spike to attract more depositors and discourage further borrowing. When utilization is low, rates compress. This self-regulating market clears continuously rather than at discrete intervals. Understanding the smart contract layer that underlies these mechanics is essential context before deploying capital.

Major DeFi Categories

DeFi organizes into four primary verticals: decentralized exchanges, lending and borrowing, stablecoins, and yield infrastructure. Each vertical has distinct mechanics, risk profiles, and competitive dynamics. Most users interact with all four, often within the same session.

Decentralized exchanges (DEXs) are the most visible DeFi category and the primary price discovery mechanism for long-tail tokens. Uniswap processes the highest volume across EVM chains. Curve dominates stablecoin and pegged-asset swaps. Aerodrome leads on Base. Raydium and Jupiter handle the majority of Solana volume. DEX aggregators like 1inch and Paraswap route across multiple pools to find the best price, abstracting away fragmentation across dozens of venues. Live DEX rankings and volume are tracked at DeFiLlama.

Lending and borrowing protocols are the second-largest category by TVL. Aave leads on Ethereum and most major L2s. Compound pioneered the algorithmic interest rate model that the whole sector now uses. Morpho has grown rapidly by offering peer-to-peer matching on top of Aave and Compound pools, capturing better rates for both sides. Sky (formerly MakerDAO) operates DAI, a decentralized stablecoin backed primarily by USDC and onchain collateral, making it both a lending protocol and a stablecoin issuer.

Stablecoins are the reserve currency of DeFi. USDC, issued by Circle, is the dominant collateral and settlement asset. USDT (Tether) holds the highest market cap overall. DAI and FRAX are decentralized stablecoins with different collateral structures. Stablecoins matter because volatile assets make borrowing and pricing unreliable. A user who wants to leverage ETH exposure borrows USDC against ETH, not more ETH, because USDC's value is predictable. See the full breakdown in our stablecoin automation platforms guide.

Yield infrastructure aggregates and routes capital to maximize returns. Yearn Finance pioneered vault strategies that auto-compound across lending markets and liquidity pools. Convex Finance boosted Curve LP returns by aggregating governance power. Kamino Finance on Solana automates concentrated liquidity management. This layer exists because managing yield manually across dozens of protocols is operationally complex. Aggregators handle rebalancing, compounding, and strategy rotation automatically.

A fifth emerging category is derivatives and structured products: perpetuals protocols (dYdX, GMX, Hyperliquid), options markets (Lyra, Hegic), and real-world asset tokenization platforms that bring Treasury yields onchain. These are growing faster than the core four but remain smaller by TVL as of 2026.

What Is the Difference Between DeFi and CeFi

DeFi and centralized finance (CeFi) both offer lending, trading, and yield products. The difference is who holds your assets, who sets the rules, and who you appeal to when something goes wrong. DeFi settles disputes onchain through code. CeFi settles disputes through legal agreements with a company. The FTX and Celsius collapses in 2022 showed exactly what happens when CeFi's institutional layer fails.

Dimension

DeFi

CeFi

Asset custody

Non-custodial; user holds private keys

Custodial; platform holds assets

Access requirements

Wallet and internet; no KYC required at protocol level

Account application, KYC/AML screening

Rule enforcement

Smart contract code; immutable or governance-upgradeable

Platform terms of service; discretionary

Transparency

All transactions and reserves visible onchain in real time

Reserves audited periodically, not continuously

Counterparty risk

Smart contract bugs and oracle failures

Platform insolvency, fraud, regulatory freeze

Interest rates

Algorithmically set by utilization in real time

Set by platform; updated periodically

Recourse

None; code is final unless protocol has admin key

Legal and regulatory complaint; FDIC insurance in some cases

Composability

Any protocol can integrate any other permissionlessly

APIs available but siloed; no shared liquidity layer

DeFi protocols running during the 2022 crypto winter continued operating without interruption because their collateral and rules were enforced by code on public blockchains, not by a company's internal systems. Conversely, the Euler Finance hack in March 2023 demonstrated DeFi's counterpart failure mode: a smart contract bug drained $197 million in minutes, with no recourse mechanism available to users. Neither model is strictly superior. CeFi offers regulatory protection, fiat on/off ramps, and recovery mechanisms for lost access. DeFi offers permissionless access, real-time transparency, and composability. Most sophisticated users operate in both.

Stablecoins in DeFi

Stablecoins are not a subcategory of DeFi. They are the unit of account, the primary collateral type, and the settlement layer that makes the rest of DeFi functional. Without stablecoins, every loan and every trade would require direct exposure to volatile assets, making DeFi unusable for most practical financial activity.

USDC has become the de facto reserve asset in DeFi, particularly on Ethereum and Base. Circle's regular attestations and regulatory compliance have made USDC the preferred collateral in institutional DeFi, money market protocols, and cross-chain liquidity pools. The growth of ERC-20 tokens as the standard container for stablecoins made interoperability across DeFi protocols technically straightforward from the start. USDC's April 2026 circulating supply exceeded $60 billion, cementing its position as the primary stablecoin collateral layer across Ethereum mainnet and its L2 ecosystem.

Stablecoins split into three structural types. Fiat-backed stablecoins (USDC, USDT, PYUSD) hold dollar reserves in bank accounts and issue tokens 1:1. They are the most liquid and least volatile but reintroduce centralization risk and regulatory exposure. Crypto-backed stablecoins (DAI, LUSD) hold excess onchain collateral to absorb price swings. They are more censorship-resistant but less capital-efficient. Algorithmic stablecoins attempt to maintain the peg through supply expansion and contraction mechanisms; the Terra/LUNA collapse in May 2022 destroyed approximately $40 billion in value and validated deep skepticism about pure algorithmic designs with insufficient collateral backing.

Stablecoins also function as the bridge between DeFi and real-world payments. A business receiving USDC from a DeFi yield strategy and paying suppliers with the same token treats DeFi as a treasury infrastructure layer, not a speculative instrument. That use case is growing. Platforms that automate stablecoin flows across chains are catalogued in our stablecoin automation platforms guide.

Yield on stablecoins is one of DeFi's most compelling products for risk-averse participants. Lending USDC on Aave or supplying it to Curve's 3pool generates yield without directional crypto exposure. Rates fluctuate with borrowing demand but have historically exceeded those of traditional money market accounts during periods of high DeFi activity, without the account application or geographic restrictions of a bank product. The 30-day average Aave USDC supply rate has ranged from 2 percent to 15 percent across different market conditions.

DeFi Risks

DeFi's non-custodial architecture removes counterparty risk from intermediaries and concentrates it in code. The result is a different risk profile than traditional finance, not a safer one. Understanding the five primary risk vectors is a prerequisite for any serious DeFi participation.

Smart contract bugs are the most fundamental risk. A logic error in a lending protocol's collateral calculation, a reentrancy vulnerability in a DEX, or an unchecked integer overflow can drain a pool instantly. Unlike a bank, a DeFi protocol has no fraud department to reverse a malicious transaction. Once a block is confirmed, the outcome is final. Audits by firms like Trail of Bits, OpenZeppelin, and Chainalysis significantly reduce but do not eliminate this risk. The Euler Finance hack ($197M, March 2023) occurred on a contract that had passed multiple audits. The Ronin bridge hack ($625M, March 2022) exploited a validator key management failure. Time-locks, bug bounty programs, and formal verification are additional mitigations, but no protocol is fully closed.

Oracle attacks exploit the price feeds that DeFi protocols depend on to value collateral. If an attacker can manipulate the price an oracle reports, they can make worthless collateral appear sufficient and drain a lending market. Flash loan attacks often combine oracle manipulation with large temporary capital positions that briefly distort AMM prices. The Mango Markets exploit in 2022 used coordinated position-taking to inflate the MNGO token price, allowing the attacker to borrow $114 million against the inflated value. Chainlink, Pyth, and TWAP mechanisms mitigate this but do not eliminate it. Protocols relying on a single AMM pool as their price source remain especially vulnerable. See Chainlink's oracle documentation for a technical breakdown of mitigation approaches.

Liquidation risk affects borrowers in lending protocols. If collateral value falls faster than the liquidation bot network can process transactions, a protocol can accumulate bad debt. The March 2020 "Black Thursday" crash dropped ETH 50 percent in hours. MakerDAO's liquidation system was overwhelmed by gas congestion; liquidators bought collateral for near-zero because no one else could submit transactions. The protocol ended up with $4 million in bad debt that required a governance vote to cover. Modern protocols have improved liquidation incentives and circuit breakers, but extreme market conditions can still cause cascading failures.

Governance attacks are a risk specific to DeFi. Protocols governed by token votes can be attacked by actors who accumulate enough tokens to pass a malicious proposal. The Beanstalk exploit in April 2022 used a flash loan to temporarily acquire a governance majority, passed a proposal to drain the protocol's treasury, and exited in the same transaction, netting approximately $182 million. Timelock delays and quorum requirements reduce this vector but impose their own costs on legitimate governance.

Bridge risks are amplified in cross-chain DeFi. Moving assets between chains requires a bridge contract that holds funds on both sides. The Ronin Bridge hack ($625M), the Wormhole exploit ($320M), and the Nomad bridge hack ($190M) collectively account for over $1 billion in losses from bridge vulnerabilities in 2022 alone. Newer intent-based cross-chain protocols are designed to reduce bridge custody risk, covered in the next section.

Cross-Chain DeFi

DeFi fragmented across dozens of chains as L2 networks scaled transaction capacity. Ethereum hosts the deepest liquidity but the highest fees. Arbitrum, Base, and Optimism offer lower costs for the same EVM-compatible ecosystem. Solana handles high-frequency trading. The result: a user seeking the best yield or lowest swap cost must bridge assets between chains, introducing delay, cost, and bridge risk into every cross-chain interaction.

Intent-based protocols emerged to solve cross-chain fragmentation without the custody risk of traditional bridges. In an intent system, a user declares what they want ("swap 1,000 USDC on Arbitrum for ETH on Base at a specific rate") and solvers compete to fill that intent. The solver fronts the capital on the destination chain and is reimbursed from the origin chain after a settlement proof. The user's funds are never locked in a bridge contract for an extended period; settlement happens in seconds through a solver network that absorbs the cross-chain coordination risk.

Eco routes stablecoin payments and swaps across 15 supported chains using this intent architecture. Rather than requiring users to manually bridge, select a DEX on each chain, and manage gas tokens, Eco abstracts the entire cross-chain path. A user specifying a USDC-to-USDC move from Ethereum to Base pays once, in stablecoin, and receives funds on the destination within seconds. The routing layer selects the optimal path across available liquidity without exposing users to bridge custody windows. Our comparison of the leading protocols in this space is in the best cross-chain intent protocols guide.

Cross-chain DeFi is also driving convergence between chains that previously operated independently. Solana's high throughput attracts perpetuals trading volume. Base's low fees attract retail stablecoin users. Ethereum mainnet retains the deepest institutional DeFi pools. An intent-routing layer that treats all three as execution venues rather than isolated ecosystems allows capital to flow where it is most productive without manual user management. The regulatory implications of cross-chain DeFi are still forming. Protocols operating at the intent layer, spanning multiple chains, present a harder regulatory target than single-chain deployments. This dynamic will shape DeFi's relationship with financial regulators through 2026 and beyond. For a deeper look at the intent protocol landscape, see our dedicated comparison.

The ERC-20 token standard is the technical foundation that makes cross-chain DeFi composable: tokens on any EVM chain share the same interface, so protocols built on Ethereum can be deployed on Arbitrum, Base, or Optimism without modification. This standardization is what allowed DeFi to expand across chains so rapidly.

FAQ

Is DeFi legal?

DeFi protocols are software deployed on public blockchains. Using them is generally legal in most jurisdictions, though regulatory treatment varies. Some countries require KYC for accessing DeFi front-ends. The U.S. has applied securities laws to certain governance tokens and DAO structures. Users should verify their local regulations before using DeFi lending or yield products, particularly for large positions.

What is TVL in DeFi?

Total value locked (TVL) measures the dollar value of assets deposited across all DeFi protocol contracts. It is the standard metric for protocol size and ecosystem health. TVL fluctuates with both capital inflows and asset price changes, so a rising TVL does not always mean new capital entered. DeFiLlama is the canonical source for real-time TVL data across all chains and protocols.

Can you lose money in DeFi?

Yes, through several mechanisms. Smart contract exploits can drain funds with no recourse. Impermanent loss reduces LP returns when asset prices diverge. Borrowers can be liquidated if collateral falls in value. Stablecoin depegs can cause cascading losses. Rug pulls by anonymous teams who drain protocol liquidity are common in newer, unaudited projects. Risk varies enormously between established audited protocols and new launches.

How do DeFi protocols make money?

Most protocols earn fees on the activity they facilitate. DEXs charge a swap fee (typically 0.01 percent to 1 percent depending on pool tier) split between LPs and sometimes a protocol treasury. Lending protocols take a spread between borrow and supply rates or a flat origination fee. Yield aggregators charge a performance fee on generated returns. Protocol revenue is often distributed to governance token holders through buybacks or direct dividends.

What is the difference between DeFi and Web3?

DeFi is a specific application category focused on financial services built on blockchains. Web3 is a broader framing that includes DeFi alongside NFTs, decentralized identity, onchain gaming, and any application layer built on public blockchains. DeFi is a subset of Web3. You can participate in DeFi without engaging with the wider Web3 ecosystem, and vice versa.

Related Reading

Did this answer your question?