Flash loans explained: how one-transaction DeFi loans work
Flash loans explained: how uncollateralized DeFi loans work inside one transaction, fees from 0% to 0.3%, arbitrage, liquidations and their role in attacks.

Contents
Flash loans, explained in one sentence: they are uncollateralized DeFi loans that are borrowed and repaid inside a single blockchain transaction. If the principal plus fee is not back by the end of that transaction, the network reverts everything as if it never happened. The lender carries no credit risk, so the borrower needs no collateral and no identity check. Arbitrage and liquidation bots rely on this every day. So do attackers, who use the loan to hold capital they don't own for a few seconds.
What is a flash loan?
The ERC-3156 standard defines a flash loan as a transaction in which a lender contract hands assets to a borrower contract on the condition that they are returned, plus an optional fee, before the transaction ends. Traditional finance has no equivalent. Aave's documentation says as much and warns that using flash loans requires understanding how state is managed within a block.
The whole design rests on atomicity. A transaction on Ethereum either completes in full or does not happen at all. As ethereum.org puts it, if the loan can't be paid back, the transaction reverts as if nothing ever happened.
Three things follow:
- No collateral is needed, because the lender has nothing to insure against.
- Loan size is capped by the protocol's idle liquidity, not by the borrower's wealth.
- Only a program can borrow. Every step has to be written into a smart contract in advance, so you cannot take a flash loan from an ordinary wallet.
For background on lending protocols and liquidity pools, see What is DeFi.
How flash loans work, step by step
Aave V3 documents the flow like this:
- The borrower's contract calls the pool and requests an amount.
- After sanity checks, the pool transfers the assets and calls
executeOperationon the borrower's contract. - The contract does whatever it was built to do: swap on an exchange, repay someone's debt, move collateral.
- The contract approves the pool to pull back the loan amount plus the fee.
- The pool collects. If the funds fall short, the entire transaction reverts.
A failed attempt costs the borrower gas only, because a reverted transaction still takes up block space.
Here is the arithmetic. A bot spots a token trading 0.3% cheaper on one exchange than on another. It borrows 1,000,000 USDC, buys on the cheap venue, sells on the expensive one and returns 1,000,500 USDC, which is the loan plus Aave's 0.05% fee. That leaves 2,500 USDC before swap fees, slippage and gas. If the gap closes while the transaction is waiting, the trade reverts and the bot loses only gas.
Flash loan fees and providers
Fees run from zero to 0.3%.
| Protocol | Fee | Source |
|---|---|---|
| Aave V3 | 0.05% at deployment, adjustable by governance vote | Aave docs |
| Morpho | 0% | contract code: flashFee is zero |
| Uniswap v2 (flash swap) | 0.3%, the pool's LP fee | Uniswap docs |
| Balancer V2, Sky flash mint | 0% as of November 16, 2026 | CoinPaprika guide |
Uniswap calls its version a flash swap. You can withdraw up to the full reserves of a token from a pool and, by the end of the transaction, either pay for it with the other token in the pair or return it with a fee. Uniswap v4 builds a similar idea into its bookkeeping: each operation updates an internal net balance, and tokens move only for the final difference.
Aave offers two functions. flashLoanSimple borrows a single asset and always charges the fee. flashLoan borrows several assets at once; the fee is waived for borrowers approved through the protocol's access controls, and the loan can be converted into a regular collateralized debt position instead of being repaid.
A live example: November 27, 2026
We read the current fee straight from the main Aave V3 pool on Ethereum. On November 27, 2026, FLASHLOAN_PREMIUM_TOTAL returned 5, meaning five basis points, or 0.05%. A $1 million loan costs $500 and a $100 million loan costs $50,000. That is the whole price of the capital.
How much can be borrowed depends on what sits in the protocols. As of November 27, Aave V3 held about $15.7 billion according to DefiLlama, and Morpho about $9.4 billion. Only the idle share of those deposits is available to borrow.
CoinPaprika counted who is using them. Between September 9 and October 9, 2026, Aave V3 on Ethereum processed 5,058 flash loans. About 80% of them paid no fee, and a single address accounted for 99% of the dollar volume. A typical small loan from that sample was 79,661.89 USDC on September 23, with a 39.83 USDC fee and roughly $5 in gas.
The market sets the backdrop. On November 27, bitcoin traded near $61,658 as of 3:00 AM ET, down 24.2% over 30 days. The Fear and Greed Index stood at 12, and stablecoin supply had shrunk 5.8% in a month to $283.6 billion (our data, see Pulse and Numbers). When prices drop fast, collateral in lending protocols loses value and liquidations pick up. Liquidators close those positions with borrowed money, often flash-loaned.
What flash loans are used for
Aave's documentation lists three main uses:
- Arbitrage. Closing price gaps between venues without holding the principal.
- Liquidations. A bot borrows the amount of someone's debt, repays it, receives the collateral at a discount, sells enough to repay the flash loan and keeps the rest.
- Collateral swaps and refinancing. A user switches collateral or moves a loan to another protocol in one step without unwinding the position with their own funds. Aave uses flash loans for its own liquidity switch feature.
In each case the loan replaces capital. A strategy that used to need millions in the bank now needs code and gas money. Competition is fierce, though. MEV bots chase the same opportunities, and the profit usually goes to whoever is fastest and pays the most for block position.
Flash loan attacks: what actually breaks
The loan itself doesn't hack anything. It gives an attacker temporary capital, and the money leaves through a flaw in some other protocol. Those flaws come in three kinds.
Price manipulation. The attacker borrows a large sum, pushes the price in a thin pool and uses the inflated token as collateral. bZx was hit twice this way in February 2020. The first attack borrowed 10,000 ETH and netted 1,193 ETH, and the two together cost the protocol $954,000 (Cointelegraph). In January 2026, Makina Finance lost 1,299 ETH, about $4 million. PeckShield said the attacker flash-borrowed $280 million in USDC and skewed the price the protocol used to value its assets (Decrypt). Our guide to DeFi price oracles covers the defenses.
Governance takeover. On April 17, 2022, an attacker used borrowed funds to gain more than two-thirds of the votes in Beanstalk and passed a proposal that drained it. Losses came to about $182 million, of which $76 million was the attacker's profit (CertiK). The X100 hack in October 2026 followed the same pattern.
Logic bugs. On March 13, 2023, Euler Finance lost $197 million. The attacker borrowed around $30 million in DAI from Aave and exploited a flaw in how the protocol tracked debt, then returned the funds several weeks later (Chainalysis).
These cases are becoming more common. TRM Labs counted 32 price manipulation attacks from January through August 2026, against 12 in all of 2025. They now make up roughly one in eight crypto hacks (Crypto Briefing).
Common mistakes
- "A flash loan is a hack." It is a standard protocol feature, and most of the volume is arbitrage, liquidations and position management.
- "It's free money." You can't walk away with the loan, because it has to be repaid in the same transaction. The only profit is a price gap that already exists in the market.
- "You can take one without coding." The borrower is always a contract. Builder tools make assembly easier but don't remove the risk of a logic error.
- "A failed attempt costs nothing." You still pay gas for a reverted transaction, and on a congested network that adds up.
- "A ready-made arbitrage bot will earn on its own." Code that promises flash loan profits is a common scam. The contract may simply send your deposit to its author. Don't deploy code you can't read.
- "This doesn't affect me." If you deposit into a protocol that prices assets from a single pool or lets freshly bought tokens vote, a flash loan attack can hit your funds.
FAQ
Do flash loans need collateral? No. The guarantee is the network rule that reverts the transaction if the loan isn't repaid.
How much can you borrow? As much as the protocol has idle at that moment. Morpho, for example, makes the contract's whole balance available.
Are flash loans legal? The tool is an open protocol function. Using it to take other people's funds is as unlawful as any other method, and how a specific case is treated depends on the country.
Can you flash loan bitcoin? Not on the Bitcoin network, which lacks the smart contracts this requires. You can borrow tokenized bitcoin such as WBTC on chains like Ethereum.
This is not investment advice.



Comments