A flash loan is an uncollateralised loan mechanism in decentralised finance that exists entirely within a single blockchain transaction: the borrower receives an arbitrary amount of an asset, executes arbitrary on-chain operations with it, and repays the loan plus a fee within the same atomic transaction, with the entire sequence reverting if repayment fails. Because atomicity guarantees that funds never leave the lending pool without being returned, no collateral is needed; default is technically impossible since a failed repayment causes the transaction to revert as if the loan never occurred. Flash loans enable capital-efficient arbitrage, liquidation, collateral swaps, and self-liquidation operations that would otherwise require significant upfront capital.

Content

  • Flash loans were first introduced by Marble Protocol in 2018 and popularised by Aave in 2020 as a formal DeFi primitive. The concept relies on a property unique to smart contract platforms: within a single transaction, a contract can call out to other contracts, receive callbacks, and enforce post-conditions atomically. Traditional finance has no equivalent because physical settlement processes are sequential and asynchronous — a borrower must receive funds before using them, and repayment occurs at a later time, creating the window for default. On a smart contract platform like Ethereum, the entire loan lifecycle executes in one block and the lender’s smart contract can verify repayment before committing the transaction state.
  • Mechanically, a flash loan transaction calls the lending pool’s flashLoan function, specifying the asset and amount. The pool transfers the requested amount to the borrower’s contract and calls a user-defined callback function. Inside this callback, the borrower’s contract can execute arbitrary on-chain logic — swapping assets across DEXes, liquidating undercollateralised positions on lending protocols, or swapping collateral types. After the callback returns, the lending pool checks that the borrowed amount plus fee has been returned; if not, the entire transaction is reverted, restoring all state to its pre-transaction values.
  • Flash loans have proven double-edged. Their legitimate uses — cross-DEX arbitrage (which improves price efficiency), self-liquidation (which allows borrowers to unwind positions without external liquidators), and collateral swaps — provide genuine economic benefits. Their illegitimate uses involve manipulating price oracles within the same transaction: a borrower takes a large flash loan, uses it to distort an asset’s price on a DEX that a lending protocol uses as its price oracle, borrows against the artificially inflated collateral value, then repays the flash loan while retaining the borrowed funds. Several major DeFi exploits in 2020–2022, including attacks on bZx, Harvest Finance, and Cream Finance, used this vector.
  • As of 2024–2025, flash loans are considered a mature DeFi primitive. Aave v3, Uniswap v3, and Balancer all support flash loan interfaces, with accumulated flash loan volume in the hundreds of billions of dollars. Oracle manipulation attacks have declined following the widespread adoption of time-weighted average price (TWAP) oracles and multi-source oracle aggregators that are resistant to single-block price manipulation. Research into cross-chain flash loans — which would extend the mechanism across bridged assets — remains active, with atomicity guarantees across heterogeneous chains representing the principal unresolved challenge.