A flash loan is a loan that must be repaid in the same transaction it was issued. Because Ethereum transactions are atomic — either all operations succeed or the whole transaction reverts — a lender can safely give you millions of dollars with zero collateral, knowing that if you don't repay by the end of the transaction, the whole transaction reverts and the loan never happened. This is a fundamentally new financial primitive that has no analog in traditional finance, and it has reshaped what's possible (and what's dangerous) in DeFi.
Understanding flash loans is required literacy for evaluating DeFi risk. Nearly every major DeFi exploit since 2020 has used flash loans as a component.
The mechanism
A flash loan works like this:
1. Your contract calls the lender's flashLoan function, asking for X tokens. 2. The lender transfers X tokens to your contract. 3. The lender calls back into your contract's executeOperation function. 4. Your contract does whatever it wants with the X tokens — arbitrage, liquidation, oracle manipulation, whatever. 5. Before returning, your contract must transfer X plus a small fee back to the lender. 6. If your contract fails to repay, the whole transaction reverts. The lender loses nothing. 7. If your contract succeeds, everyone is happy. You keep whatever profit you made minus the fee.
The lender's risk is zero: they get their tokens back guaranteed, or the whole thing never happened.
Who provides flash loans
The main flash loan providers in 2026:
**AAVE**: pioneered the primitive. Offers flash loans on all supported assets. Fee: 0.05% of the loan amount.
**Uniswap V3**: implicit flash loans via the "flash" callback. Fee: 0.30% (matches pool fee).
**Balancer**: offers flash loans on pool tokens. Fee: 0% (yes, zero — Balancer subsidizes to attract volume).
**Morpho, Compound V3**: flash loans on supported assets. Fees vary.
**dYdX (Solo protocol)**: historical provider, still active but less common than AAVE.
Different providers offer different assets and different fees. Aggregators can pull flash loans from multiple sources within a single transaction to source large amounts.
Legitimate use cases
Flash loans are not inherently malicious. Legitimate uses:
**Arbitrage**: spot a price difference between two DEXs. Flash loan a large amount, execute both trades, pocket the spread, repay. All in one transaction with zero capital of your own.
**Liquidations**: liquidate an undercollateralized position on AAVE. You need to repay the debt in the borrowed asset, then receive the collateral at a discount. Flash loan the debt amount, liquidate, sell the collateral, repay the flash loan, keep the profit.
**Collateral swaps**: change your Maker CDP from ETH collateral to WBTC collateral. Flash loan enough DAI to close the ETH position, close it, receive ETH, swap to WBTC, open a new CDP, repay the flash loan. All atomic.
**Debt refinancing**: pay off your AAVE loan with a flash loan, close the position, open a new one at a different protocol, repay the flash loan.
Any operation that would normally require the user to hold the full asset value can potentially be flash-loaned instead.
The dark side: exploits
Flash loans didn't create the exploit patterns they enable, but they lowered the capital barrier dramatically.
Without flash loans, exploiting a protocol that requires temporary large capital would be limited to entities that actually have millions of dollars sitting available. With flash loans, any competent developer with a laptop can access $100M+ of capital for the duration of one transaction.
The typical exploit uses flash loans as the enabling capital for:
- **Oracle manipulation**: flash loan to move a DEX pool's price, exploit a protocol using that pool as an oracle, repay.
- **Liquidity manipulation**: flash loan to imbalance a pool, exploit downstream effects, restore.
- **Governance attacks**: flash loan governance tokens, vote in a malicious proposal, unvote.
- **Reserve attacks**: flash loan into a protocol to trigger some threshold-based logic (e.g., emergency withdrawal, fee changes), then reverse.
Every major DeFi exploit in the last five years — bZx, Cream, Fei, Alpha Homora, Mango, Euler — used flash loans as at least one component.
Defenses
Protocols defend against flash-loan-enabled attacks by:
**Time-weighted decisions**: don't make decisions based on current state; use averages over some window. TWAP oracles are the canonical example.
**Governance timelocks**: any governance action has a delay before it takes effect. A flash-loaned governance attack can propose something but can't execute it — by the time the delay ends, the attacker has already returned the tokens.
**Snapshot-based voting**: voting weight is snapshotted at a specific block, and only tokens held at that block count. Flash-loaned tokens are held at the "current" block, not the snapshot block, so they don't get to vote.
**Reentrancy protection**: standard defense against reentrancy also protects against flash-loan-enabled reentrancy.
**Multi-block finality**: some protocols enforce that state-changing operations require multiple blocks to complete, breaking any flash-loan-based attack that requires atomicity.
The regulatory awkwardness
Flash loans exist because Ethereum permits arbitrary computation within a single transaction. There's no way to prevent them without breaking the general programmability of smart contracts.
For regulators, this creates awkwardness: a $100M "loan" that doesn't require collateral or credit checks is normally considered highly suspect. But in DeFi, it's just how the system works. Legal frameworks that assume loans have real terms and risk don't fit flash loans.
The Mango exploit case established that using flash loans to manipulate markets can be prosecuted as fraud, even though the loans themselves are unremarkable transactions. This is an evolving area of law.
Practical uses for regular users
Most DeFi users never take out flash loans directly. But you can benefit indirectly:
**Aggregator quotes**: 1inch, Cow Swap, and Paraswap often use flash loans behind the scenes to give you better prices. They can source liquidity from multiple pools atomically.
**Position management tools**: Instadapp, DefiSaver, and similar tools use flash loans to enable one-click actions like "swap all my collateral from ETH to WBTC" that would otherwise require many manual steps.
**Refinancing**: some tools offer "one-click migrate my AAVE position to Compound" or similar. These use flash loans to close and reopen positions atomically.
If you use any of these tools, you're already benefiting from flash loans without needing to understand the mechanics.
Writing your own flash loan
For developers curious about implementing:
- AAVE V3's docs are the canonical starting point. You inherit from FlashLoanReceiverBase, implement executeOperation, and call the lending pool's flashLoan function.
- Uniswap V3's approach is different — you interact with the pool's flash function, which invokes your callback.
- Balancer's is similar.
The common gotcha: fee calculation. You must repay the loan amount PLUS the fee. Getting the fee math wrong is a common cause of failed flash loan transactions.
The philosophical point
Flash loans are one of the clearest examples of DeFi's "primitives compose in ways no one anticipated" property. Nobody who designed the underlying capabilities was thinking about zero-collateral loans. The primitive emerged from the interaction of atomic transactions plus lending pools plus reentrancy.
This composability is DeFi's superpower and its curse. Every new primitive combines with existing ones in ways that create new opportunities — for arbitrage, for exploits, for novel use cases nobody has thought of yet.
Flash loans specifically are a permanent feature of the DeFi landscape. Understanding them is part of understanding the risk model of every protocol you use.



