Skip to content
Basis Desk

New from Basis Desk: free Telegram proxies for places where Telegram is blocked or slowed down.Connect in one tap →

DeFi · 6 min read Last reviewed November 3, 2026

What Are Flash Loans? DeFi Uncollateralized Lending, Explained

Flash loans allow users to borrow large sums of digital assets without upfront collateral, provided the funds are returned within the same blockchain transaction. This enables arbitrage and collateral swaps but also powers complex market exploits.

Editorial oversight: Julian Mercer, Chief Editor
Neutral

Key points

  • Flash loans allow borrowing of digital assets without collateral if repaid in the same transaction.
  • If the loan is not repaid by the end of the transaction, the entire sequence reverts.
  • Traders use flash loans for arbitrage, collateral swaps, and avoiding liquidation penalties.
  • Exploiters use flash loans to fund attacks on vulnerable price oracles and smart contracts.

A flash loan is a decentralized finance mechanism that allows users to borrow digital assets without providing upfront collateral, on the strict condition that the borrowed amount plus a fee is returned within the exact same blockchain transaction. If the borrower fails to repay the loan by the end of the transaction cycle, the entire sequence is reversed as if it never occurred. This structure eliminates counterparty risk for lenders while providing temporary liquidity for complex trading strategies.

The Mechanics of Atomic Execution

Flash loans rely on a property of blockchain networks known as atomic execution. In computer science, an atomic transaction is an indivisible and irreducible series of operations. It must either complete in its entirety or fail completely. There is no intermediate state where only part of the transaction succeeds.

On networks like Ethereum ($ETH), a block is composed of multiple transactions. Each transaction can contain a sequence of smart contract interactions. When a user initiates a flash loan, the lending protocol transfers the requested tokens to the user's smart contract. The user's contract then executes its programmed logic, trading on decentralized exchanges or interacting with other protocols. Finally, the user's contract must return the borrowed funds to the lending protocol. If the final step fails because the user's contract lacks the required funds, the Ethereum virtual machine evaluates the entire transaction as invalid. The network reverts all state changes, meaning the borrowed funds never technically left the lending protocol. The user only loses the network gas fees required to attempt the transaction.

This atomic design fundamentally shifts the risk model of lending. Traditional finance requires collateral, credit checks, or legal agreements to mitigate the risk of default. In decentralized finance, the risk of default is neutralized by the blockchain's consensus rules.

A Worked Example: Arbitrage

The most common benign use of flash loans is arbitrage, the practice of exploiting price discrepancies for the same asset across different markets. Because decentralized exchanges rely on automated market maker formulas rather than centralized order books, prices can drift apart depending on local trading volume.

Consider a scenario where the price of 1 Wrapped Bitcoin ($WBTC) is 50,000 USD Coin ($USDC) on Exchange A, but temporarily spikes to 50,500 USDC on Exchange B. A trader with limited capital can use a flash loan to capture this spread.

The trader writes a smart contract that requests a flash loan of 10 million USDC from a lending protocol. The lending protocol charges a standard fee, which varies by platform but is often around 0.09 percent.

The atomic transaction unfolds in the following steps:

  1. Borrow 10,000,000 USDC from the lending protocol.
  2. Swap the 10,000,000 USDC for 200 WBTC on Exchange A at the price of 50,000 USDC per WBTC.
  3. Transfer the 200 WBTC to Exchange B.
  4. Swap the 200 WBTC back into USDC at the price of 50,500 USDC per WBTC, yielding 10,100,000 USDC.
  5. Repay the original 10,000,000 USDC loan plus the 9,000 USDC fee (0.09 percent).

The trader retains the remaining 91,000 USDC as gross profit, minus the network gas fees required to execute the transaction. If the price on Exchange B shifts before the transaction executes and the final swap yields less than 10,009,000 USDC, the repayment fails. The network reverts the entire sequence, and the trader only pays the gas fee for the failed attempt.

Refinancing and Collateral Swaps

Beyond arbitrage, flash loans facilitate advanced portfolio management within decentralized finance. Users who hold debt positions in lending protocols often want to swap their underlying collateral without closing the position.

Normally, to swap collateral, a user must repay their debt, withdraw the original collateral, trade it for the new asset, deposit the new asset, and borrow the debt again. This requires the user to have enough capital on hand to clear the debt initially.

A flash loan condenses this into one transaction. A user borrows the debt amount via a flash loan to clear their outstanding loan. The protocol releases their original collateral. The user's smart contract automatically swaps the original collateral for a new asset on a decentralized exchange. The user deposits the new asset as collateral, draws a new loan against it, and uses that new loan to repay the flash loan.

This exact mechanism is also used for self-liquidation. If a borrower is nearing a liquidation threshold due to falling collateral prices, they can use a flash loan to pay down their debt, retrieve their collateral, sell a portion of it to cover the flash loan, and keep the remainder. This avoids the liquidation penalty typically charged by lending protocols.

Flash Loan Attacks and Exploits

The uncollateralized nature of flash loans means anyone can temporarily wield massive capital. This has made flash loans the primary tool for exploiting vulnerabilities in smart contracts. These events are commonly referred to as flash loan attacks, though the flash loan itself is rarely the vulnerability; it is merely the funding mechanism used to scale a separate exploit.

The most frequent target is a protocol's price oracle, the mechanism used to determine the value of assets. If a protocol relies on a single decentralized exchange for its price data rather than a time-weighted average or a decentralized oracle network, it is vulnerable to manipulation.

In an oracle manipulation attack, an exploiter takes out a massive flash loan and dumps the borrowed asset into the specific liquidity pool the target protocol uses for pricing. This artificially crashes or spikes the asset's price within that single block. The exploiter then interacts with the target protocol, borrowing against artificially inflated collateral or liquidating underpriced positions. Once the exploit is complete, the attacker reverses the initial trade on the decentralized exchange, repays the flash loan, and walks away with the extracted value.

Similarly, flash loans have been used in governance attacks. Some decentralized protocols allow users to vote on system changes proportional to the governance tokens they hold. An attacker can use a flash loan to borrow millions of governance tokens, pass a malicious proposal that transfers protocol treasury funds to themselves, and return the tokens within the same block. Protocols mitigate this by requiring tokens to be locked in a voting contract for multiple blocks, breaking the atomic nature required for a flash loan.

Common misconceptions

  • Flash loans are not free money. They require capital to pay for network gas fees, which can be substantial for complex smart contract interactions. If the transaction fails, the user still loses the gas fee.
  • Flash loans are not inherent security flaws. They function exactly as programmed. When a protocol is drained via a flash loan, the root cause is typically a vulnerability in the victim protocol's price oracle or mathematical logic, not the lending protocol providing the flash loan.
  • Flash loans are not consumer products. They cannot be executed through standard digital wallets. They require writing and deploying custom smart contracts capable of interacting with multiple decentralized protocols within a single transaction.

How this connects to the market

Flash loans act as an extreme stress test for decentralized finance infrastructure. By democratizing access to massive liquidity, they ensure that price discrepancies across decentralized exchanges are closed instantly. This enforces market efficiency, ensuring that retail users get consistent pricing regardless of which exchange they use.

However, this same mechanism forces developers to adopt rigorous security standards. Protocols must use resilient, decentralized price oracles and conduct extensive audits to ensure their logic cannot be broken by sudden, massive influxes of capital. As the sector matures, the frequency of simple oracle manipulation attacks has decreased as protocols adopt standardized oracle solutions, though complex logical exploits utilizing flash-loan funding remain a persistent market reality.

Questions this story raises

What happens if I cannot repay a flash loan?
If your smart contract fails to return the borrowed funds plus the required fee by the end of the transaction, the blockchain network reverts all state changes. The loan is cancelled as if it never happened, but you still pay the network gas fee for the failed transaction.
Do I need collateral for a flash loan?
No. The guarantee of repayment is enforced by the blockchain's atomic execution rules, not by pledged assets.
Can average users take out flash loans?
Generally no. Executing a flash loan requires writing and deploying a custom smart contract to handle the borrowed funds. It is a tool for developers and sophisticated algorithmic traders.
Are flash loans illegal?
Flash loans themselves are merely smart contract functions and are not inherently illegal. However, using them to manipulate markets or exploit vulnerabilities may violate financial regulations or laws depending on the jurisdiction.

References

  1. [1] Ethereum Documentation: Transactions — Ethereum Foundation

Evergreen explainer written by Basis Desk's system and checked by an independent model pass for factual errors and advice language. Figures, fees and rules change — the references above are where to verify current specifics. Market figures marked "at the time of writing" come from live exchange data. Report an error: corrections@basisdesk.news · corrections policy.

The Daily Brief, in your inbox at 07:00 ET

Five stories, the numbers that moved, what to watch. Three minutes. No hype, no advice, unsubscribe in one click.

Not financial advice. Basis Desk publishes information, not recommendations. Crypto assets are volatile and you can lose what you invest.