back to lessons
$ ~/learn/defi-basics cat
6 min read
// 05 · applications

DeFi: decentralized finance

Financial services — lending, trading, insurance — rebuilt as open-source smart contracts anyone can use or fork.

> The building blocks

DeFi is built from a handful of primitives: stablecoins (USDC, DAI) pegged to the dollar, DEXs (Uniswap) for trustless swaps, lending markets (Aave) where you can borrow against collateral, and yield aggregators that route capital automatically.

> How swaps work

Traditional exchanges match buyers and sellers via an order book. Most DeFi exchanges use an automated market maker (AMM) instead: a pool of two tokens, priced by a mathematical formula (typically x·y=k). Liquidity providers deposit both tokens and earn a share of trading fees.

> Risks

Smart contracts can have bugs. Stablecoins can de-peg. 'Impermanent loss' can make liquidity provision less profitable than simply holding. Yields advertised as 'safe' often depend on token emissions that eventually fade. Read the docs; audit doesn't mean safe.