---
title: "Flash Loans"
url: "https://radix.wiki/contents/tech/core-concepts/flash-loans"
updated: 2026-12-05
license: CC-BY-4.0
license_url: "https://creativecommons.org/licenses/by/4.0/"
version: "1.0.0"
---

# Flash Loans

|  |  |
| --- | --- |
| **Type** | Uncollateralised loan repaid within one transaction |
| **Proposed by** | Marble, 2018 |
| **First offered** | Aave, January 2020 |
| **Enforced by** | Transaction atomicity |
| **On Radix** | Transient resources; offered by [Ociswap](/ecosystem/ociswap) and [Weft Finance](/ecosystem/weft-finance) |
| **Related** | [Atomic composability](/contents/tech/core-concepts/atomic-composability) · [Decentralized exchange (DEX)](/contents/tech/core-concepts/decentralized-exchange-dex) · [DeFi](/contents/tech/core-concepts/decentralized-finance-defi) |

## 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](https://www.bankofcanada.ca/wp-content/uploads/2025/03/sdp2025-6.pdf), 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](/contents/tech/core-concepts/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](/contents/tech/core-concepts/decentralized-exchange-dex) 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](https://aave.com/docs/aave-v3/guides/flash-loans) 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](https://decrypt.co/37038/defi-flash-loans-skyrocket-100-million-per-day) under the name flash lending. [Aave](https://en.wikipedia.org/wiki/Aave), a lending protocol relaunched that month from ETHLend, published its first contracts with flash loans on [8 January 2020](https://aave.com/docs/resources/changelog), 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](https://arxiv.org/abs/2003.03810), and found returns above 500,000% on what the attackers put in.

| Date | Protocol | Lost | How the flash loan was used |
| --- | --- | --- | --- |
| February 2020 | bZx | [$298,000 and $645,000](https://rekt.news/bzx-rekt/) | Moved the prices bZx used for margin trades and loans, in two attacks |
| 26 October 2020 | Harvest Finance | [$33.8m](https://rekt.news/harvest-finance-rekt/) | A $50m loan moved prices in the Curve pool its vaults valued deposits from |
| 20 May 2021 | PancakeBunny | [$45m](https://rekt.news/pancakebunny-rekt/) | Eight loans skewed the pool price used to mint $BUNNY rewards |
| 27 October 2021 | Cream Finance | [over $130m](https://www.theblock.co/post/122241/ethereum-defi-protocol-cream-finance-hacked-for-115-million) | Loans of 500m $DAI and $2bn of $ETH [inflated the price](https://rekt.news/cream-rekt-2/) of a vault token used as collateral |
| April 2022 | Beanstalk | [about $181m](https://rekt.news/beanstalk-rekt/) | Borrowed tokens bought enough votes to pass a governance proposal that paid out the treasury |
| 13 March 2023 | Euler Finance | [$197m](https://rekt.news/euler-rekt/) | Borrowed funds and a flaw in its donation function; Euler [recovered the funds](https://www.coindesk.com/business/2023/04/03/euler-says-all-recoverable-funds-stolen-in-200m-hack-have-been-returned) 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](https://docs.radixdlt.com/docs/resource-behaviors) 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](https://github.com/radixdlt/scrypto-examples/tree/main/defi/basic-flash-loan) works this way, with a 0.1% fee.

The lender never calls the borrower's code. The borrower's [transaction manifest](/contents/tech/core-protocols/transaction-manifests) lists every step, the borrowing, the trades and the repayment, and the [Radix Engine](/contents/tech/core-protocols/radix-engine) refuses to finish a transaction that still holds an unburnt receipt.

[Ociswap](/ecosystem/ociswap) offers flash loans on its [Pool V2](https://docs.ociswap.com/ociswap-dex/liquidity-pools/pool-v2) and [Precision Pool V2](https://docs.ociswap.com/ociswap-dex/liquidity-pools/precision-pool-v2) pools, and [Weft Finance](/ecosystem/weft-finance) on [all its lending pools](https://weft-docs-v2.pages.dev/overview/extra). [Root Finance](/ecosystem/root-finance) had them as well; its [2024 audit by Triwei](https://web.archive.org/web/20260528021115/https://triwei.io/reports/root-finance-report.pdf) 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](/contents/history/ociswap-flex-pool-exploit-2026) and [DEX pool drain, November 2026](/contents/history/dex-pool-drain-november-2026) cover both.

## External Links

- [Jack Mandin (2025). Flash Loans – Bank of Canada Staff Discussion Paper 2025-6](https://www.bankofcanada.ca/wp-content/uploads/2025/03/sdp2025-6.pdf)
- [Qin, Zhou, Livshits, Gervais. Attacking the DeFi Ecosystem with Flash Loans for Fun and Profit](https://arxiv.org/abs/2003.03810)
- [Flash loans – Aave documentation](https://aave.com/docs/aave-v3/guides/flash-loans)
- [Basic flash loan – Scrypto examples](https://github.com/radixdlt/scrypto-examples/tree/main/defi/basic-flash-loan)
- [What is a flash loan? – Radix blog](https://www.radixdlt.com/blog/what-is-a-flash-loan)
