What is a flash loan?

A flash loan is a loan with no collateral that is borrowed and repaid within one transaction. If the borrower has not returned the money and the fee by the time the transaction ends, the whole transaction fails and every step in it is undone, the loan included, so the lender's funds are never at risk. A Bank of Canada staff paper describes it as an uncollateralized loan with zero maturity, zero default risk and, in some cases, zero limit to the size of the loan, and counted more than $2tn of flash lending across 10m loans on Ethereum-compatible chains in 2024.

A lender normally asks for collateral because a borrower might not repay. A blockchain transaction takes effect whole or not at all, so a lender can instead make repayment a condition of the transaction itself, and the network refuses any transaction that ends without it. Atomic composability is the same guarantee stretched across several applications, and it is what lets the borrower use the money in other applications between borrowing and repaying.

How does a flash loan work?

The borrower writes one transaction in three parts: borrow from a lending pool; use the money, for example by buying a token on one exchange and selling it on another where the price is higher; and repay the loan with its fee. On Aave, the pool sends the tokens to the borrower's contract, calls it, and pulls back the amount plus the fee when the call returns, reverting if it cannot. Aave's version 3 sets the fee at 0.05%, which its governance can change.

The Bank of Canada paper sorts the flash loans it found on chain by use. Three are what lenders intended: arbitrage between exchanges; liquidating undercollateralised loans on lending platforms, which pays a reward to whoever does it; and swapping a loan's collateral or debt for another without first finding the money to close it. Two are not: wash trading, which inflates a token's apparent volume, and exploits.

Where did flash loans come from?

Marble, an open-source bank on Ethereum, introduced the idea in 2018 under the name flash lending. Aave, a lending protocol relaunched that month from ETHLend, published its first contracts with flash loans on 8 January 2020, and the first loan followed on 17 January: $33 of $DAI, apparently for arbitrage, according to the Bank of Canada paper. dYdX offered flash loans without a fee and Uniswap version 2 added flash swaps within months, and Aave's version 2 in December 2020 let one call borrow several tokens at once.

Why are flash loans used in attacks?

A flash loan gives anyone, for one transaction, as much money as a lending pool holds. A protocol that reads a token's price from a pool that one large trade can move, or that counts votes from tokens bought a moment earlier, can be pushed into a state its designers did not allow for by someone with enough money, and a flash loan supplies the money to an attacker who owns none. Qin, Zhou, Livshits and Gervais studied the first two such attacks, on bZx in February 2020, in Attacking the DeFi Ecosystem with Flash Loans for Fun and Profit, and found returns above 500,000% on what the attackers put in.

DateProtocolLostHow the flash loan was used
February 2020bZx$298,000 and $645,000Moved the prices bZx used for margin trades and loans, in two attacks
26 October 2020Harvest Finance$33.8mA $50m loan moved prices in the Curve pool its vaults valued deposits from
20 May 2021PancakeBunny$45mEight loans skewed the pool price used to mint $BUNNY rewards
27 October 2021Cream Financeover $130mLoans of 500m $DAI and $2bn of $ETH inflated the price of a vault token used as collateral
April 2022Beanstalkabout $181mBorrowed tokens bought enough votes to pass a governance proposal that paid out the treasury
13 March 2023Euler Finance$197mBorrowed funds and a flaw in its donation function; Euler recovered the funds by 3 April

In each case the flaw was in the protocol that lost the money, and the flash loan paid for exploiting it.

How do flash loans work on Radix?

On Radix the lender enforces repayment with a token it hands out alongside the loan. The receipt is a transient resource, which the Radix documentation describes as a token restricted from being deposited anywhere: it must be burnt before the transaction ends, or the transaction fails with a dangling-resource error. Only the lender's component can burn the receipt, and it does so when the borrower returns the amount the receipt records. Radix's basic flash loan example works this way, with a 0.1% fee.

The lender never calls the borrower's code. The borrower's transaction manifest lists every step, the borrowing, the trades and the repayment, and the Radix Engine refuses to finish a transaction that still holds an unburnt receipt.

Ociswap offers flash loans on its Pool V2 and Precision Pool V2 pools, and Weft Finance on all its lending pools. Root Finance had them as well; its 2024 audit by Triwei found a flaw that let a borrower burn the receipt without repaying, which the audit reports as fixed.

A flash loan on Radix can still fund an attack on a protocol with a flaw of its own. The first version of Ociswap's Flex Pool lent from the same vault it priced swaps from, and on 27 October 2026 one transaction used its flash loan to take 1.14m $XRD from one pool; a drain on 14 November took about 1.16m $XRD more from 14 pools of the same version. Ociswap Flex Pool exploit and DEX pool drain, November 2026 cover both.