Owning, Moving & Using Crypto

DeFi: Banking Without Banks

Lending, borrowing and trading run entirely by code, powerful, and full of fresh ways to lose money.

DeFi, decentralized finance, is the world of financial services rebuilt as smart contracts, with no bank or broker in the middle. You can lend, borrow, trade and earn yield by interacting directly with code, using only your wallet.

What you can actually do

  • Lend your crypto to a pool and earn interest.
  • Borrow against crypto you post as collateral.
  • Swap tokens instantly on a decentralised exchange.
  • Provide liquidity to a trading pool and earn a cut of the fees.

How a decentralised exchange prices things

There is no order book. A pool holds two tokens, and a formula keeps the product of the two balances constant. Buying ETH from an ETH/USDC pool removes ETH and adds USDC, which moves the price up. The deeper the pool, the less each trade moves it. Liquidity providers deposit both tokens, earn a cut of every swap fee, and in exchange take on a specific cost.

Impermanent loss, with a number

If you deposit ETH and USDC and ETH doubles, the pool has sold your ETH on the way up to keep its ratio. You end up about 5.7% behind simply holding the two tokens. If ETH quadruples, you are 20% behind. The swap fees are supposed to cover that gap. In a quiet pool with low volume they do not, and the advertised yield was never going to.

Borrowing without a credit check

Lending protocols are overcollateralised. You can borrow about 75% to 80% of the value of the collateral you post, and if the collateral falls enough that the loan crosses the liquidation line, anyone can repay part of your loan and take your collateral at a discount, typically 5% to 10%. Interest rates float with pool utilisation, so the rate you borrowed at is not the rate you pay next month. The yield lenders earn is simply that borrowing interest, the one yield in DeFi that needs no explanation.

Where the yield comes from

Real DeFi yield comes from real demand, borrowers paying interest, traders paying swap fees. That is legitimate. But a lot of advertised yield is really a token subsidy: the protocol prints its own token to pay you, and that token can crater. Always ask where the money is actually coming from.

How money is actually lost

  • Smart-contract exploits. More than $3 billion was stolen from protocols in 2022 alone, and a bridge between two chains lost over $600 million in a single incident that year. An audit lowers the odds; it does not remove them.
  • Depegs. A "stablecoin" backed by its own sister token collapsed in May 2022 and took around $40 billion with it. Stable means backed by something that holds value when the token does not.
  • Rug pulls, where the team drains the pool. Anonymous team, new token, triple-digit yield and liquidity lock "coming soon" is the pattern.
  • Token approvals. Granting a contract unlimited access to a token is normal and is also how a malicious site empties a wallet. Revoke approvals you are not using.
Spend the first months on the protocols that have survived several years and several crashes, with the deepest pools, and treat every yield above the plain lending rate as a question: who is paying this, and why?

Code = law

in DeFi the smart contract does exactly what it says, including its bugs

Key takeaways

1DeFi is lending, borrowing, swapping and liquidity provision run by smart contracts, straight from your wallet.
2Pools price by formula; providing liquidity earns fees but costs impermanent loss, about 5.7% when one side doubles.
3Loans are overcollateralised with floating rates and a liquidation line; lending yield is just that interest.
4Exploits, depegs, rug pulls and open approvals are how money is lost; stick to proven protocols and ask who pays the yield.

Educational content only, not financial advice. Trading and investing carry real risk of loss, including your entire capital. Do your own research and consult a licensed professional before making financial decisions.

This is one lesson of 541.

The whole Foundation is free — 16 subjects, beginner to advanced. Sign in to track what you have read, take the end-of-module quizzes, and use the terminal.