DeFi explained: swaps and loans with no bank and no company
Decentralized finance lets you swap tokens and borrow through smart contracts. How Uniswap, Aave and liquidity pools work, and where people lose money.
DeFi (decentralized finance) means financial services that run as programs on a blockchain. Instead of a bank with offices and staff, there is a smart contract: it takes in money and pays it out according to rules written in advance. There is no account to open; a crypto wallet is enough.
Swaps without a company: Uniswap
Uniswap was created by programmer Hayden Adams in November 2018. It is a decentralized exchange (DEX) on Ethereum. It has no order book where buyers and sellers post their prices. Liquidity pools do the job instead.
A liquidity pool is a smart contract holding two tokens, for example ETH and USDT. The price is set by the formula x × y = k: the product of the amounts of the two tokens in the pool must not decrease. The more ETH is taken out of the pool, the more each next unit costs.
Example: the pool holds 100 ETH and 300,000 USDT, so the price is 3,000 USDT per ETH. Someone buys 10 ETH. That leaves 90 ETH in the pool, and by the formula the buyer has to put in about 33,333 USDT, not 30,000. The average price comes out at about 3,333 USDT. The smaller the pool, the further the price drifts from the market price.
Liquidity providers are ordinary users who have put both tokens into the pool. They get most of the fee on every swap: in Uniswap's classic pools a swap costs 0.3%. The risk is that when the price moves sharply, their share tilts toward the token that got cheaper. This is called impermanent loss: sometimes it would have been better to simply hold the coins.
Loans without a bank: Aave
Aave is a lending protocol that has worked under its current name since 2020. Some users deposit tokens and earn interest, others borrow against collateral.
The main rule: the collateral is always worth more than the loan. Say you deposited ETH worth the equivalent of 1,000,000 ₸ (Kazakhstan's tenge) and borrowed 500,000 ₸ in stablecoins. The protocol constantly compares the value of the collateral with the debt; at Aave this figure is called the health factor. If ETH gets cheaper and the figure drops below 1, liquidation begins: any participant can repay part of your debt and take part of your collateral at a discount. Nobody will call to warn you: the contract enforces the rule at any hour of the day or night.
Why take such a loan? To get money without selling your crypto. But in a sharp market drop you can lose part of your collateral.
Where people lose money in DeFi
- Bugs in the code. A contract does what is written, not what was intended. In 2016, tokens worth about $50 million were drained from The DAO project on Ethereum through a vulnerability.
- Hacks. In March 2023 the Euler Finance protocol lost about $197 million. The hacker later returned most of it, but things rarely end that way.
- Liquidations when the price of the collateral falls sharply.
- Fake websites and tokens. Scammers copy the interface of popular protocols and trick people into signing a request in their wallet, after which the tokens leave the address.
- A stablecoin losing its peg. If a coin in a pool loses its rate, everyone holding it suffers: how this happens with USDT and USDC.
| Bank | DeFi protocol | |
|---|---|---|
| Who is responsible | the bank | nobody, only the code |
| Mistaken transfer | can sometimes be disputed | cannot be reversed |
| Deposit guarantee | yes, in Kazakhstan through KDIF, the deposit insurance fund | no |
| Access | after an identity check | any wallet |
In DeFi there is no support desk: sign the wrong transaction, and the money is gone for good.
Before using any protocol, check how old it is, whether its code was audited and whether it has been hacked. Never enter your seed phrase on websites: why this is the main rule. "Pools" that promise high returns often turn out to be a financial pyramid scheme.
This article is for general information and is not investment advice. Cryptocurrency can fall sharply in price, and money put into it is not insured.
Read next
On-chain data for beginners: why a whale moving 1,000 BTC is not a signal
Anyone can check any Bitcoin or Ethereum transaction. How to read a block explorer, who whales are and why a transfer to an exchange does not always mean a sale.
Financial Health Check: 10 Questions and What to Do With Each No
Expense tracking, an emergency fund, debts, insurance, goals and pension. Answer each question with an honest yes or no and start with your first no.
Crypto airdrops: how giveaways work and how a fake claim drains a wallet
Free tokens can be real, but more often a fake airdrop just asks for one signature. How giveaways work, what approve and permit are and how to revoke access.
Comments no comments yet
Readers signed in with Telegram can comment. No password needed: you confirm the sign-in in the bot.