# DeFi Basics

> DeFi offers trading, lending and borrowing through smart contracts instead of banks. Learn the building blocks, where yields come from and the risks.

Source: https://learn.tradelabsai.com/crypto/defi-basics/  
Track: Crypto · Level: Advanced · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "DeFi Basics", https://learn.tradelabsai.com/crypto/defi-basics/

Decentralised finance, or DeFi, recreates financial services such as trading, lending, borrowing and derivatives using smart contracts on public blockchains, mainly Ethereum and similar networks. Anyone with a wallet can use these services without an account or approval, and the rules are written in open code. DeFi grew from a few hundred million dollars of deposits in 2019 to more than $100 billion at its peaks. It offers new opportunities, but its risks, from code bugs to liquidation cascades, are just as real.

## The building blocks

| Service | How it works | Examples |
|---|---|---|
| Decentralised exchanges | Swap tokens through liquidity pools | Uniswap, Curve. See [Centralized vs Decentralized Exchanges](https://learn.tradelabsai.com/crypto/cex-vs-dex/) |
| Lending and borrowing | Deposit assets to earn interest; borrow against collateral | Aave, Compound |
| Stablecoins | Dollar tokens, some created through DeFi collateral | DAI/USDS. See [Stablecoins](https://learn.tradelabsai.com/crypto/stablecoins/) |
| Liquid staking | Stake tokens and receive a tradable receipt token | Lido. See [Staking and Restaking](https://learn.tradelabsai.com/crypto/staking-and-restaking/) |
| Derivatives | Perpetuals and options on chain | Hyperliquid, dYdX |
| Yield aggregators | Move funds between protocols to chase yield | Yearn |

## Total value locked (TVL)

TVL measures the value of assets deposited in DeFi protocols. It rises with deposits and with token prices, so it is a rough gauge of DeFi activity rather than a precise measure. Analytics sites such as DefiLlama track TVL across chains and protocols.

## How DeFi lending works

1. **Lenders deposit** tokens into a pool and earn interest.
2. **Borrowers deposit collateral** worth more than they borrow (overcollateralisation).
3. **Interest rates adjust automatically** with supply and demand: when most of a pool is borrowed, rates rise.
4. **If collateral value falls** below a threshold, anyone can liquidate the position, repaying part of the debt and receiving collateral at a discount.

**Example: A DeFi loan**
You deposit 10 ETH worth $30,000 and borrow 18,000 USDC. With a liquidation threshold of 80%, your loan is liquidated if the debt exceeds 80% of collateral value. Liquidation happens if ETH falls to about $2,250 (18,000 / (10 × 0.80)), a 25% decline. If ETH drops to $2,200, a liquidator repays part of your debt and takes some of your ETH plus a bonus, often 5% to 10%. See [Liquidations in Crypto](https://learn.tradelabsai.com/crypto/liquidations-in-crypto/).

## Where DeFi yields come from

| Source | Example |
|---|---|
| Borrowing demand | Traders borrowing stablecoins for leverage |
| Trading fees | Liquidity providers earn swap fees |
| Staking rewards | Network rewards passed through liquid staking |
| Token incentives | Protocols paying users in their own tokens, often temporary |
| Real world assets | Tokenised Treasury bills paying interest |

If a yield seems very high, ask where it comes from. Yields paid in newly printed tokens can collapse as token prices fall.

## Liquidity providing and impermanent loss

Liquidity providers deposit two tokens into a pool and earn fees. If prices move a lot, they end up with more of the token that fell and less of the token that rose, compared with simply holding. This is impermanent loss. For a 50/50 pool, if one token doubles in price relative to the other, the loss compared with holding is about 5.7%; if it rises fourfold, about 20%. Fees must exceed this loss to profit.

## The risks of DeFi

- **Smart contract bugs:** hacks have drained billions. See [Bridge and Smart Contract Risk](https://learn.tradelabsai.com/crypto/bridge-and-smart-contract-risk/).
- **Oracle manipulation:** bad price feeds can trigger wrong liquidations. See [Oracles](https://learn.tradelabsai.com/crypto/oracles/).
- **Liquidation cascades** in sharp market falls.
- **Stablecoin depegs.**
- **Governance attacks:** attackers buy or borrow voting tokens to change protocol rules.
- **MEV:** bots extract value from users' transactions. See [MEV](https://learn.tradelabsai.com/crypto/mev/).
- **Regulatory uncertainty.**
- **User error:** wrong addresses, malicious approvals, phishing sites.

## Getting started sensibly

1. **Start small** and use well audited, established protocols.
2. **Understand the source of yield** before depositing.
3. **Monitor collateral ratios** on loans.
4. **Use a separate wallet** for experimenting.
5. **Revoke approvals** you no longer need.

## Frequently asked questions

### What is DeFi?

Decentralised finance: financial services like trading, lending and borrowing provided by smart contracts on public blockchains instead of banks or brokers.

### How do DeFi lending protocols work?

Lenders deposit assets into pools to earn interest, and borrowers lock collateral worth more than their loans; if collateral value falls too far, the loan is liquidated.

### Is DeFi safe?

It carries significant risks, including smart contract hacks, oracle failures, liquidations and scams, so users should start small and use established protocols.

Next, learn how blockchains get price data in [Oracles](https://learn.tradelabsai.com/crypto/oracles/).

## Continue learning

- Next lesson: [Oracles](https://learn.tradelabsai.com/crypto/oracles/)
- Previous lesson: [Wallet and Exchange Flows](https://learn.tradelabsai.com/crypto/wallet-and-exchange-flows/)
- Related: [Wallet and Exchange Flows](https://learn.tradelabsai.com/crypto/wallet-and-exchange-flows/): Exchange inflows, outflows, whale wallets and stablecoin flows reveal how crypto is moving. Learn the key flow metrics, how to read them and their pitfalls.
- Related: [Centralized vs Decentralized Exchanges](https://learn.tradelabsai.com/crypto/cex-vs-dex/): Centralised exchanges hold your funds and match orders; decentralised exchanges trade from your wallet via smart contracts. Compare costs, safety and how each works.
- Related: [Stablecoins](https://learn.tradelabsai.com/crypto/stablecoins/): Stablecoins are crypto tokens designed to hold a steady value, usually $1. Learn how fiat backed, crypto backed and algorithmic stablecoins work, and their risks.
- Related: [Oracles](https://learn.tradelabsai.com/crypto/oracles/): Oracles bring outside data like prices and event results onto blockchains. Learn how Chainlink feeds and UMA's optimistic oracle work, and how attacks happen.
- Related: [Bridge and Smart Contract Risk](https://learn.tradelabsai.com/crypto/bridge-and-smart-contract-risk/): Smart contract bugs and cross chain bridge hacks have cost crypto users billions. Learn how bridges work, famous exploits, warning signs and how to reduce your risk.
- Related: [Staking and Restaking](https://learn.tradelabsai.com/crypto/staking-and-restaking/): Staking locks proof of stake tokens to secure a network and earn rewards; restaking reuses staked tokens for more yield. Learn how both work and the risks.
