What Is DeFi? Decentralized Finance Explained (DeFi vs CeFi)
DeFi (decentralized finance) is trading, lending and borrowing run by smart contracts on public blockchains, used directly from your own wallet instead of through a bank.

In this guide
DeFi, short for decentralized finance, is a set of financial services such as trading, lending, borrowing and earning interest that run on public blockchains through code called smart contracts, instead of through banks or brokers. You use them directly from your own crypto wallet, with no account application and no company holding your funds in the middle.
So what is DeFi in practice? It is apps like decentralized exchanges where you swap tokens from a shared pool, lending markets where you deposit crypto to earn interest or borrow against it, and stablecoins that track the US dollar. Most of it runs on Ethereum and networks built around it, though other blockchains such as Solana host large DeFi ecosystems too.
This guide explains what DeFi is and how it works, compares DeFi vs CeFi vs TradFi, covers the main building blocks, walks through a DeFi loan with real numbers (including what triggers a liquidation), and sets out the risks and a safe way to get started.
What Is DeFi and How Does It Work?
Traditional finance relies on intermediaries: a bank keeps the ledger, approves loans and holds deposits. DeFi replaces many of those roles with smart contracts, programs stored on a blockchain that run exactly as written when someone sends them a transaction. Because the code and its balances are public, anyone can check what a contract holds and how it behaves.
Four properties define most DeFi protocols:
- Non-custodial: you keep control of your assets in your own wallet until you send them into a contract, and you can usually withdraw without anyone’s permission.
- Permissionless: anyone with a wallet and internet access can use the protocol, without an account or credit check.
- Transparent: transactions and contract balances are visible on the blockchain.
- Composable: protocols can plug into each other like building blocks. A token earned in one app can be used as collateral in another, which is why DeFi is sometimes called “money Legos.”
Every action is a blockchain transaction, so you pay a network fee (gas) each time. On Ethereum’s main network those fees can be significant for small amounts, which is why much DeFi activity has moved to cheaper layer 2 networks. For background on the platform most DeFi runs on, see our Ethereum explainer.
DeFi vs CeFi vs TradFi
CeFi (centralized finance) means crypto companies such as exchanges and lending platforms that hold customer funds. TradFi (traditional finance) means banks, brokers and other regulated institutions dealing mainly in conventional money and securities. Here is how the three compare.
| Feature | DeFi | CeFi | TradFi |
|---|---|---|---|
| Who holds your assets | You, or a smart contract you choose | The crypto company | The bank or broker |
| Access | Anyone with a wallet | Account with ID verification | Account with ID and often credit checks |
| Rules enforced by | Code on a blockchain | Company policy and regulation | Law, regulation and contracts |
| Hours | 24/7 | 24/7 | Mostly business hours |
| Transparency | Public on-chain data | Limited; relies on company reports | Audited reports, regulatory filings |
| Consumer protection | Little or none | Varies by country and license | Deposit insurance, investor protection schemes |
| Main risks | Code bugs, hacks, oracle failures, user error | Insolvency, fraud, hacks, account freezes | Bank failure (partly insured), fees, access limits |
| Mistakes reversible? | Generally no | Sometimes, through support | Often, through disputes and chargebacks |
DeFi vs CeFi is mostly a question of who you trust: code you can inspect but probably cannot read, or a company you cannot inspect but can sue and regulators can supervise. The 2022 failures of CeFi lenders like Celsius showed the company risk, while DeFi hacks have shown the code risk.
The Building Blocks of DeFi
Decentralized exchanges (DEXs) and AMMs
A decentralized exchange lets you swap one token for another directly from your wallet. Most DEXs, including Uniswap, use an automated market maker (AMM) instead of an order book. Users called liquidity providers deposit pairs of tokens into a liquidity pool, and a formula sets the price. Uniswap’s classic design keeps the product of the two token balances constant (x × y = k), so buying one token makes it progressively more expensive.
For example, if a pool holds 100 ETH and 300,000 USDC, then k = 30,000,000 and the price is $3,000 per ETH. If you add 30,000 USDC (ignoring fees), the pool must keep k constant: 30,000,000 / 330,000 = about 90.91 ETH left, so you receive about 9.09 ETH at an average price of about $3,300. That 10% difference is price impact, and it is why large trades in small pools are expensive. Liquidity providers earn a share of trading fees but face impermanent loss, explained in our guide to liquidity pools.
Lending and borrowing
Lending protocols such as Aave and Compound pool deposits from lenders and let borrowers take loans against collateral. Interest rates adjust automatically based on how much of the pool is borrowed. Because there are no credit checks, loans are overcollateralized: you must deposit more value than you borrow. The worked example below shows how that works.
Stablecoins
Stablecoins are tokens designed to hold a steady value, usually $1. They are the base currency of DeFi. Some, like USDC and USDT, are backed by reserves held by a company. Others, like DAI (and its successor token USDS, after MakerDAO rebranded as Sky in 2024), are created by users who lock up crypto collateral in smart contracts.
Derivatives and other products
DeFi also includes derivatives, contracts whose value depends on another asset. The most common are perpetual futures, which let traders bet on price moves with leverage and no expiry date. Other building blocks include yield aggregators that move funds between protocols, liquid staking tokens, and cross-chain bridges. For how these yield strategies differ, see staking vs yield farming vs lending.
How a DeFi Loan Works: Overcollateralization and Liquidation
A DeFi lending protocol sets two key limits for each type of collateral:
- Maximum loan-to-value (LTV): the most you can borrow as a share of your collateral’s value when you open the loan.
- Liquidation threshold: the share at which your position becomes unsafe and can be liquidated.
Protocols like Aave summarize this as a health factor: collateral value × liquidation threshold, divided by debt. Above 1, you are safe. Below 1, anyone can repay part of your debt and claim some of your collateral at a discount. This process, liquidation, is done by bots called liquidators and keeps the protocol solvent without a loan officer.
Example: Suppose you deposit 10 ETH when ETH is priced at $3,000, so your collateral is worth $30,000. Assume hypothetical settings of a 75% maximum LTV, an 80% liquidation threshold and a 5% liquidation bonus.
- You could borrow up to 75% × $30,000 = $22,500, but you borrow a more cautious $15,000 USDC, an LTV of 50%.
- Health factor: ($30,000 × 0.80) / $15,000 = 1.6.
- Liquidation price: the health factor hits 1 when 10 × price × 0.80 = $15,000, so price = $15,000 / 8 = $1,875, a 37.5% drop from $3,000.
Now ETH falls to $1,850. Your collateral is worth $18,500 and your health factor is ($18,500 × 0.80) / $15,000 = about 0.99, so you can be liquidated.
- A liquidator repays half your debt, $7,500, and receives ETH worth $7,500 × 1.05 = $7,875, which is $7,875 / $1,850 = about 4.26 ETH.
- You are left with about 5.74 ETH (worth about $10,625) and $7,500 of debt. Your new health factor is ($10,625 × 0.80) / $7,500 = about 1.13.
- Your equity drops from $18,500 − $15,000 = $3,500 to $10,625 − $7,500 = $3,125. The $375 difference is the liquidation penalty paid to the liquidator.
Had you borrowed $22,500 at the maximum, the liquidation price would have been $22,500 / 8 = $2,812.50, only about a 6% drop.
Real protocols use different thresholds and bonuses for each asset and update their rules over time, so always check the current parameters in the protocol’s own interface or documentation before borrowing. People borrow this way to get cash without selling their crypto, which may avoid a taxable sale in some countries, but the liquidation risk is real in volatile markets.
DeFi Risks: Smart Contracts, Oracles and More
Smart contract risk
A bug in a contract can let an attacker drain funds, and because contracts often hold hundreds of millions of dollars, they are constant targets. Audits by security firms reduce but do not remove this risk; audited protocols have still been exploited. In March 2023, for example, the lending protocol Euler Finance lost about $197 million to an exploit (most of it was later returned by the attacker). Some contracts are also upgradeable by an admin key, which reintroduces trust in whoever controls it.
Oracle risk
Blockchains cannot see outside prices on their own. An oracle is a service that feeds external data, such as the ETH/USD price, into smart contracts. If an oracle reports a wrong price, through a fault or manipulation, a protocol can make bad loans or wrongful liquidations. In October 2022, a trader pushed up the price of a thinly traded token used by Mango Markets and borrowed about $110 million against the inflated collateral. Well-designed protocols use multiple data sources and time-averaged prices to limit this.
Other risks
- Bridge hacks: bridges that move tokens between blockchains have been among the largest targets, such as the roughly $600 million Ronin bridge hack in 2022.
- Stablecoin de-pegs: a stablecoin can lose its $1 value, as the algorithmic TerraUSD did in May 2022.
- Liquidation and leverage: borrowing magnifies losses, as the example shows.
- Governance and centralization: many “decentralized” protocols are controlled in practice by a small group holding governance tokens or admin keys, a point the Bank for International Settlements has called the “decentralisation illusion.”
- Scams and user error: fake front-end sites, malicious token approvals and rug pulls. See our guide to common crypto scams.
- Regulation and tax: rules for DeFi are still developing and differ by country, and swaps can be taxable events.
Warning: Very high advertised yields usually mean very high risk, often from token rewards that can lose value quickly, heavy leverage or an unproven protocol. There is no deposit insurance in DeFi; if a contract is drained, your funds may be gone for good.
How to Start With DeFi Safely
- Learn wallet basics first. Know how to back up a seed phrase and how transaction signing works before connecting to any protocol.
- Use a separate wallet for DeFi with only the amount you plan to use, and keep long-term holdings in a hardware wallet.
- Start small. Use an amount you can afford to lose entirely while you learn, and try one simple action first, such as a small swap or a stablecoin deposit.
- Stick to established protocols with a long track record, public audits and significant liquidity. Reach them through bookmarked official URLs, not search ads or links in messages.
- Consider a layer 2 network to keep gas fees from eating small transactions.
- Read every approval. Avoid granting unlimited token spending where you can, and periodically revoke approvals you no longer need.
- Understand the yield source. Ask where the return comes from: borrowers paying interest, trading fees or newly issued tokens. If you cannot tell, do not deposit.
- Keep records of your transactions for tax purposes, since rules differ by country.
Bottom Line
DeFi is financial services rebuilt as open smart contracts: anyone with a wallet can swap, lend, borrow or hold stablecoins without a bank in the middle. That openness brings real advantages, including 24/7 access, transparency and composability, but it also removes the safety nets of traditional finance and adds code, oracle and liquidation risk. If you explore it, start small, use established protocols and understand exactly how each position can lose money before you enter it. Find more guides in our crypto hub.
Sources
- ethereum.org – Decentralized finance (DeFi)
- ethereum.org – Introduction to smart contracts
- ethereum.org – Oracles
- ethereum.org – Stablecoins
- Uniswap Docs – How Uniswap works
- Aave – Documentation
- Bank for International Settlements – DeFi risks and the decentralisation illusion
- Investor.gov (SEC) – Crypto Assets
Frequently asked questions
What is DeFi in simple terms?
DeFi, or decentralized finance, is a set of financial apps that run on blockchains instead of through banks. You connect your own crypto wallet to swap tokens, lend, borrow or earn interest, and smart contracts enforce the rules automatically.
What is the difference between DeFi and CeFi?
In CeFi, a company such as an exchange holds your crypto and runs the service, so you depend on that company. In DeFi, you interact with smart contracts directly from your own wallet, so you depend on the code working as intended and on your own security.
How is DeFi different from traditional finance (TradFi)?
TradFi relies on regulated institutions, business hours, credit checks and consumer protections such as deposit insurance. DeFi is open 24/7 to anyone with a wallet and runs on public code, but it has little consumer protection and transactions are generally irreversible.
Is DeFi safe?
DeFi carries significant risks, including smart contract bugs, hacks, oracle failures, liquidations and scams, and there is no deposit insurance. Established, audited protocols are generally lower risk than new ones, but no protocol is risk-free, so only use amounts you can afford to lose.
How do people make money with DeFi?
Common ways include earning interest by lending, earning trading fees by providing liquidity, and earning token rewards. Each carries risks, such as borrower defaults handled by liquidation, impermanent loss for liquidity providers, and falling reward-token prices.
What happens if my DeFi loan gets liquidated?
When your collateral's value falls below the protocol's liquidation threshold, a liquidator repays part of your debt and receives some of your collateral plus a bonus. You keep the borrowed funds and the remaining collateral, but you lose the bonus amount as a penalty.
Do I need ETH to use DeFi?
On Ethereum and most Ethereum layer 2 networks, you need a small amount of ETH to pay gas fees for each transaction. Other blockchains with DeFi apps use their own native token for fees, such as SOL on Solana.