What Are Flash Loans and How Do They Work?

Flash Loan Definition: A flash loan is a digital loan of cryptocurrency that is issued and repaid in a single transaction. 

Written by: Anatol Antonovici   |  Updated August 26, 2024

Fact checked by: Ryan Grace

digital bank

Imagine if it were possible to borrow money in seconds without collateral and be able to use it to generate profits. If you fail to make a profit, you simply reverse the borrowing transaction as if nothing happened. If you succeed, you repay the funds and remain with the profit.

This is exactly how flash loans work in decentralized finance (DeFi) – a major trend that leverages blockchain technology to build financial services.

Table of Contents

🍒 tasty takeaways

  • Flash loans are uncollateralized loans in decentralized finance (DeFi) that must be repaid within a single blockchain transaction, mainly using Ethereum’s smart contracts.

  • These loans don’t require collateral or income proof. If not repaid within the same transaction, the smart contract automatically reverses the loan.

  • Aave made flash loans popular in 2020, but Marble introduced them in 2018. Platforms like Aave, dYdX, and Uniswap offer them.

  • Borrowers specify loan details in a smart contract. They receive funds, use them (e.g., for trades), and repay within the same transaction, often with a fee.

  • Flash loans are used for arbitrage, collateral swaps, and debt refinancing.

What Are Flash Loans?

Flash loans are uncollateralized loans that are issued and repaid within a single blockchain transaction. They leverage smart contracts, which are helping to build Web3 apps, mostly on the Ethereum network.  

📚 Read: How Do Smart Contracts Work?

The distinctive aspect of flash loans is that they eliminate the need for income proof, reserves, or collateral altogether. However, the key to flash loans is that repayment of the loans must be completed within the same transaction. These loans have some interesting use cases, and we’ll discuss them below.

While flash loans don’t need collateral and income proof, they’re essentially risk-free for lenders. If the borrower fails to repay, the smart contract automatically cancels the transaction, effectively erasing the loan. Therefore, we’re speaking about a very short time frame here.

Thanks to the smart contract feature, flash loans are instantaneous and don’t require lengthy approval processes. Borrowers can use the borrowed cryptocurrency to perform trades or other operations within the same transaction.

History of Flash Loans

DeFi lending protocol Aave brought flash loans to the blockchain world back in 2020, enabling users to borrow without limits. Shortly after the launch, Aave was issuing over $100 million in flash loans per day. While Aave is the first DeFi platform to make flash loans popular, these were actually introduced in 2018 by an Ethereum-based open-source bank called Marble.

So far, you should know that flash loans are:

  • Blockchain-based – they’re using smart contracts to stipulate terms and perform instant trades;

  • Uncollateralized – instead of providing collateral, users have to repay the loan within a very narrow timeframe;

  • Instant – the crypto funds are borrowed and repaid in a single transaction.

 

How Do Flash Loans Work?

As mentioned, flash loans leverage smart contracts on Ethereum or other blockchains. Here is how they work in a few steps:

  • Application – the borrower applies for a flash loan on Aave or another DeFi platform. The borrower has to create a smart contract that should touch upon the logic for borrowing, i.e., how the funds will be used. The smart contract will stipulate the desired amount, the type of operations, and repayment conditions.

  • Automated transaction – after the smart contract logic is executed, the DeFi lending platform transfers the requested loan amount to the borrower. The latter uses funds according to predefined operations, which may include trades, DeFi arbitrage, purchases, or sales aiming at generating a profit.

  • Repayment – in the same transaction, the smart contract repays the borrowed funds to the lender, typically with a fee that is usually about 0.09% if a profit is realized.

  • Verification and transaction completion – the lender verifies the balance received. If the repayment is insufficient, the transaction is automatically reversed as per the smart contract stipulations. If the loan and the small fee have been successfully returned within the same transaction, the loan is considered repaid, and the transaction is completed.

It’s worth noting that borrowers have to create the smart contracts themselves, which means they require some knowledge about programming on Ethereum.

 

DeFi Protocols Offering Flash Loans

The most popular DeFi platforms offering flash loans are Aave, dYdX, and Uniswap:

flash loan platforms

Flash Loan Use Cases

In only a few years, flash loans have emerged as a powerful tool in DeFi, offering several use cases. Here are the most popular of them:

  • Arbitrage – traders leverage flash loans to access liquidity and exploit price differences across different decentralized exchanges (DEXs). For example, if a token is valued at $1 on DEX A and $1.10 on DEX B, a flash loan can be taken out to buy low on DEX A and sell higher on the other exchange, immediately repaying the loan and remaining with the profit. MEV bots are used to initiate many arbitrage opportunities. 

  • Collateral swaps – flash loans facilitate the rapid replacement of collateral backing a traditional DeFi loan. A borrower who uses Ethereum as collateral on one platform can take out a flash loan to repay the initial loan, reclaim his ETH, and effectively switch the collateral used.

  • Debt refinancing – flash loans offer an option for ‘interest rate swaps.’ For example, a flash loan can be used to repay an existing debt on another DeFi platform, the collateral can be withdrawn and moved to a third platform to mint a new debt, potentially securing a more favorable interest rate.

By enabling tech-savvy traders to access large sums of crypto funds momentarily, flash loans open the door to strategies that can improve profitability and efficiency.

 

Flash Loan Safety: What Are Flash Loan Attacks?

Flash loans might sound too good to be true, but they are true indeed. But there is a catch: they come with some severe risks, and one of them is the flash loan attack, in which hackers or other malicious entities act as borrowers to trick the system, with lenders being potential victims.

The typical flash attack involves fake arbitrage conditions. Malicious actors artificially create arbitrage opportunities by purchasing tokens at a discount or selling them at inflated prices. The speed at which flash loan transactions occur makes these attacks difficult to detect and counteract, enabling attackers to target multiple markets at once.

Many attacks exploit contracts that calculate token values internally, leaving them open to arbitrage manipulation. To address such risks, DeFi protocols should rely on decentralized pricing oracles like Chainlink or Band Protocol for price feeds, but even that might leave loopholes.

Also, security measures can include specialized tools to detect unusual activity or contract exploits and audits of smart contracts before their deployment.

 

Examples of High-Profile Flash Loan Attacks

In March 2023, Ethereum-based DeFi lending protocol Euler Finance was hit by a flash loan attack depriving it of a whopping $200 million in crypto assets, including USDC, the wrapped token Bitcoin (wBTC), staked Ether (stETH), and DAI. The good news is that the hacker returned the funds after a few weeks.

However, that was an isolated happy ending. Most victims don’t get their funds back.

Earlier this year, Platypus Finance protocol lost over $8 million due to a flash loan attack that exploited a vulnerability in its staking function. It failed to check the hacker’s status before he managed to process a withdrawal.

Due to Euler and Platypus, flash loans were the most painful types of DeFi attacks in Q1 2023, even though exit scams were more frequent during the same period. 

flash loan attacks

Source: Certik

In 2022, hundreds of millions were lost due to these attacks.

Picture of Anatol Antonovici

Anatol Antonovici

6+ years of experience writing for crypto brands and blockchain firms, including Coindesk, Cointelegraph, Bitcoinist, CryptoPotato, Algorand, and OTCTrade.com

FAQs

Flash loans used to be available for tech-savvy traders, but now there are DeFi services that offer user-friendly options, such as Furucombo or DeFi Saver.

No – that’s the main point of flash loans. They are available without collateral and income proof.

Flash loans can last from seconds to minutes, and they are repaid in the same transaction.

Share the Post:

<Clever Newsletter Name>

Sign up now to receive crypto insights every Saturday morning.

Summary
What Are Flash Loans? Uncollateralized crypto loans repaid in a single transaction.
How Do Flash Loans Work? Use smart contracts for instant borrowing and repayment.
Flash Loan Use Cases Applications in arbitrage, collateral swaps, and debt refinancing.
Flash Loan Safety Risks of flash loan attacks and security measures.