DeFi & Web3Guide

Flash Loans in DeFi: How They Work & Why They Matter

This breakdown walks through how a flash loan borrows and repays inside one transaction, who offers them at what fee, and what 5,058 Aave loans on Ethereum looked like over 30 days.

Flash Loans in DeFi: How They Work & Why They Matter
Illustration: CoinPaprika

Introduction

A flash loan worth more than $600 million can cost nothing, while a $614 flash loan pays 31 cents. Both ran on Aave V3 on Ethereum between 9 September and 9 October 2026, among 5,058 loans that each began and ended inside a single transaction. The 0.05% fee at Aave is the price of that capital for one block. The feature matters in decentralized finance (DeFi) ↗ because it removes capital as a barrier. Arbitrageurs, liquidators and holders restructuring leveraged positions use it daily, and attackers point the same tool at protocols with manipulable prices or missing checks. The sections below explain the borrow-and-repay mechanism, compare what Aave, Morpho, Uniswap, Balancer and Sky charge, decode one real transaction, and separate the loan from the bug in the bZx and Euler attacks.

Key Takeaways

  • A flash loan is borrowed and repaid inside one transaction, and a failed repayment reverts everything, so no collateral is required.
  • Aave charges 0.05% and Uniswap its pool fee, while Morpho, Sky's flash mint and Balancer V2 charge 0% as of 16 November 2026.
  • Of 5,058 Aave V3 flash loans on Ethereum in 30 days, 80% paid no fee and one address made 99% of the dollar volume.
  • A decoded 23 September 2026 loan of 79,661.89 USDC paid a 39.83 USDC fee against about $5 of gas.
  • Euler's $197 million loss in 2023 came from a missing health check, not from the 30 million DAI flash loan that funded it.

How Do Flash Loans Work Inside a Single Transaction?

A flash loan is an uncollateralized loan that must be borrowed and repaid inside one blockchain transaction. The lender asks for no collateral because its code checks repayment before the transaction ends and cancels everything if the check fails (Aave Docs, 2026). Decentralized finance (DeFi) lenders built the feature because Ethereum transactions execute completely or not at all.

Borrow, Use and Repay Inside One Transaction

Aave's documentation describes the sequence in four steps. The borrower's contract asks the Aave Pool for funds. The Pool sends them and calls a function named executeOperation on the borrower. The borrower's code uses the money for any purpose, then approves the Pool to take back the principal plus a fee (Aave Docs, 2026). All four steps run in one transaction, which Aave's documentation equates with a single Ethereum block. Between the transfer and the repayment, the borrower controls funds it has not yet paid for. Ethereum records a transaction as one indivisible unit, so no other user ever sees the loan outstanding.

The Revert Rule Replaces Collateral

A conventional lender asks for collateral because repayment is uncertain. A flash loan removes the uncertainty: if the Pool is not repaid, the transaction reverts and the transfer never happened (Aave Docs, 2026). The lender therefore carries no default risk, and the borrower's downside is the gas paid for a failed attempt. An ordinary Aave loan works the other way: the borrower posts more value than is borrowed ↗ and faces liquidation once the health factor drops below 1 (Aave Help, 2026). A flash loan has no health factor because it never exists across more than one transaction. ERC-3156, the Ethereum standard for flash loans, created in November 2020, states the rule directly: after the borrower's callback, the lender's flashLoan function must take the amount plus the fee back from the receiver "or revert if this is not successful" (Ethereum Improvement Proposals, 2020).

Receiver Contracts and the Callback

Only a smart contract can repay inside the same transaction, so every borrower is code. ERC-3156 defines the borrower side as a contract with an onFlashLoan function that the lender calls with the token, amount and fee (Ethereum Improvement Proposals, 2020). Aave uses its own executeOperation function and Morpho uses onMorphoFlashLoan, so each lender needs its own integration (Aave Docs, Morpho Docs, 2026). Aave's documentation labels flash loans an advanced concept aimed at developers, and the borrower's contract must be written and tested before it sends a single transaction.

Flowchart: loan request, funds sent, receiver logic, repayment check, then transaction confirmed or reverted

Each lender enforces that revert rule differently, and each charges a different price for it.

Who Offers Flash Loans in DeFi, and What Do They Cost?

Five lenders offer flash loans, and fees run from zero to 0.3%. Aave charges 0.05%, Morpho and Sky's flash mint module charge nothing, and Uniswap charges its ordinary swap fee. Interface and available liquidity separate the options more than price does.

Aave V3: flashLoan Versus flashLoanSimple

Aave V3 offers two functions. flashLoan() borrows several reserves at once and lets the borrower turn any part into a variable-rate debt position if collateral backs it. flashLoanSimple() handles one reserve and uses less gas (Aave Docs, 2026). The fee started at 0.05% and governance can change it; the Ethereum Pool contract returned 0.05% on 16 November 2026. The flashLoan() fee is waived for borrowers on an approved list, while flashLoanSimple() always charges it. Liquidity is the unborrowed supply in Aave's reserves: Aave V3 held $14.0 billion of total value locked (TVL) net of borrowed coins as of 16 November 2026 (DefiLlama, 2026). Aave's approach to real-world-asset collateral ↗ is covered in a separate guide.

Morpho, Balancer and Maker Charge Nothing

Morpho Blue's flashLoan function has a zero fee, and the borrower can reach the contract's entire token balance, including collateral posted in every market (Morpho Docs, 2026). Sky (formerly MakerDAO) runs a flash mint module that creates DAI for one transaction and burns it back. On 16 November 2026 it capped a single loan at 500 million DAI and quoted a zero fee on a 1 million DAI loan (Maker Docs, Ethereum contract read, 2026). Balancer V2's Vault fee setting also read 0% on 16 November 2026, yet V2 and V3 together held only $0.02 billion of TVL that day, so its free loans are small (DefiLlama, 2026). Balancer V3's documentation shows an unlock, sendTo and settle sequence and states no fee.

Uniswap Prices Flash Swaps as Swap Fees

Uniswap treats a flash loan as a swap whose payment arrives late. A V2 pair sends the tokens first, calls uniswapV2Call, then checks that its reserves, discounted by the 0.3% liquidity provider (LP) fee, have not shrunk. Repaying the same token costs about 30.09 basis points (Uniswap Docs, 2026). A V3 pool's flash function requires the borrowed amount plus the pool's swap fee back by the end of the transaction (Uniswap Docs, 2026). V4 handles the same need through flash accounting: a contract may take tokens during an unlocked session, and the transaction reverts unless every balance change is settled before the PoolManager locks (Uniswap Docs, 2026).

ProviderFeeInterfaceRepaymentLiquidity
Aave V30.05% (waived for approved borrowers)flashLoan, flashLoanSimplePool approved to pull amount plus feeUnborrowed reserves, $14.0B TVL
Morpho0%flashLoan, onMorphoFlashLoanBorrower approves Morpho to pull backWhole contract balance, $10.0B TVL
Balancer V2 and V3V2 setting 0%, V3 not statedV3: unlock, sendTo, settleVault must be settled before locking$0.02B TVL combined
Uniswap V2 and V3Pool swap fee (V2: 0.3%)flash, uniswapV2CallPool checks balances after callbackReserves of one pool
Sky flash mint0%ERC-3156 for DAIMinted DAI burned backUp to 500M DAI per loan

Data current as of November 2026.

Flash loan cost matters little when the borrowed amount is used for a trade that pays for itself, so the practical question is what traders do with the money.

What Are Flash Loans Used For Besides Attacks?

Most flash loans reshuffle positions that already exist. Aave's documentation lists arbitrage, liquidations and its own liquidity-switch feature as applications (Aave Docs, 2026). A sample of 65 fee-paying Aave loans from September 2026 matched that list.

Arbitrage and Liquidation

Arbitrage buys a token where it is cheap and sells it where it is expensive. The flash loan supplies the purchase money, so the trader needs only enough ETH to cover gas. Six of the 65 sampled transactions contained nothing but Uniswap swaps around the loan, the footprint of this trade. Liquidation follows the same logic. A liquidator repays an underwater borrower's debt, receives the borrower's collateral at a discount, and sells it to refund the loan (Aave Docs, 2026). One sampled transaction was a liquidation followed by a swap. The tokens in these trades move through exchanges explained in a guide to swapping tokens on Uniswap ↗.

Collateral Swaps and Self-Liquidation

Position restructuring dominated the sample. Thirty-six of the 65 transactions repaid or supplied to an Aave position, withdrew or borrowed collateral and swapped assets on Uniswap V3. In a collateral swap, the loan repays the debt, the contract frees the collateral and converts it into another asset, and the borrower re-posts it, with no need to sell and rebuy by hand. Self-liquidation applies the same sequence to close an unsafe position before a third-party liquidator acts. Aave's documentation says its own liquidity-switch feature runs on flash loans (Aave Docs, 2026). The classification comes from event logs, not intent, and covers 25 of the largest and 40 randomly chosen fee-paying transactions.

UseWhat the loan doesWho is paidSeen in sample
ArbitrageBuys cheap on one venue, sells dear on anotherBorrower keeps the spread6 swap-only transactions
LiquidationRepays bad debt, takes discounted collateralLiquidator keeps the discount1 of 65
Collateral swap or deleveragingRepays debt, frees collateral, swaps itBorrower; lender earns the fee36 of 65
Self-liquidationCloses own position before a liquidator doesBorrowerCounted in the 36

Data current as of November 2026.

A sample of 65 cannot show how much of Aave's flash loan traffic these uses make up, so the full month of events is the better test.

What Did a Month of Aave Flash Loans on Ethereum Look Like?

Aave V3 on Ethereum logged 5,058 flash loans between 9 September and 9 October 2026, and 80% of them paid no fee. One address on Aave's approved list supplied 99% of the dollar volume (Ethereum event logs, 2026). Counting events shows who uses the feature, while summing dollars hides it.

5,058 Loans, 20 Percent Paid a Fee

The Pool contract's FlashLoan event fired 5,058 times in 5,009 transactions from 143 initiating addresses (Ethereum event logs, Aave V3 Pool, 2026). Of those, 1,026 paid a premium, together $4,021 on $8.04 million borrowed, with a median loan of $614. Four borrowers on Aave's approved list accounted for 3,672 fee-free events (Aave ACLManager contract read, 2026), 347 events converted the loan into debt instead of repaying it, and 13 paid nothing for a reason the log does not show. Wrapped ether (WETH) was borrowed 2,055 times, USDC 914 times and USDT 884 times. A 0.05% premium on the median fee-paying loan of $614 is 31 cents. Dollar values use 9 October 2026 prices.

One Address Supplied 99 Percent of Dollar Volume

Summed at 9 October prices, the 5,058 loans total $16.54 billion. One approved address made 51 WETH loans worth $16.31 billion of that, or 98.6%, with no premium (Ethereum event logs, 2026). The other 5,007 events total $0.24 billion, and the busiest address, also approved, made 3,524 of them worth $211.5 million at no charge. Euler's attacker borrowed 30 million DAI in a single loan in 2023, 3.7 times the $8.04 million that fee-paying borrowers took across this whole month. Event logs record amounts, not intent, so the counts cannot separate legitimate use from attacks. Headline flash loan volume says more about one operator than about demand.

MeasureValue
FlashLoan events5,058
Transactions5,009
Distinct initiating addresses143
Events that paid a fee1,026 (20.3%)
Volume of fee-paying loans$8.04M
Premiums paid$4,021
Median fee-paying loan$614
Events that opened debt instead of repaying347 ($6.6M)

Data current as of November 2026.

Donut chart of 5,058 Aave flash loans: 72.6% approved borrowers fee-free, 6.9% debt-opening, 0.3% other, 20.3% paid a fee
Bar chart of flash loans by asset: WETH 2,055, USDC 914, USDT 884, WBTC 542, LINK 184, GHO 98, wstETH 86, other 295

The fee-paying loans are the ones a retail-sized user would take, and one of them can be read line by line.

What Does One Real Flash Loan Transaction Do Step by Step?

One fee-paying loan from 23 September 2026 shows every step. The transaction burned 7,197.18 tokens of Index Coop's Ethereum 2x Index (ETH2X), a leveraged ether position built on Aave, and used a flash loan to unwind it in a single pass (Ethereum transaction 0x923bc8c9, 2026).

Decoded: An ETH2X Redemption

The transaction, in block 26,041,192 at 15:51 UTC, borrowed 79,661.89 USDC from Aave. Aave's Repay event then logs the same 79,661.89 USDC, which cleared the position's variable debt. The contract withdrew 66.74 WETH of collateral and sold 30.01 WETH into Uniswap V3's USDC/WETH pool with a 0.05% fee and received 79,701.72 USDC. It repaid Aave that amount, which is the principal plus the fee, and unwrapped the remaining 36.73 WETH. The swap returned exactly the sum owed, so the trade was sized to the loan. The FlashLoan event is the last log in the transaction receipt, after the swap and the repayment transfer, which matches the order the revert rule requires. The sender's gas bill and the 36.73 WETH left over show what a redeemer gains from the structure.

Fee Versus Gas

The premium was 39.83 USDC, exactly 0.05% of the principal. The transaction used 989,081 gas at an effective price of 1.97 gwei, a billionth of an ETH per unit of gas, about 0.0019 ETH. At an ether price near $2,470 on 9 October 2026, that gas cost close to $5, so the fee was roughly eight times the gas bill (DefiLlama, 2026). Without the loan, the redeemer would have needed 79,662 USDC in hand to clear the debt before touching the collateral. The loan replaced that capital with a 39.83 USDC fee.

Six steps of a flash loan on 23 September 2026: borrow USDC, repay debt, withdraw WETH, swap, repay Aave, keep 36.73 WETH

A legitimate loan like this repays the Pool inside the same transaction. An attack repays it too, and takes its profit from a third protocol.

How Does a Flash Loan Attack Actually Work?

A flash loan attack is an ordinary flash loan pointed at a protocol with a weakness ↗. The loan supplies capital, and the weakness is either a price a trader can move or a rule the code forgot to check. Banning flash loans would leave the weakness in place.

The Loan Is Capital, Not the Bug

Attacks that use flash loans share a four-step shape: borrow, distort, collect, repay. The loan lets an attacker who holds only gas money command millions for a single transaction, as with the 30 million DAI used against Euler in 2023. Chainalysis described that incident as showing "the potential hacking abuses opened up by flash loans" (Chainalysis, 2023). The loan changes the cost of the attack, not its cause. CertiK called the Euler exploit the largest flash loan exploit in over 14 months, and about 70% of the funds lost in 2023 up to that point (CertiK, 2023). Omniscia's post-mortem traces Euler's loss to a donation function without a health check, not to the flash loan that funded the attack (Omniscia, 2023).

Oracle Manipulation and Logic Flaws

Two weakness types recur. Oracle manipulation moves a price that a lending protocol reads, by trading heavily in a thin pool, then borrows against the false price. bZx's second attack in February 2020 did this on Kyber. Logic flaws are missing checks, as in Euler. A third pattern, borrowing voting power to pass a governance proposal, produced the $182.2 million Beanstalk loss in April 2022 (CertiK, 2023). Price manipulation does not need a flash loan at all. On 17 September 2026 an attacker inflated the price of NSTR on a thinly traded pool, seeded with about 1.5 SolvBTC, that Nostra's price feed read. DefiLlama classifies it as oracle manipulation, and the published account describes no flash loan, as the Nostra fake-pool incident ↗ explains.

The two cases below show each weakness type in transaction detail.

What Did the bZx and Euler Flash Loan Attacks Reveal?

Two cases from the public record show the two weakness types. bZx lost funds in two attacks three days apart in February 2020, and Euler lost about $197 million in March 2023. A wider list of 2026 incidents sits in a catalogue of 2026 DeFi hacks ↗.

bZx, February 2020

On 15 February 2020 an attacker borrowed 10,000 ETH from dYdX, deposited 5,500 ETH on Compound to borrow 112 wrapped bitcoin (WBTC), and opened a leveraged short on bZx. The order swapped through Kyber into a thin Uniswap pool and pushed the WBTC price to about 110 ETH against roughly 38 (PeckShield, 2020). A skipped margin check let the trade through, and PeckShield stressed that this was not an oracle attack. On 18 February the attacker borrowed 7,500 ETH from bZx itself, bought sUSD on Kyber to inflate its price, and borrowed 6,796 ETH against that collateral. The attacker kept about 2,378 ETH (palkeo, 2020).

Euler, March 2023

On 13 March 2023 an attacker flash-borrowed 30 million DAI from Aave V2 and deposited 20 million DAI into Euler. The attacker then used Euler's leveraged minting to build debt positions of 200 million tokens. The donateToReserves function, added in an upgrade and audited by Sherlock in July 2022, never checked the donor's health. The account became insolvent on purpose, and a second attacker contract liquidated it at the maximum 20% discount (Omniscia, 2023). The loss reached about $197 million. The attacker returned the funds in stages: 3,000 ETH on 18 March, 51,000 ETH on 25 March, then 7,000 ETH and $10 million of DAI (Chainalysis, 2023).

CaseDateFlash loanWhat failedOutcome
bZx, first attack15 Feb 202010,000 ETH from dYdXMargin check skipped; Uniswap price pushedAbout 1,271 ETH gained
bZx, second attack18 Feb 20207,500 ETH from bZxKyber price feed manipulatedAbout 2,378 ETH gained
Euler13 Mar 202330M DAI from Aave V2donateToReserves had no health checkAbout $197M; funds returned

Data current as of November 2026.

The bZx failure sat in price inputs and Euler's in a missing check, and each calls for a different fix.

How Can Protocols and Users Limit Flash Loan Risk?

Defenses sit inside the protocol being borrowed against, not in the flash loan. Euler missed a post-condition that its other functions enforced, and bZx trusted prices from a thin pool that one large order moved. Users cannot audit code unaided, but they can check what a protocol claims to have checked.

What Protocol Teams Change

The documented fixes target the weakness. After the bZx attacks, the team added a spread check on Kyber prices, but the second attack passed it because both reserves it compared moved together (palkeo, 2020). The design response was price sources that aggregate several venues or average over time, which a single transaction cannot move (Open Attack Knowledge base, 2026). After Euler, audit checklists add a step that confirms every state-changing function runs the same post-condition, such as a solvency test (Open Attack Knowledge base, 2026). Sky's documentation argues the other side: exploits that need large capital "will be found quicker", which makes DeFi safer overall (Maker Docs, 2026).

What Users Can Check

An audit report names its scope, and scope matters: Omniscia noted the donation function was outside its own audits, while Sherlock had covered it (Omniscia, 2023). A lending market should state each asset's price source and the depth of the pool behind it. Nostra accepted its own NSTR token, worth about $550,000 in total before the attack, as collateral for $3.5 million of borrowing, a mismatch visible in advance (Halborn, 2026). Protocols that publish post-mortems, as bZx and Euler did, show how a team responds when a check fails. A flash loan on its own cannot take deposits from a sound protocol, because an unrepaid loan reverts.

Conclusion

A flash loan is a loan whose repayment the transaction itself enforces. That single property explains the missing collateral, the zero fees at Morpho and Sky, the developer-only interfaces and the routine use by arbitrageurs, liquidators and position managers. It also explains why a month of Aave data looks lopsided: a few approved borrowers made most loans, and one made nearly all the dollars.

The loan does not separate the good case from the bad one. Euler's attacker and the redeemer of Index Coop's ETH2X token both borrowed from Aave, repaid in full and used the same callback. The difference sat in a second protocol: a price that one large trade can move, or a function that skipped the check every other function ran. Those flaws stay invisible until one transaction supplies enough capital to exploit them, and by then the transaction has finished.

Before depositing into a lending or vault protocol ↗, check three things. Read the audit report's scope and confirm it covers every function that moves balances. Find which price source the market uses for each collateral asset and how deep the pool behind it is. Look for a published post-mortem after any past incident. A protocol that passes all three has already priced in an attacker with unlimited capital.

Quick Stats

  • 5,058 — Aave V3 flash loans on Ethereum, 9 September to 9 October 2026
  • 20.3% — share of those loans that paid a fee; 79.7% paid none
  • 0.05% — Aave V3 flash loan fee on 16 November 2026
  • 98.6% — share of dollar volume from one address's 51 wrapped ether (WETH) loans
  • 39.83 USDC — fee on a 79,661.89 USDC loan, against about $5 of gas
  • $197M — Euler Finance loss in March 2023, later returned in stages

Data current as of November 2026.

FAQ

?Is a flash loan the same thing as a flash swap or a flash mint?

They share the revert rule but differ in what is lent. A Uniswap V2 flash swap sends pool tokens first and accepts repayment in either token, at about 30 basis points. Sky's flash mint creates DAI for one transaction and burns it back, capped at 500 million DAI on 16 November 2026, with no pool liquidity involved (Uniswap Docs, Maker Docs, 2026).

?Can an ordinary user take out a flash loan without writing code?

Not directly. Aave's documentation calls flash loans an advanced concept for developers, and a borrower needs a deployed receiver contract (Aave Docs, 2026). Most users meet flash loans indirectly, when an app such as a collateral-swap tool or a redemption contract, like the Index Coop ETH2X redemption decoded above, borrows on their behalf and passes the cost into the price.

?Do flash loans exist on centralized exchanges or on Bitcoin?

Neither offers them in the form described here. A centralized exchange lends from its own books, and a flash loan needs on-chain code that can cancel a whole sequence of steps. Bitcoin's base layer does not run general smart contracts, so flash loans live on programmable chains such as Ethereum.

?How does a flash loan differ from a normal collateralized loan on Aave?

A normal Aave loan is over-collateralized, runs for days or months and faces liquidation when the health factor falls below 1 (Aave Help, 2026). A flash loan needs no collateral, lasts one transaction, carries a flat 0.05% fee and cannot be liquidated. One exception exists: flashLoan() lets a borrower convert the loan into debt if collateral backs it, as 347 events did in the sample.

?Can a flash loan drain a lending pool that has no bug?

No. An unrepaid loan reverts, so the pool ends the transaction with at least what it lent. In the Euler attack, Aave lent 30 million DAI and was repaid, while Euler's own depositors bore the loss (Omniscia, 2023). A pool is exposed to flash loans only through flaws in its own logic or in the protocols that read its prices.

?Do flash loans make DeFi less safe overall?

Opinions split. Chainalysis wrote that Euler showed "the potential hacking abuses opened up by flash loans" (Chainalysis, 2023), and CertiK counted it as about 70% of funds lost in 2023 up to that point (CertiK, 2023). Sky's documentation argues that exploits needing large capital "will be found quicker", which makes DeFi safer overall (Maker Docs, 2026). The weakness exists either way; the loan changes who can afford to test it.

?How can I tell whether a protocol I use has been hit by a flash loan attack?

Start with the protocol's official channels, which normally announce a pause and later a post-mortem. Security firms such as CertiK and Omniscia published analyses of Euler on the day of the attack (CertiK, Omniscia, 2023). Incident catalogues list past cases by date, amount and cause, and an unexplained pause of lending or withdrawals is the usual first sign.

References / Sources

Platform & Company Data

Official documentation and market data behind fees, interfaces and liquidity figures.

  • Aave: Flash Loans Guide, V3 Documentation (aave.com, Oct 2026)
  • Morpho: Flash Loans and Blue Contract Reference (docs.morpho.org, Oct 2026)
  • Uniswap: Flash Swaps and Flash Accounting Guides (docs.uniswap.org, Oct 2026)
  • Maker: Flash Mint Module Documentation (docs.makerdao.com, Oct 2026)
  • Balancer: Flash Loans, V3 Vault Documentation (docs.balancer.fi, Oct 2026)
  • DefiLlama: Protocol TVL, Aave V3, Morpho, Balancer (defillama.com, Nov 2026)
Academic & Technical

Standards and incident analyses behind the mechanism and attack cases.

  • Ethereum Improvement Proposals: ERC-3156 Flash Loans (eips.ethereum.org, Nov 2020)
  • Omniscia: Euler Finance Incident Post-Mortem (medium.com, Mar 2023)
  • Chainalysis: Euler Finance Flash Loan Attack Explained (chainalysis.com, Mar 2023)
  • CertiK: Euler Finance Incident Analysis (certik.com, Mar 2023)
  • PeckShield: bZx Hack Full Disclosure (peckshield.medium.com, Feb 2020)
  • palkeo: The bZx Attacks Explained (palkeo.com, 2020)
Share this guide
Written by Bartek Hagan

Original CoinPaprika guide.

Report a correction
All guides

Cryptocurrencies are highly volatile and involve significant risk. You may lose part or all of your investment.

All information on Coinpaprika is provided for informational purposes only and does not constitute financial or investment advice. Always conduct your own research (DYOR) and consult a qualified financial advisor before making investment decisions.

Coinpaprika is not liable for any losses resulting from the use of this information.