What is a Flash Loan?
A flash loan is a type of DeFi loan that requires no collateral — as long as you repay it within the same transaction. If you don’t repay (plus fees), the entire transaction reverts as if it never happened.
This is possible because blockchain transactions are atomic: either everything succeeds, or nothing does. The lender’s smart contract checks repayment at the end of the transaction. If the check fails, the whole transaction is rolled back.
Flash loans are unique to blockchain — they cannot exist in traditional finance. They’ve become powerful tools for arbitrage, liquidations, and debt refinancing.
How Flash Loans Work
Step by Step
- You call the flash loan contract, requesting to borrow $10M USDC
- The contract sends $10M USDC to your smart contract
- Your contract does something with the money (arbitrage, swap, etc.)
- Your contract sends $10M + 0.09% fee back to the lender
- The lender verifies repayment. If successful, the transaction completes.
If step 4 fails (you can’t repay), steps 1-3 are erased. The only cost is the gas fee for the failed transaction.
Key Properties
- Zero collateral: You don’t need to put up any assets
- Zero risk for lender: The atomic nature guarantees repayment
- Instant: Borrowed and repaid in the same block (~12 seconds on Ethereum)
- Fee: Typically 0.05-0.09% of the borrowed amount (Aave charges 0.05%)
- Anyone can use them: But you need to write a smart contract to interact with them
Legitimate Use Cases
1. Arbitrage
The most common use. If a token is priced differently on two DEXs:
1. Flash loan 1,000 ETH from Aave
2. Buy TOKEN on Uniswap at $10
3. Sell TOKEN on SushiSwap at $10.50
4. Repay 1,000 ETH + 0.5 ETH fee
5. Profit: ~499.5 ETH
Before flash loans, arbitrage required having capital on hand. Now anyone with coding skills can execute large arbitrage trades with zero upfront capital.
2. Liquidations
When a borrower’s position on a lending protocol becomes undercollateralized, anyone can liquidate it. Flash loans enable liquidation without capital:
1. Flash loan USDC to repay the borrower's debt
2. Receive the borrower's collateral (at a discount)
3. Sell collateral for USDC
4. Repay flash loan + fee
5. Keep the liquidation bonus
3. Collateral Swap
Refinance a position without closing it:
1. Flash loan to repay your existing debt
2. Withdraw your collateral
3. Swap collateral for a different token
4. Deposit new token as collateral
5. Borrow against it to repay the flash loan
This saves gas compared to doing each step separately.
4. Self-Liquidation
If your collateral is about to be liquidated (which incurs a penalty), you can use a flash loan to self-liquidate at better terms.
Flash Loan Attacks
Flash loans have been used in some of the biggest DeFi hacks:
| Attack | Loss | How |
|---|---|---|
| bZx (2020) | $350K | Flash loan to manipulate oracle price, profit from the discrepancy |
| Harvest Finance (2020) | $24M | Flash loan to manipulate Curve pool price, drain Harvest |
| Cream Finance (2021) | $130M | Flash loan to inflate token price, over-borrow against it |
| Beanstalk (2022) | $182M | Flash loan to buy enough governance tokens to pass a malicious proposal |
How Flash Loan Attacks Work
Most attacks follow a similar pattern:
- Flash loan a massive amount of capital to manipulate market prices
- Exploit a dependency — usually an oracle that uses spot prices from a single DEX pool
- Profit from the price discrepancy — e.g., use the manipulated price to borrow more than the collateral is worth
- Repay the flash loan and keep the profit
The root cause is never the flash loan itself — it’s protocols that rely on manipulable price oracles. Using TWAP (Time-Weighted Average Price) or Chainlink price feeds prevents these attacks.
Flash Loan Providers
| Protocol | Fee | Max Size | Chains |
|---|---|---|---|
| Aave V3 | 0.05% | Limited by pool liquidity | Ethereum, Arbitrum, Optimism, Polygon |
| dYdX | Free | Varies | Ethereum (legacy) |
| Balancer | 0% | Limited by pool | Ethereum, Polygon, Arbitrum |
| Uniswap V3 (flash) | Varies | Limited by pool | Multi-chain |
Frequently Asked Questions
Q: Can I get a flash loan as a regular user? A: Not directly — flash loans require deploying a smart contract. However, tools like DeFi Saver and Furucombo offer no-code interfaces for common flash loan strategies.
Q: Are flash loans illegal? A: Flash loans themselves are neutral tools. Arbitrage and liquidation are legitimate. However, using flash loans to exploit vulnerabilities can be considered hacking (and has led to FBI investigations).
Q: What happens if I can’t repay? A: The transaction reverts. You only lose the gas fee you paid to submit the transaction (a few dollars on L2, $5-30 on Ethereum mainnet).