Flash Loans Explained
Flash loans are one of DeFi's most innovative financial primitives: uncollateralized loans that must be borrowed and repaid within a single blockchain transaction. If the loan is not repaid by the end of the transaction, everything reverts as if nothing happened. This guide explains how flash loans work, their practical applications, and their impact on DeFi.
Table of Contents
How Flash Loans Work
Flash loans exploit the atomic nature of blockchain transactions. A transaction either succeeds entirely or fails entirely (reverts). A flash loan transaction contains three steps: borrow the funds, execute your desired operations (arbitrage, collateral swap, etc.), and repay the loan plus fee. If the repayment fails for any reason, the entire transaction reverts including the initial borrow, so the lender never loses funds. This atomicity is what makes zero-collateral lending possible.
Common Use Cases
Arbitrage is the most common use: exploiting price differences between DEXs or lending protocols. Collateral swaps let borrowers change their loan collateral without closing and reopening positions. Self-liquidation enables borrowers to efficiently unwind leveraged positions. And debt refinancing allows moving loans between protocols in a single transaction to get better rates.
Risks & Controversies
The main controversy around flash loans is their use in DeFi exploits. Attackers use flash loans to temporarily access large amounts of capital for oracle manipulation, governance attacks, and economic exploits. However, flash loans are tools, not weapons. They democratize access to capital that was previously available only to whales and institutional players. The root cause of flash loan exploits is always a vulnerability in the targeted protocol.
The Future of Flash Loans
Flash loans continue to evolve with the DeFi ecosystem. As protocols become more composable and cross-chain operations improve, flash loan use cases are expanding. Account abstraction and smart contract wallets may make flash loan-powered features more accessible to regular users, enabling sophisticated operations through simple interfaces.
Frequently Asked Questions
Can anyone use flash loans?
Flash loans require smart contract programming skills because the entire borrow-use-repay sequence must execute within a single transaction. Regular users cannot access flash loans through standard interfaces, but tools like DeFi Saver use flash loans behind the scenes to power user-friendly features.
Are flash loans free?
Most protocols charge a small fee. Aave charges 0.05% of the borrowed amount. Balancer charges no fee for flash loans. The borrower also pays gas costs for the transaction. Since flash loans are atomic, the only risk to the borrower is the gas cost of a failed transaction.
Have flash loans been used for exploits?
Yes. Flash loans have been used as a tool in many DeFi exploits, particularly for oracle manipulation attacks. However, flash loans are not malicious by themselves, they simply provide capital. The underlying vulnerabilities in exploited protocols would have been exploitable by well-capitalized attackers regardless.