📖 Tronsell Wiki

Flash Loan — DeFi Uncollateralized Borrowing Guide

A complete guide to flash loans in decentralized finance — what they are, how they work, use cases like arbitrage and collateral swaps, risks, and major platforms like Aave, dYdX, and Uniswap.

⚡ Quick Facts — Flash Loans
Definition Uncollateralized loan, repaid in same block
Collateral Required None
Repayment Time Within the same transaction block
Pioneer Platform Aave (2020)
Fee 0.09% (Aave), 0.05% (dYdX)
Use Cases Arbitrage, collateral swaps, self-liquidation

⚡ What Is a Flash Loan?

A flash loan is an uncollateralized loan in decentralized finance (DeFi) that must be borrowed and repaid within a single blockchain transaction block. Because the loan is atomic — meaning the entire sequence of operations either executes successfully or is entirely reverted — if the borrower fails to repay the loan by the end of the transaction, the entire transaction is reversed, and no state changes occur. This mechanism ensures that lenders are never exposed to default risk, allowing flash loans to be offered without any collateral.

Flash loans were pioneered by the Aave protocol in January 2020 and have since become a fundamental building block of DeFi innovation. They enable sophisticated strategies such as arbitrage, collateral swaps, self-liquidation, and refinancing, all without requiring the borrower to have upfront capital.

The flash loan market has grown significantly, with billions of dollars in flash loan volume executed daily. While most flash loans are used for legitimate arbitrage and efficiency strategies, they have also been exploited in several high-profile attacks, highlighting the importance of smart contract security.

⚡ Why Flash Loans Are Revolutionary

Flash loans democratize access to capital, enabling anyone with coding skills to execute strategies that previously required large amounts of capital. They are a testament to the power of programmable money and have unlocked new levels of efficiency in DeFi.

2020
Year Pioneered by Aave
$0
Collateral Required
0.09%
Typical Fee
1 Block
Repayment Window

⚙️ How Flash Loans Work

Flash loans operate through smart contracts that execute a sequence of operations atomically. Here's a step-by-step breakdown:

💰Request Loan
→
⚡Execute Actions
→
💸Repay + Fee
→
✅Success (or Revert)
  • Step 1: Request Loan — The borrower calls the flash loan function on a lending protocol (e.g., Aave), specifying the asset and amount.
  • Step 2: Execute Actions — The protocol sends the requested assets to the borrower's contract, which then executes a sequence of operations (e.g., arbitrage, collateral swap).
  • Step 3: Repay + Fee — At the end of the transaction, the borrower's contract must repay the loan principal plus a fee (e.g., 0.09% on Aave).
  • Step 4: Success or Revert — If repayment is successful, the transaction completes. If repayment fails at any point, the entire transaction reverts, and no funds are transferred.

Atomicity and Security

The key to flash loans is atomicity. The loan and all associated operations are bundled into a single transaction. If any operation fails (e.g., the arbitrage doesn't yield enough profit to repay the loan), the entire transaction reverts, leaving the lender's funds untouched. This eliminates credit risk and allows flash loans to be offered without collateral.

💡 Smart Contract Required

To execute a flash loan, borrowers must deploy a smart contract that handles the loan request, executes the strategy, and repays the loan. This requires Solidity programming skills or using pre-built flash loan aggregators.

🎯 Common Use Cases for Flash Loans

Flash loans enable a wide range of advanced DeFi strategies. Here are the most common use cases:

📈
Arbitrage

Exploit price differences between DEXs (e.g., Uniswap and SushiSwap) by buying low on one and selling high on another, using the flash loan to fund the trade without upfront capital.

🔄
Collateral Swap

Swap collateral in a lending position (e.g., from ETH to USDT) without needing to repay the loan first, using a flash loan to temporarily cover the position.

💸
Self-Liquidation

If a borrower's position is near liquidation, they can use a flash loan to repay part of the debt and withdraw collateral, avoiding the liquidation penalty.

🏛️
Refinancing

Move debt from one lending protocol to another (e.g., from Compound to Aave) to take advantage of better rates, using a flash loan to bridge the transition.

⚖️
Liquidation (Keeper)

Use a flash loan to liquidate an underwater position on a lending protocol, earning a liquidation bonus without needing the capital upfront.

🔧
Protocol Arbitrage

Exploit inefficiencies between different DeFi protocols (e.g., interest rate differences) for profit.

📊 Arbitrage Example

A trader sees ETH priced at $3,000 on Uniswap and $3,010 on SushiSwap. They take a flash loan of 100 ETH ($300,000), buy on Uniswap, sell on SushiSwap, earn $1,000 profit, repay the loan plus a $270 fee, and keep the profit — all in one transaction.

🏛️ Major Flash Loan Platforms

Several DeFi protocols offer flash loans, each with its own features and fee structures.

Platform Fee Assets Supported Networks Key Features
Aave 0.09% 30+ (USDT, USDC, DAI, ETH, etc.) Ethereum, Polygon, Arbitrum, etc. Pioneer, largest selection
dYdX 0.05% ETH, DAI, USDC Ethereum Lower fee, perpetuals integration
Uniswap v3 0.30% (flash swap) Any token pair Ethereum, Polygon, etc. Flash swaps (not traditional loans)
Morpho Varies USDT, USDC, DAI, etc. Ethereum, Optimism, Arbitrum Optimized lending with flash loans
Balance Varies Multiple Ethereum, Polygon Flash loans via Balancer pools
💡 Choosing a Platform

Aave offers the widest range of assets and networks, making it the most popular choice for flash loans. dYdX has a lower fee but limited assets. Uniswap v3 flash swaps are useful for specific token pairs without needing a lending protocol.

⚠️ Risks and Considerations

While flash loans are safe for lenders due to atomicity, borrowers and users of flash loan strategies face several risks:

🔓
Smart Contract Risk

Borrower's contract must be bug-free. A flaw in the code can cause the transaction to fail, wasting gas fees, or worse, be exploited by attackers.

⛽
Gas Costs

Flash loan transactions require multiple operations and can be gas-intensive. On Ethereum mainnet, gas costs can be significant, especially during high congestion.

MEV Attacks

Miners or validators can front-run flash loan transactions, potentially stealing profitable opportunities or causing the transaction to fail.

📊
Market Volatility

If the market moves during the transaction execution (though unlikely within a single block), the strategy may not be profitable.

🏛️
Regulatory Risk

Flash loans and the strategies they enable may come under regulatory scrutiny, potentially affecting their availability.

🔗
Protocol Dependency

Flash loans rely on the lending protocol's smart contracts. If the protocol has a vulnerability, the flash loan functionality could be compromised.

🛡️ Notable Flash Loan Attacks

Several high-profile attacks have exploited flash loans in combination with other vulnerabilities. For example, the 2020 bZx attack used a flash loan to manipulate oracle prices, resulting in a loss of ~$950,000. The 2021 PancakeBunny attack used a flash loan to inflate the price of BUNNY tokens. These incidents highlight the importance of security auditing and robust oracle systems.

🪙 Flash Loans with USDT

USDT is one of the most commonly used assets in flash loans due to its stability, liquidity, and widespread acceptance.

  • USDT on Aave: Available on multiple networks (Ethereum, Polygon, Arbitrum) with a fee of 0.09%. USDT flash loans on Aave have been used extensively for arbitrage and collateral swaps.
  • USDT Flash Loan Volume: USDT is consistently among the top assets for flash loan volume, often exceeding ETH and WBTC.
  • Use Case Example: Borrowing USDT to arbitrage between USDT/USDC pools on Curve and Uniswap, profiting from the spread.

For USDT holders, flash loans offer a way to generate additional yield by deploying USDT in arbitrage strategies without needing to provide collateral. However, this requires technical expertise and carries the risks mentioned above.

🔮 Future of Flash Loans

Flash loans have become a core innovation in DeFi, and their future is bright. Key trends include:

  • Cross-Chain Flash Loans: Protocols are developing flash loans that work across multiple blockchains, enabling arbitrage and strategies across ecosystems.
  • Integration with DeFi 2.0: Flash loans are being integrated into more complex DeFi products, such as structured products and automated strategies.
  • Lower Fees: Competition among protocols may drive flash loan fees even lower, making them more accessible.
  • Better Security: Improved auditing practices and oracle solutions will reduce the risk of flash loan exploits.
  • User-Friendly Interfaces: Platforms that simplify flash loan execution for non-developers will make them more widely accessible.

As DeFi matures, flash loans will continue to play a vital role in market efficiency, arbitrage, and the broader DeFi ecosystem.

❓ Frequently Asked Questions About Flash Loans

What is a flash loan?

A flash loan is an uncollateralized loan in DeFi that must be borrowed and repaid within a single blockchain transaction block. Because the loan is atomic, if the borrower fails to repay, the entire transaction is reverted, ensuring no loss for the lender. Flash loans are used for arbitrage, collateral swaps, self-liquidation, and other advanced strategies.

How do flash loans work?

Flash loans work through smart contracts that execute a sequence of operations atomically. The borrower requests a loan amount, performs desired actions (e.g., arbitrage, collateral swap), and repays the loan plus fees, all within the same transaction. If the repayment fails at any point, the entire transaction reverts, and no state changes occur.

What can flash loans be used for?

Common use cases include: (1) Arbitrage — exploiting price differences between DEXs. (2) Collateral swaps — swapping collateral in lending positions to avoid liquidation. (3) Self-liquidation — repaying debt and recovering collateral before liquidation. (4) Refinancing — moving debt between protocols. (5) Liquidating underwater positions for profit.

Which platforms offer flash loans?

Major platforms offering flash loans include Aave (the pioneer), dYdX, Uniswap v3 (through flash swaps), and Morpho. Aave supports multiple networks and a wide range of assets, including USDT, USDC, DAI, ETH, and many others.

What are the risks of flash loans?

While flash loans are safe for lenders due to atomicity, borrowers face risks such as: (1) Transaction failure due to high gas costs or protocol changes. (2) Smart contract vulnerabilities if the borrower's code is flawed. (3) Market volatility if price changes during the transaction execution (though this is rare due to block finality). (4) MEV (Miner Extractable Value) attacks where miners may front-run the transaction.

How much does a flash loan cost?

Flash loan fees vary by platform. Aave charges 0.09% of the loan amount, dYdX charges 0.05%, and Uniswap v3 flash swaps use the pool's standard swap fee (0.01–1.00%). Some platforms may offer lower fees during promotional periods or for specific assets.

Do I need to be a developer to use flash loans?

Yes, executing a flash loan typically requires writing a smart contract in Solidity to handle the loan request and strategy execution. However, there are aggregator platforms that simplify the process for non-developers, though they may charge higher fees and offer limited flexibility.

Can flash loans be used with USDT?

Yes, USDT is one of the most popular assets for flash loans on platforms like Aave. USDT flash loans are used extensively for arbitrage, collateral swaps, and other strategies due to USDT's stability and deep liquidity.

⚡ Leverage Flash Loans with Confidence

Flash loans are a powerful DeFi innovation. For TRON-based USDT, explore Tronscan and save on transfer fees with instant energy from Tronsell.