Flash loans: how to borrow cryptocurrency without collateral

In 2017–2018, the first cryptocurrency lending protocols emerged, including ETHLend (now Aave) and Compound. Initially, these protocols only offered collateralized crypto loans. To obtain a loan, users had to deposit a minimum amount of cryptocurrency as collateral.
Offering uncollateralized loans would have been too risky given the nature of DeFi. However, developers managed to introduce the concept of flash loans, which makes it possible to provide short-term cryptocurrency loans without exposing lenders to unnecessary risks.
What is a flash loan in cryptocurrency?
A flash loan is a short-term, uncollateralized cryptocurrency loan that must be repaid by the borrower, along with any applicable fees and interest, within a single blockchain transaction.
The concept of flash loans in crypto first emerged in 2018 and was introduced by the developers of Marble Protocol. The protocol operated as a "smart contract bank" on the Ethereum blockchain and enabled transactions involving flash loans.
Despite its innovative nature, the flash loan concept did not gain widespread adoption in DeFi at the time. Instead, it remained a niche solution used by a relatively small group of traders.
However, the situation changed in early 2020, during the DeFi boom. The popular Aave V1 protocol introduced the flash loan feature, after which flash loans began to be widely used for cryptocurrency arbitrage* and other DeFi operations.
* Cryptocurrency arbitrage is a trading strategy that involves profiting from price differences for the same crypto asset across different exchanges or trading platforms. For example, a trader may buy cryptocurrency at a lower price on one exchange and sell it at a higher price on another.
How do flash loans Work in DeFi?
The flash loan mechanism relies on the principle of blockchain atomicity*. This means that borrowing cryptocurrency without collateral is possible only under one strict condition: the entire flash loan amount, including applicable fees and interest, must be repaid before the transaction is completed.
* Atomicity is a principle of blockchain transactions whereby all actions included in an operation must either be executed successfully or canceled entirely. If even one required condition is not met, the entire transaction is reverted, and any changes to the blockchain state are rolled back.
If the atomicity condition is not met and the borrower fails to repay the required flash loan amount, the smart contract automatically reverts the entire operation. This may happen, for example, when an arbitrage trade is unsuccessful and the trader fails to generate the expected profit.
What are flash loans used for?
Due to their specific characteristics, flash loans are unsuitable for long-term transactions because the borrowed funds must be repaid almost immediately. However, there are several practical applications for flash loans in cryptocurrency.
One of the most common uses of flash loans in DeFi is cryptocurrency arbitrage, a trading strategy in which traders profit from differences in the price of the same asset across trading platforms. For example, a trader may take out a flash loan in stablecoins to purchase cryptocurrency on one platform and subsequently sell it on another. If the profit from the trade exceeds the fees and interest paid on the flash loan, the trader earns a profit.
Another application of flash loans in DeFi is collateral swapping on an existing loan. For example, if a borrower initially used ETH as collateral but decides to replace it with another cryptocurrency, they can do so using a flash loan.
To accomplish this, the borrower takes out a flash loan, repays the outstanding debt, and releases the collateralized ETH. They then exchange the ETH for another crypto asset, deposit it as new collateral, and obtain a new loan to repay the flash loan. All these operations take place within a single transaction, allowing the borrower to replace collateral without having to repay the original loan using their own funds.
Another use case for flash loans is loan refinancing. For example, if the interest rate on a borrower's existing loan increases, they can use a flash loan to transfer their collateral to another lending platform offering a lower interest rate, thereby reducing their borrowing costs.
In addition, flash loans can be used to avoid penalties associated with the forced liquidation of a lending position. For example, if the value of cryptocurrency provided as collateral drops sharply, the borrower's position may be at risk of liquidation.
In this situation, the borrower can use a flash loan to repay the outstanding debt and recover the collateral before liquidation occurs. They can then sell part of the released assets to repay the flash loan, retaining the remaining funds and avoiding additional costs associated with forced liquidation.
Advantages of flash loans in cryptocurrency
The absence of collateral requirements is the main advantage of flash loans in crypto. Flash loans allow arbitrage traders to profit from trading opportunities without putting their own crypto assets at risk as collateral. If a trade is unsuccessful, the transaction is simply reverted as though it had never taken place.
Flash loans also allow traders to work with large amounts of capital and potentially generate greater profits while holding only a small amount of cryptocurrency in their wallets to cover network transaction fees.
This can make flash loans in cryptocurrency a safer alternative in certain respects to margin trading with leverage*, where traders risk losing their entire investment.
* Leverage is a financial mechanism that allows traders to open positions larger than their available capital by using borrowed funds. For example, with 10x leverage, a trader with $100 of their own capital can open a position worth $1,000.
When using flash loans, borrowers also avoid the risk of liquidation and forced closure of collateralized lending positions, which can result in the loss of pledged assets if the borrower cannot repay the debt.
Risks of flash loans
The flash loan mechanism is actively exploited by hackers, particularly to manipulate price oracles*. Attackers can use funds obtained through flash loans to execute large trades in small liquidity pools on decentralized exchanges, causing the price of a low-market-cap cryptocurrency to rise or fall sharply.
* An oracle is a service or software mechanism that provides smart contracts with information from external sources that is not directly available on the blockchain. For example, price oracles supply DeFi protocols with up-to-date cryptocurrency exchange rates needed to calculate collateral values, issue loans, and liquidate positions. If an oracle relies on inaccurate or manipulable data, it can lead to incorrect smart contract execution and financial losses.
According to a study published in the Journal of Financial Crime, attackers carried out more than 70 successful attacks involving flash loans between 2020 and 2024. The total losses resulting from these attacks exceeded $1.2 billion.
DeFi protocols may become vulnerable to flashloan attacks if they obtain cryptocurrency price data from unreliable oracles or contain flaws in their smart contract logic. According to experts at Chainalysis, the combination of these factors is particularly dangerous for protocols and their users.
These vulnerabilities are clearly illustrated by the incident involving Cream Finance, which became one of the largest exploits involving flash loans in DeFi. The flash loan attack resulted in losses of approximately $130 million for the protocol.
Another risk is flash loan front-running*. If malicious actors identify a profitable transaction in the mempool, they may attempt to get ahead of it by submitting a similar transaction with a higher fee.
By offering a higher transaction fee, attackers may be able to have their transaction executed first, potentially depriving the original trader of the expected profit.
* Front-running is the practice of executing a transaction ahead of another participant's transaction to gain a financial advantage. On a blockchain, front-running may occur when a network participant identifies a pending trade in the mempool and submits their own transaction in an attempt to have it executed first. For example, an attacker may purchase cryptocurrency before another trader's large buy order, benefit from the resulting price increase, and then sell the asset at a higher price. Higher transaction fees and specialized MEV mechanisms may be used to influence transaction execution order.
