Flash loans: what they are, what they are used for, and the risk to lenders
A flash loan is a DeFi loan with no collateral that must be borrowed and repaid within a single blockchain transaction; if it is not repaid by the end of that transaction, the whole transaction is reversed as if it never happened. It is a tool for developers and bots doing arbitrage, collateral swaps and liquidations, not a way for a person to borrow money, and it has supplied the capital in many attacks on DeFi protocols.
作者:Dean Fankhauser · 最后审核:2026年11月30日
How a flash loan works
An ordinary crypto loan needs collateral because the lender cannot be sure you will pay it back. A flash loan removes that doubt with code. Everything happens inside one transaction: the protocol sends you the coins, your smart contract does something with them, and the coins plus a fee must be back before the transaction ends. Aave’s documentation puts it simply: if the amount owed is not there, the “transaction reverts” (Aave). The lender never takes a credit risk, because a loan that is not repaid never happened.
- Your contract asks a pool, such as Aave or Balancer, for the coins.
- The pool sends them and calls your contract back.
- Your contract runs its steps: trades, repayments, swaps.
- Your contract returns the loan plus any fee to the pool.
- If step 4 fails, every step is undone and you lose only the network fee you paid to send the transaction.
The idea is usually credited to Marble Protocol in 2018 (CoinDesk), and Aave made it widely used. Flash loans are written for developers: Morpho describes them as “primarily meant for developers and advanced users” (Morpho). There is no app where you type in an amount and receive a flash loan into your wallet. To borrow for days or months, you need a collateralised loan; see how crypto loans work.
Where flash loans come from, and what they cost
| Provider | What it offers | Fee, as documented |
|---|---|---|
| Aave v3 | flashLoan (several assets at once) and flashLoanSimple (one asset, cheaper to run) | “Set to 0.05% at deployment and can be changed by governance vote”; waived for approved borrowers (Aave) |
| Balancer v2 | Flash loans from its shared vault | “Currently there are 0 fees for flash loans” (Balancer) |
| Uniswap v2 | Flash swaps: take tokens out of a pool and pay for them at the end of the transaction | Return the tokens plus “a small fee” (Uniswap) |
| Morpho | Flash loans from its lending markets | No fee stated on its concept page (Morpho) |
| Sky (formerly Maker) | Flash Mint: mint Dai up to a limit set by governance, then burn it in the same transaction | Set by governance; not stated on the page (Sky) |
The fee is not the main cost. A flash loan bundles many steps into one transaction, so the network fee is high, and the trade only works if the opportunity is still there when the transaction is included in a block. Bots compete for the same opportunities, which is why profitable flash-loan arbitrage is rare for anyone without fast, specialised infrastructure.
What flash loans are used for
Most flash-loan use is routine. Aave’s documentation lists arbitrage “without holding the principal needed for the trade” and liquidating loans “without holding the debt amount”, and Aave uses flash loans in its own features (Aave).
- Arbitrage. Buy a token where it is cheap and sell it where it is dear, all in one transaction. Chainlink calls this the most common use (Chainlink).
- Liquidations. Liquidators repay an unhealthy borrower’s debt with borrowed coins, receive the collateral at a discount, sell some of it and repay the flash loan. This keeps lending pools solvent, which protects lenders.
- Collateral swaps. Change a loan’s collateral, say from ETH to wBTC, without first repaying the loan.
- Refinancing and closing positions. Move a loan from one protocol to another, or unwind a leveraged position, in one step. DeFi Saver’s recipe tool lists these uses and the flash-loan sources it draws on (DeFi Saver).
Tools such as DeFi Saver let people use these features without writing code. You are still using a smart contract, so the risks of the protocols involved apply.
Flash loan attacks
Flash loans let anyone command millions for a few seconds. That matters when a protocol has a flaw that only pays off at scale, such as a price it reads from a single pool that can be pushed around, or a bug in its own accounting. The flash loan is rarely the flaw itself; it supplies the money to exploit one. Chainalysis counted $403.2 million lost in 41 oracle manipulation attacks in 2022 and noted that the funds are “often sourced through a flash loan” (Chainalysis). Researchers describing flash loans in 2020 analysed two early attacks with returns “beyond 500k%” (Qin et al.).
| Date | Protocol | Lost | What went wrong |
|---|---|---|---|
| Feb 2020 | bZx | About $350,000 | The attacker borrowed 10,000 ETH and repaid it in the same transaction to exploit a logic bug (The Block) |
| May 2021 | PancakeBunny | $45 million | A pricing bug, exploited with flash loans (The Block) |
| Oct 2021 | Cream Finance | $115 million to $130 million | A large flash loan used to manipulate the value of collateral (The Block) |
| Apr 2022 | Beanstalk | $182 million | Governance attack: a flash loan from Aave bought enough votes to pass a malicious proposal (CoinDesk) |
| Mar 2023 | Euler Finance | About $197 million, all recovered | A function “lacked a health check” (Euler); reported as a flash-loan attack (The Block) |
| Sep 2025 | Bunni | $8.4 million | A rounding error, exploited with a 3 million USDT flash loan (The Block) |
The defence is better design rather than banning flash loans. Chainlink recommends that developers “avoid manipulatable DEX spot prices” and use price feeds drawn from the wider market (Chainlink). Euler’s own account of its exploit traces it to a patch for an earlier bug that “created the vector” for the attack, which is why repeated audits of every change matter.
What this means if you lend into DeFi
You will probably never take a flash loan. But if you deposit into a DeFi pool, flash loans change the risk you carry. A flaw that would once have needed a well-funded attacker can now be exploited by anyone who can write the code. Before you lend into a protocol, look at:
- Its price feeds. Does it use a market-wide oracle, or the price in a single pool?
- Its audits and age. How many audits, of which version, and how long has the code held real money?
- Its record. Has it been exploited, and were lenders made whole?
- Bad-debt backstops. Does it hold a fund that absorbs losses before lenders do? Is crypto insured? explains what those funds and DeFi cover do.
Our risk methodology scores DeFi platforms on these points, and CeFi vs DeFi sets out how the risks differ from lending through a company.
Bitcompare 实时利率
Best standard USDC DeFi lending rate on 2026年12月1日: 5.89% APY on Fluid, among 7 providers we track.
| # | 平台 | 标准利率 | As APY |
|---|---|---|---|
| 1 | Fluid | 5.89% APY | 5.89% APY |
| 2 | Maple | 5.25% APY | 5.25% APY |
| 3 | Morpho | 4.5% APY | 4.5% APY |
| 4 | Spark | 4.45% APY | 4.45% APY |
| 5 | Kamino | 4.2% APY | 4.2% APY |
- Median standard rate: 4.45% APY (APRs converted with daily compounding) across 7 platforms we track.
| # | 平台 | 标准利率 | As APY |
|---|---|---|---|
| 1 | Euler Finance | 1.85% APY | 1.85% APY |
| 2 | Fluid | 1.68% | — |
| 3 | Compound V3 | 1.58% APR | 1.59% APY |
| 4 | Gearbox | 1.49% APR | 1.5% APY |
| 5 | Aave V3 | 1.26% APR | 1.27% APY |
- 共有 10 家平台公布标准利率。由于计算口径不同(APR 或 APY),此处不显示中位数。
仅显示标准利率,与我们利率表采用相同规则:即无需促销、会员等级或锁定期即可获得的利率。利率经常变化,请在决定前查看完整对比。
利率由各平台设定,经常变动且不作保证。标有"Sponsored"的行是付费展示位。不构成财务建议。 我们如何盈利 →
常见问题
What is a flash loan in crypto?
A loan from a DeFi protocol that is borrowed and repaid within one blockchain transaction, with no collateral. If it is not repaid by the end of the transaction, the whole transaction is reversed.
Why don’t flash loans need collateral?
Because the lender cannot lose. Repayment is checked before the transaction finishes, and if the coins are not back, the blockchain undoes every step, including the loan.
Can I take out a flash loan to buy something?
No. The coins must come back within the same transaction, so you cannot keep them or spend them on anything that is not repaid in that transaction. To borrow for longer you need a collateralised crypto loan.
How much does a flash loan cost?
It depends on the provider and on governance votes. Aave’s documentation says its fee was 0.05% when deployed and can be changed by governance vote. Balancer v2’s documentation says it charges no fee. You also pay the network fee for what is usually a large transaction.
Are flash loans legal?
Using a flash loan for arbitrage or liquidations is ordinary DeFi activity. We found no regulator guidance specific to flash loans. Using one to exploit a protocol has led to criminal charges, depending on the facts.
Can you make money with flash loans?
Bots do, through arbitrage and liquidations, but they compete with each other for the same opportunities. For most people, a failed attempt costs the network fee and a successful one is hard to find.
What is a flash loan attack?
An exploit where an attacker uses borrowed millions to take advantage of a flaw in a protocol, such as a manipulable price feed or an accounting bug, then repays the loan and keeps the profit, all in one transaction.
Are flash loans a risk to my deposits?
Indirectly. A flash loan cannot take your deposit by itself, but it gives attackers the capital to exploit any flaw in the protocol you lent to. Check how a protocol prices collateral, how it has been audited and whether it has a bad-debt fund.
风险提示
通过加密货币(包括稳定币)赚取收益不是银行存款。它不受美国 FDIC 或英国 FSCS 等存款保险保障,你可能损失部分或全部资金。本指南仅为一般信息,不构成财务建议。
比较当前利率
来源
- Flash loans (Aave v3 guide) — Aave
- The DeFi flash loan attack that changed everything (27 February 2020) — CoinDesk
- Flash loans — Balancer (v2 docs)
- Flash swaps (v2) — Uniswap
- Flash loans — Morpho
- Dai Flash Mint — Sky
- Flash loans explained (updated 24 May 2023) — Chainlink
- What are flash loans? (Recipe Creator) — DeFi Saver
- Oracle manipulation attacks are rising (7 March 2023) — Chainalysis
- Attacking the DeFi ecosystem with flash loans for fun and profit — Qin, Zhou, Livshits and Gervais (arXiv)
- bZx exploit: how an attacker made $350k in a single transaction (17 February 2020) — The Block
- PancakeBunny exploited, $45 million lost (20 May 2021) — The Block
- Cream Finance hacked (27 October 2021) — The Block
- Attacker drains $182M from Beanstalk (17 April 2022) — CoinDesk
- War and peace: behind the scenes of Euler’s exploit recovery (10 January 2024) — Euler Finance
- Euler Finance flash loan attacked for an estimated $197 million (13 March 2023) — The Block
- Bunni exploited through a rounding error (4 September 2025) — The Block