← Back to Blog

What Are Flash Loans? Zero-Collateral DeFi Lending Explained

January 20, 2026 · 18 min read

Flash loans are a revolutionary financial primitive unique to decentralized finance that allow anyone to borrow unlimited amounts of cryptocurrency with absolutely zero collateral. Unlike traditional loans that require credit checks, collateral deposits, and lengthy approval processes, flash loans are issued and repaid within a single blockchain transaction. If the borrower cannot repay the loan plus a small fee by the end of the transaction, the entire operation is reversed as though it never happened. This atomic guarantee makes flash loans one of the most powerful and risk-efficient tools in DeFi, enabling strategies like arbitrage, collateral swaps, and self-liquidation that would otherwise require millions in upfront capital. Pioneered by protocols like Aave in 2020, flash loans have since facilitated billions of dollars in transaction volume and fundamentally changed how traders, developers, and MEV bots interact with decentralized markets.

How Flash Loans Work: The Technical Mechanics

Flash loans exploit a fundamental property of blockchain transactions: atomicity. Every Ethereum transaction is atomic, meaning either all operations within it succeed, or none of them do. A flash loan leverages this by bundling three steps into a single transaction: borrow, use, and repay.

When you initiate a flash loan, the lending protocol transfers the requested tokens to your smart contract. Your contract then executes whatever logic you have programmed — swapping tokens across DEXs, liquidating a position on Aave, or rebalancing collateral. At the very end of the transaction, your contract must transfer the borrowed amount plus the protocol fee back to the lending pool. The lending protocol includes a check at the end of execution: if the full amount plus fee is not returned, the entire transaction reverts.

This all happens within a single block on Ethereum, which means the entire flash loan lifecycle — from borrowing to repayment — completes in roughly 12 seconds. There is no concept of duration or interest accrual. The loan exists only for the span of one transaction, and the blockchain either records the completed operation or discards it entirely.

The same-block repayment requirement is what makes flash loans trustless. The lending protocol faces zero risk of default because the EVM (Ethereum Virtual Machine) enforces repayment at the execution layer. If repayment fails, the state changes from the entire transaction are rolled back, including the initial transfer of funds to the borrower. The lender never actually loses custody of their assets in a failed flash loan.

Flash Loan Providers: Where to Borrow

Aave

Aave is the most widely used flash loan provider and the protocol that popularized the concept. Aave V3 supports flash loans across Ethereum, Arbitrum, Optimism, Polygon, Avalanche, and other networks. The available liquidity for flash loans equals the total deposits in each Aave lending pool, which often exceeds hundreds of millions of dollars for major assets like WETH, USDC, and DAI. Aave charges a flat 0.09% fee on flash loans (reduced to 0.05% for certain whitelisted integrations). JaredFromSubway frequently taps into Aave's deep liquidity pools when executing large flash loan arbitrage operations that require substantial capital.

Uniswap V3 Flash Swaps

Uniswap V3 offers flash swaps, which function similarly to flash loans but are integrated directly into the swap mechanism. When you execute a flash swap, Uniswap sends you the output tokens before you have paid the input tokens. Your callback function then executes your logic and returns the required input tokens (or the equivalent value) before the transaction completes. The cost of a Uniswap V3 flash swap is the pool's swap fee, which ranges from 0.01% for stablecoin pairs to 1% for exotic pairs, with 0.05% and 0.3% being the most common tiers.

Balancer

Balancer stands out by offering zero-fee flash loans through its Vault architecture. All assets deposited across Balancer pools are held in a single Vault contract, and flash loans can access any of those assets without paying a lending fee. The borrower only pays Ethereum gas costs. This makes Balancer particularly attractive for strategies where the profit margin is thin and every basis point matters. The trade-off is that Balancer typically has less total liquidity than Aave for most individual assets.

dYdX

dYdX was one of the earliest protocols to support flash loan-like functionality through its Solo Margin system. While dYdX has since pivoted toward perpetual futures trading on its own chain, its legacy Ethereum contracts still support flash loans for ETH, USDC, and DAI with zero protocol fees. Many early flash loan arbitrage bots, including early iterations of JaredFromSubway's infrastructure, relied on dYdX for capital-efficient execution.

Flash Loan Use Cases

Arbitrage

Arbitrage is the most common use case for flash loans. A trader identifies a price discrepancy for the same token across two or more DEXs — for example, ETH trading at $3,900 on Uniswap and $3,925 on Sushiswap. Using a flash loan, the trader borrows a large amount of USDC from Aave, buys ETH on Uniswap at the lower price, sells it on Sushiswap at the higher price, repays the flash loan plus the 0.09% fee, and keeps the difference as profit. Without flash loans, this trade would require the trader to already hold hundreds of thousands of dollars in capital. With flash loans, the capital requirement drops to zero — only gas fees are needed. This is the core strategy behind flash loan arbitrage bots like JaredFromSubway.

Collateral Swaps

Imagine you have a loan on Aave collateralized by ETH, but you want to switch your collateral to WBTC without closing your position. Without flash loans, you would need extra capital to repay the loan, withdraw your ETH, swap it for WBTC, deposit the WBTC, and re-borrow. With a flash loan, all of this happens in a single transaction: borrow enough to repay your existing loan, withdraw your ETH collateral, swap ETH for WBTC, deposit WBTC as new collateral, re-borrow your original loan amount, and repay the flash loan. The entire collateral swap is atomic and requires no additional capital.

Liquidations

DeFi lending protocols like Aave and Compound allow anyone to liquidate undercollateralized positions in exchange for a liquidation bonus (typically 5-10% of the liquidated collateral). Flash loans enable liquidators to operate without holding any capital. The liquidator borrows the repayment asset via flash loan, repays the borrower's debt, receives the discounted collateral, swaps it back to the borrowed asset, repays the flash loan, and keeps the liquidation bonus as profit.

Self-Liquidation

If your own lending position is approaching the liquidation threshold, you can use a flash loan to unwind it yourself rather than losing the liquidation penalty to a third-party liquidator. You borrow the debt asset via flash loan, repay your entire loan, withdraw your collateral, sell enough collateral to cover the flash loan repayment, and keep the rest. This saves you the 5-10% liquidation penalty that an external liquidator would have taken.

Want Flash Loan Profits Without the Complexity?

JaredFromSubway's MEV bot handles flash loan arbitrage, liquidations, and multi-DEX strategies automatically. Zero upfront capital required — the bot borrows, trades, and repays within a single transaction.

Start Trading with Flash Loans

How JaredFromSubway Uses Flash Loans for MEV Extraction

JaredFromSubway is one of the most active MEV bots on Ethereum, and flash loans are a core component of its extraction strategy. The bot monitors the mempool for pending transactions that will create price dislocations across DEX pools. When a profitable opportunity is detected, JaredFromSubway constructs an atomic transaction bundle that borrows capital via flash loan, executes the MEV strategy (arbitrage, sandwich back-run, or liquidation), and repays the loan — all within the same block.

Flash loans give JaredFromSubway a significant edge because they remove capital constraints from the optimization problem. Instead of being limited by the bot's own balance, the bot can borrow the exact optimal amount needed for each opportunity. If an arbitrage requires $5 million in capital to capture a $2,000 profit, the bot borrows $5 million from Aave, executes the trade, repays $5,004,500 (principal plus 0.09% fee), and nets the remaining profit minus gas costs.

The bot also uses flash loans in combination with Flashbots bundles for MEV extraction. By submitting transaction bundles through Flashbots' relay, JaredFromSubway ensures that flash loan transactions are included in blocks with precise ordering — critical for strategies like back-running large swaps where the bot must execute immediately after the target transaction.

Flash Loan Attacks: Notable Exploits and How They Work

While flash loans enable legitimate strategies like arbitrage and collateral management, they have also been used in some of DeFi's most devastating exploits. Flash loan attacks typically exploit vulnerabilities in smart contract logic, price oracle manipulation, or governance mechanisms.

The general pattern of a flash loan attack involves borrowing a large amount of capital to temporarily manipulate a protocol's state — usually by distorting the price reported by an on-chain oracle — then exploiting that distorted state for profit, and finally repaying the flash loan. Because the entire attack happens in one transaction, the attacker needs zero capital and faces no risk of loss if the attack fails.

Notable flash loan attacks include the bZx exploits in 2020 (which drained approximately $1 million by manipulating Uniswap V2 prices used as oracles), the Harvest Finance attack ($34 million stolen by manipulating Curve pool prices), and the Pancake Bunny exploit ($45 million extracted through price oracle manipulation on BSC). Each of these attacks followed a similar pattern: borrow via flash loan, manipulate an on-chain price oracle, exploit a protocol that relies on that oracle, and repay the loan with profit.

These attacks led to significant improvements in DeFi security. Protocols now use time-weighted average prices (TWAPs) from Uniswap V3, Chainlink price feeds, and multi-source oracle aggregation to resist flash loan manipulation. The crypto arbitrage bot ecosystem has also evolved, with legitimate bots like JaredFromSubway focusing on market inefficiency arbitrage rather than oracle exploitation.

Flash Loan Fees and Costs

Understanding the cost structure of flash loans is essential for calculating whether a strategy is profitable. The total cost of a flash loan transaction includes the protocol fee, Ethereum gas costs, and any Flashbots builder bribes if using MEV bundles.

  • Aave V3: 0.09% of the borrowed amount (e.g., borrowing $1,000,000 costs $900 in fees)
  • Uniswap V3 flash swaps: The pool's swap fee tier — 0.01%, 0.05%, 0.3%, or 1% depending on the pool
  • Balancer: 0% protocol fee — only gas costs apply
  • dYdX (legacy): 0% protocol fee on supported assets (ETH, USDC, DAI)
  • Gas costs: Flash loan transactions are complex and typically cost 300,000-800,000 gas units, translating to $10-$100+ depending on network congestion
  • Flashbots bribes: If submitting through Flashbots, the builder bribe typically consumes 80-90% of the gross MEV profit

For a flash loan arbitrage to be profitable, the gross profit from the price discrepancy must exceed the sum of the flash loan fee, gas costs, and any builder bribes. This is why sophisticated bots like JaredFromSubway run precise simulations before submitting each transaction, ensuring that only profitable opportunities are executed.

Flash Loan Flow: Code Example

The following pseudocode illustrates the typical flow of a flash loan arbitrage transaction. While production implementations are far more complex, this demonstrates the core logic that every flash loan bot executes.

FlashLoanArbitrage.sol — Pseudocode
// SPDX-License-Identifier: MIT
// Flash Loan Arbitrage — Simplified Flow

contract FlashLoanArbitrage {

  function executeArbitrage(
    address token,
    uint256 amount,
    address dexBuy,
    address dexSell
  ) external {
    // Step 1: Borrow tokens from Aave via flash loan
    // Aave transfers 'amount' of 'token' to this contract
    // and calls our callback function
    aaveLendingPool.flashLoan(
      address(this),   // receiver
      token,           // asset to borrow
      amount,          // amount to borrow
      abi.encode(dexBuy, dexSell)  // params
    );
  }

  // Step 2: Aave calls this function after transferring funds
  function executeOperation(
    address asset,
    uint256 amount,
    uint256 fee,       // 0.09% of borrowed amount
    bytes calldata params
  ) external returns (bool) {
    (address dexBuy, address dexSell) = abi.decode(
      params, (address, address)
    );

    // Step 3: Buy token on cheaper DEX
    uint256 tokensReceived = swap(dexBuy, USDC, asset, amount);

    // Step 4: Sell token on more expensive DEX
    uint256 usdcReceived = swap(dexSell, asset, USDC, tokensReceived);

    // Step 5: Repay flash loan + fee
    // If usdcReceived < amount + fee, this reverts
    // and the entire transaction is rolled back
    uint256 amountOwed = amount + fee;
    IERC20(asset).approve(address(aaveLendingPool), amountOwed);

    // Step 6: Profit remains in contract
    // profit = usdcReceived - amountOwed
    return true;
  }
}

In this flow, the critical safety mechanism is in Step 5. If the arbitrage did not generate enough profit to cover the borrowed amount plus the 0.09% Aave fee, the approve call will attempt to authorize more tokens than the contract holds, causing the transaction to revert. The borrower loses nothing except the gas fee for the failed transaction. Production bots like JaredFromSubway add additional checks, including pre-trade simulation, slippage protection, and gas price optimization.

Risks and Limitations of Flash Loans

Despite their safety guarantees, flash loans carry several risks and limitations that users should understand before relying on them.

  • Smart contract risk: Your flash loan contract is custom code. Bugs, reentrancy vulnerabilities, or logic errors can result in unexpected behavior. A poorly written callback function could allow an attacker to drain funds deposited in your contract.
  • Gas cost risk: Failed flash loan transactions still consume gas. If your bot attempts many unprofitable flash loans, the accumulated gas costs from reverted transactions can become significant.
  • Competition: Flash loan arbitrage is highly competitive. Hundreds of bots monitor the same DEX pools and compete for the same opportunities. Winning requires faster detection, more efficient execution, and better arbitrage bot infrastructure.
  • Slippage and front-running: Between the time you detect an opportunity and your transaction is included in a block, prices can change. Other MEV bots may front-run your flash loan transaction, consuming the opportunity before your transaction executes.
  • Protocol dependencies: Flash loans depend on the lending protocol's smart contracts being functional and solvent. If a flash loan provider is exploited or paused, any strategy relying on that provider will fail.
  • Single-transaction constraint: Everything must complete within one transaction. You cannot use flash loans for strategies that require waiting for oracle updates, governance votes, or cross-chain bridge confirmations.

Flash Loans FAQ

Are flash loans safe to use?

Flash loans are inherently safe for the borrower because they are atomic. If the loan cannot be repaid within the same transaction, the entire transaction reverts and no funds are lost — you only lose the gas fee for the failed transaction. However, flash loans require technical knowledge to implement correctly, and poorly written smart contracts can contain vulnerabilities that attackers could exploit.

How much do flash loans cost?

Flash loan fees vary by provider. Aave charges 0.09% of the borrowed amount (reduced to 0.05% for certain assets). Uniswap V3 flash swaps charge the pool swap fee (0.01% to 1% depending on the pool tier). Balancer offers flash loans with zero fees. You also pay Ethereum gas fees for the transaction, which can range from $10 to over $100 depending on network congestion and transaction complexity.

Can I use flash loans without coding?

Flash loans require a smart contract to execute, which means some level of Solidity programming knowledge is needed. However, platforms like JaredFromSubway abstract away the complexity by providing pre-built flash loan infrastructure for MEV extraction and arbitrage, allowing users to benefit from flash loan strategies without writing their own smart contracts. Visit our registration page to learn more.

What is the maximum amount I can borrow with a flash loan?

The maximum flash loan amount is limited only by the liquidity available in the lending pool. On Aave, you can borrow the entire available liquidity of any supported asset — often hundreds of millions of dollars worth of ETH, USDC, or other tokens. The only requirement is that you repay the full amount plus fees within the same transaction.

Start Earning with Flash Loan Strategies

JaredFromSubway's MEV bot executes flash loan arbitrage, liquidations, and multi-DEX strategies across Ethereum. Zero capital required — borrow, trade, and profit in a single atomic transaction.

Launch Terminal