Lending and Borrowing in DeFi Explained
How a smart contract replaces the bank, why every loan needs collateral up front, and what happens when that collateral isn't enough anymore.
How a lending pool actually works
In a bank, your deposit and someone else's loan are connected behind the scenes: the bank takes your money in, decides who's creditworthy enough to borrow it, and pockets the spread between what it pays you and what it charges them. DeFi lending protocols (see our DeFi explainer if you're new to the space) skip the middleman by pooling everything into a smart contract that anyone can deposit into or borrow from directly.
Say you deposit ETH into a lending pool. That ETH joins a shared pot with everyone else's deposits of the same asset. Anyone who wants to borrow ETH from that pool can, as long as they've posted enough collateral of their own. You earn interest for supplying liquidity, they pay interest for using it, and the smart contract handles the accounting automatically, all day, every day, with no branch hours.
Interest rates aren't set by a loan officer either. Most protocols calculate them algorithmically based on the pool's utilization rate, meaning what fraction of the deposited assets are currently borrowed out. When utilization is low, rates stay low to encourage borrowing. When a pool gets heavily borrowed, rates climb to attract more deposits and cool off demand. It's a supply-and-demand curve running in real time instead of a rate a bank sets once and rarely touches.
Why every loan needs more collateral than it's worth
This is the part that throws people off at first. A bank can pull your credit history, verify your income, and take legal action if you stop paying. A smart contract can do none of that. It doesn't know who you are, and if you simply walk away from a loan, there's no court to sue you in and no credit score to ding.
So the protocol protects itself the only way it can: it requires overcollateralization, meaning you have to post collateral worth more than what you're borrowing. A common hypothetical shape looks like depositing $150 of ETH to borrow $100 of a stablecoin. That extra buffer is what makes the loan safe from the protocol's side, since the collateral itself, not your promise to repay, is the real guarantee.
It sounds inefficient compared to a traditional loan, and in a narrow sense it is: you're locking up more value than you're getting out. But it's what makes permissionless lending possible at all. No identity checks, no approval process, no waiting, just collateral doing the job a credit score does elsewhere.
Liquidation: what happens when collateral falls short
Your collateral has to stay worth more than your loan for the whole time you're borrowing, not just at the moment you take it out. If the collateral's price drops, or the borrowed asset's price rises, that cushion shrinks. Once it shrinks past a threshold the protocol sets (your collateral ratio dropping too low), the position becomes eligible for liquidation.
At that point the protocol automatically sells off enough of your collateral to repay the loan, usually with a penalty fee tacked on for good measure. This is conceptually similar to how liquidation works in perpetual futures trading, forced closure once a position can no longer cover itself, though the mechanics differ: perps liquidation closes a leveraged trade, lending liquidation sells collateral to make a lender whole.
The upside is that you're not powerless while your collateral ratio is drifting toward danger. You can add more collateral to shore up the position, or repay part of the loan early, either of which buys you breathing room. Borrowers who keep an eye on their ratio and act before it's critical rarely get liquidated. Borrowers who don't, do.
Why people borrow this way at all
Given that you have to lock up more than you're borrowing, it's fair to ask why anyone bothers. A few genuine reasons come up repeatedly:
- Getting liquidity without selling. If you hold ETH and believe it'll be worth more later, selling it to raise cash means giving up that upside and, depending on where you live, triggering a taxable event. Borrowing stablecoins against your ETH gets you the cash while you keep holding the asset.
- Leverage. Borrow against one asset to buy more of another (or more of the same one), amplifying your exposure without needing the full amount in cash up front.
- Shorting. Borrow an asset you think will drop, sell it immediately, and plan to buy it back later at a lower price to repay the loan, pocketing the difference.
All three are just different uses of the same basic mechanism: unlocking value from an asset without giving up ownership of it, at least not yet.
The lender's side, honestly
Interest paid to lenders comes directly from borrower demand, it's not conjured out of nowhere. Overcollateralization is what protects lenders from the ordinary case of a borrower's position going underwater: the protocol liquidates before the loan is actually at risk, so a typical default doesn't cost lenders anything.
But lenders still carry two real risks worth naming plainly. One is smart contract risk: a bug or exploit in the lending protocol's code could put deposited funds at risk regardless of how sound the collateral math is. The other is a fast, severe price crash that outpaces the liquidation mechanism itself, where prices fall so quickly that collateral can't be sold fast enough to fully cover the loan before it's underwater. When that happens, the protocol ends up holding bad debt, a real and documented failure mode in DeFi lending, not a hypothetical edge case.
The practical takeaway
DeFi lending is one of the more genuinely useful, battle-tested corners of DeFi, closer to actual financial infrastructure than to the purely speculative products that tend to dominate the headlines. That doesn't make it risk-free. Understanding your collateral ratio and where your liquidation threshold sits matters just as much here as it does before you open a leveraged perps position. If any of the terms above felt unfamiliar, our crypto glossary is a good place to fill in the gaps before you deposit anything.
Keep learning the fundamentals
Free · No sign-up · Part of the LabelYX Learn series