Research/Education/How on-chain lending works: collateral, liquidations, and flash loans
# Ethereum

How on-chain lending works: collateral, liquidations, and flash loans

BloFin Academy07/01/2026

On-chain lending lets you borrow crypto from a smart-contract pool by locking up more value than you take out, with no bank or credit check. If your collateral falls too far, the contract sells part of it automatically to repay the loan. This guide covers the collateral math, liquidations, oracles, and flash loans.


How does lending work without a bank?

On-chain lending replaces the bank with a smart contract and a shared pool of deposited crypto, so borrowing and repaying happen automatically by code. Lenders deposit assets into a pool and earn interest; borrowers take loans from that same pool against collateral they lock up. No loan officer approves you, and no credit score is checked, because the collateral does the trusting.

The model is simpler than a bank's, and that simplicity is the point. On a protocol like Aave, each asset has one big liquidity pool rather than matching individual lenders to individual borrowers (source: Aave documentation). Depositors add funds and receive interest that the pool pays from what borrowers owe. Borrowers draw from the pool instantly, as long as they have posted enough collateral. The whole arrangement runs on public smart contracts, so anyone can verify the rules and the balances.

Two mechanics are worth knowing because they shape what you earn and pay. First, interest rates are not set by a person; they float with utilization, the share of the pool currently borrowed. When lots of the pool is lent out, rates rise to attract deposits and cool borrowing; when the pool is mostly idle, rates fall. Second, when you deposit, you receive a token that represents your share, often called an "aToken" or similar, which quietly grows in value as interest accrues; borrowers get a matching debt token tracking what they owe. These receipt tokens are how the protocol keeps score without a ledger in any one company's database.

This guide stays on the mechanics, not the returns. How deposit yields fit an investment plan is a separate topic our guide on DeFi yield for investors covers. From Blofin's operational perspective, the most common confusion we see is users treating an on-chain loan like a bank loan with a friendly grace period. It is not. A price drop can trigger an automatic, instant liquidation with no phone call and no chance to explain, which is exactly why the collateral rules below matter so much.


Why must you post more than you borrow?

You must post more collateral than you borrow because the loan has no other protection, so the extra value is the safety buffer. This is called overcollateralization, and it is the foundation of on-chain lending. Crypto prices swing hard, so the system insists on a cushion to stay solvent even if your collateral loses value.

The rule each asset carries is its loan-to-value ratio, or LTV, and a worked example makes it concrete. Suppose an asset has an LTV of 75 percent, meaning you can borrow up to 75 cents for every dollar you lock up (source: Ledger Academy: what is Aave). Deposit 1,000 dollars of that asset as collateral, and the most you can borrow is 750 dollars. Borrow the full 750 and you are at the edge. Borrow 400 and you have a comfortable margin. The gap between what you posted and what you took is the buffer that keeps the pool safe if prices move against you.

Why so cautious? Because the lender, in this case the pool, cannot chase you for repayment. There is no court, no debt collector, and no identity behind most loans, so the only thing securing the loan is the collateral already locked in the contract. Posting extra collateral means one thing: the contract can always sell enough of it to cover the debt, even after a sharp drop. The trade-off for the borrower is that you tie up more than you receive. The benefit is a loan that needs no trust and approves in seconds.


What is liquidation, and how does the health factor work?

Liquidation is when the contract automatically sells part of your collateral to repay your loan because your collateral fell too close to your debt. Protocols track this with a health factor, a single number that falls as your collateral loses value or your debt grows. When it drops below the safety line, anyone can trigger a liquidation.

The health factor is the gauge to watch, and it behaves intuitively once you see it. It compares your collateral value, adjusted by each asset's liquidation threshold, against what you owe (source: Gate Learn: how Aave works). A health factor comfortably above 1 means you are safe; as it approaches 1, you are near the edge; below 1, you are liquidatable. One distinction beginners miss: the liquidation threshold is a separate, higher number than the LTV you borrowed at. The LTV caps how much you can borrow, while the liquidation threshold is the higher point where your position turns unsafe and can be seized. So an asset might let you borrow at 75 percent LTV but only liquidate you at an 80 percent threshold, and that gap is your real safety margin. The same automatic mechanism drives forced selling in margin trading, which our guide on how liquidation works in trading explains in a trading context.

Walk through the cascade. You deposit 1,000 dollars of ETH and borrow 600 dollars of a stablecoin, leaving healthy headroom. Then ETH falls 30 percent, so your collateral is now worth 700 dollars while your debt is still 600. Your health factor crosses below 1. A liquidator, often a bot, repays part of your debt, typically up to about half of it in one go, a cap known as the close factor. In return it seizes an equivalent slice of your collateral plus a bonus, often around 5 to 10 percent, as its incentive. You keep what is left, but you have paid that liquidation penalty and lost the upside on the sold collateral. There is no warning step, which is why borrowers keep a wide margin and watch their health factor like a fuel gauge.


Why do lending protocols depend on oracles?

Lending protocols depend on oracles because the contract needs the current market price of your collateral to decide whether you can be liquidated. That price lives outside the blockchain. An oracle is the service that feeds external prices on-chain. If it reports a wrong price, the contract can liquidate loans that should have been safe, or miss ones that were not.

The dependency is unavoidable, which makes it a critical risk point. A smart contract cannot natively see the price of ETH on global markets; it only knows what is written on-chain. So lending protocols rely on price oracles, most prominently decentralized networks like Chainlink, to deliver reliable, tamper-resistant prices (source: Chainlink price feeds). The protocol uses that feed to compute every health factor. When the feed is accurate, the system works; when it is wrong or manipulated, the consequences are immediate and on-chain.

This is why oracle manipulation is one of the most damaging attack types in decentralized finance. If an attacker can briefly distort the price an oracle reports, they can trick a lending contract into letting them borrow too much. They can also force healthy positions into liquidation, then walk away with the difference. Reputable protocols defend against this with multiple price sources and time-averaging, but the risk never fully disappears. For a beginner, the takeaway is that an on-chain loan is only as safe as the price feed underneath it, a dependency invisible from the friendly app interface.


What is a flash loan, and why does it matter?

A flash loan is an uncollateralized loan that must be borrowed and repaid within a single transaction, or the whole thing is cancelled as if it never happened. Because Ethereum transactions are all-or-nothing, the protocol can safely lend huge sums with no collateral. If you do not repay by the end of the transaction, the loan is automatically reversed. It is a tool unique to programmable money.

The atomic nature is the whole trick, and an example shows the legitimate use. Imagine you spot that an asset is cheaper on one exchange than another. With a flash loan, you borrow a large sum and buy low on the first venue. You sell high on the second, repay the loan plus a small fee, and keep the profit, all inside one transaction (source: Ethereum.org DeFi overview). If any step fails, for instance the price moved and you cannot repay, the entire transaction reverts and no money changes hands. Developers also use flash loans to refinance positions or perform complex liquidations without putting up capital.

The same power is a notorious attack vector, which is why flash loans appear in so many exploit reports. An attacker can borrow enormous capital for free. They use it to manipulate a thinly traded market or an oracle within that single transaction, drain a vulnerable protocol, and repay the loan, profiting from the chaos. The flash loan itself is not the flaw; it simply removes the capital barrier that once limited such attacks, so any protocol with a weak economic design becomes reachable. It is the clearest example of how on-chain mechanics differ from anything in traditional finance.


Frequently asked questions

Why do I have to over-collateralize to borrow?

Because the loan has no other backing, the extra collateral is the only thing protecting the lender. There is no credit check, no identity, and no way to pursue you for repayment, so the contract insists you lock up more value than you borrow. That buffer lets it sell your collateral to cover the debt even after a sharp price drop. The cost to you is capital efficiency, since you tie up more than you receive, but in exchange you get a trustless loan that approves in seconds.

What actually happens when I get liquidated?

When your health factor falls below the safety line, a liquidator repays part of your debt. They take an equivalent amount of your collateral, plus a bonus as their reward. The process is automatic and instant, with no warning or grace period. You keep whatever collateral remains after the debt and penalty are covered, but you lose the liquidated portion and the bonus paid to the liquidator. This is why borrowers maintain a wide margin rather than borrowing the maximum the protocol allows.

Can I lose all of my collateral?

Usually you lose a portion, not everything, but in extreme conditions losses can be severe. A normal liquidation sells just enough collateral to restore safety, plus the liquidator's bonus, leaving you the rest. However, during violent price crashes or network congestion, liquidations can happen at bad prices or repeatedly, eroding much more of your position. If collateral falls faster than liquidators can act, a position can even end up underwater. Keeping a large safety margin is the main defense against these tail outcomes.

What is a health factor in simple terms?

A health factor is a single number that tells you how close your loan is to being liquidated. It rises when your collateral is worth much more than your debt, and falls as collateral loses value or debt grows. Above 1 you are safe; at 1 you are on the edge; below 1 you can be liquidated. Think of it as a fuel gauge for your loan, where running near empty risks an automatic, penalty-bearing liquidation that you cannot stop once it triggers.

Why are flash loans considered risky?

Flash loans are risky for protocols, not usually for ordinary users, because they let an attacker command enormous capital with no collateral inside one transaction. That removes the money barrier that once limited market-manipulation and oracle attacks, so a protocol with a weak economic design can be drained in a single block. The flash loan itself is a neutral tool used for legitimate arbitrage and refinancing. The danger is what a clever attacker can do with temporary, unlimited capital against a vulnerable contract.

Is on-chain lending safe to use?

It carries real and distinct risks, so "safe" depends on care. The main risks are liquidation from price moves, smart-contract bugs, and oracle failures that misprice your collateral. Unlike a bank, there is no insurance, no reversal, and no human to appeal to. Used cautiously, with a wide collateral margin and well-established protocols, on-chain lending works as designed for millions of users. But it demands active risk management, and the deposit-side risks are covered further in our guide on DeFi yield risks.

 


Researched and written by the Blofin Academy editorial team with AI-assisted drafting. Primary sources include the Aave protocol documentation, the Ethereum.org decentralized finance overview, and the Chainlink price-feed documentation. All facts independently verified against cited documentation current as of June 2026.

 

This article is for informational purposes only and does not constitute financial advice, investment guidance, or a recommendation to buy, sell, or hold any digital asset. On-chain lending carries significant risk, including automatic liquidation, smart-contract failure, and oracle error, any of which can cause partial or total loss of collateral. Cryptocurrency markets involve significant risk and you should conduct your own research and consult qualified professionals before making decisions.