• defi decrypted
  • articles
  • 19 Dec 24

What are Flash Loans in DeFi?

Flash loans allow capital access without upfront assets, as long as repayment happens instantly. Used for arbitrage, swaps, and quick rebalancing.

0

Traditional loans have always been based on the idea that ‘You need to have money to borrow money.’ Until flash loans in crypto emerged, even DeFi could not move beyond this narrow worldview.

Before flash loans arrived, on a DeFi protocol, you were to deposit an over-collateralised crypto asset to borrow another crypto. At banks, an asset as collateral would fetch you <60% of its value if you jumped all the ‘eligibility’ hoops correctly.

DeFi lending platform Aave was the first to consider the idea of ‘exchanging’ one asset for another and labeling it as a ‘loan.’

A new loan system was born, and Aave called it flash loans. With flash loans, anyone could borrow an arbitrary sum, use it for arbitrage in crypto, and repay the original amount to the DeFi platform without any DeFi collateral.

The catch, however, was that the loan had to be returned in a matter of a few seconds or before the transaction got completed.

But are flash loans as straightforward as they appear? This article explains what flash loans are in DeFi, their benefits, risks, and popular flash loan platforms.

Understanding Flash Loans

Flash loans are instant crypto loans where the user borrows crypto assets and returns them within the same blockchain transaction. They are a unique feature of decentralised finance (DeFi) and are governed by smart contracts. These loans require zero collateral.

Historical Daily Flash Loan. Source: bankofcanada.ca
Historical Daily Flash Loan. Source: bankofcanada.ca

The first flash loan was conducted on January 17, 2020. It consisted of $33.10 worth of Dai.

Across the 11 EVM-compatible blockchains, nearly 24 million unique flash loan events, facilitating over US$3 trillion in lending activity as of January 2025, have been conducted since 2020.

These loans exist within the span of a single transaction. The borrower can access a large sum of capital until the blockchain block is verified and becomes a permanent part of the blockchain. The brief window the borrower has between transaction initiation and finalisation can be utilised to capitalise on earning opportunities, such as crypto arbitrage, collateral swapping, liquidations, and other types of leveraged positions across DeFi platforms.

These loans enable users to access on-chain liquidity pools without requiring collateral, provided a small gas fee is paid. The transaction is reverted if the borrower fails to repay the loan or if the repaid funds are insufficient. The revert also includes any subsequent actions the user takes using the borrowed sum. There are no default risks. However, such loans come with risks, such as smart contract risks and flash loan hacking risks.

The Technical Backbone of Flash Loans

DeFi lending and borrowing benefit from the decentralised, transparent, and instant on-chain transactions facilitated by blockchain technology and the permissionless composability that smart contracts offer.

For the uninitiated, smart contracts are self-executing contracts that can be coded with any set of predetermined terms, conditions, and information. Smart contracts are a key factor in the DeFi ecosystem's ability to offer innovative financial services, including flash loans, yield farming, staking, and liquidity mining.

It is through smart contracts that flash loan agreements are initiated, allowing borrowers to create leveraged positions using the borrowed capital and return it before the transaction completes.

How Do Flash Loans Work?

There are two parties involved in a flash loan--lenders and borrowers. These loans occur on decentralised exchanges (DEXs), such as Aave, Uniswap, or dYdX. Borrowers must interact with smart contracts to borrow and return loans to the lender.

Flash Loan Transaction. Source: MoonPay
Flash Loan Transaction. Source: MoonPay

Here’s a step-by-step process:

  • The borrower requests to borrow assets from a DeFi lender with flash loan support.
  • They then create a smart contract that codes the borrowing and repayment in a single transaction.
  • The borrower links his wallet to the platform and executes the contract
  • The flash loan provider or DEX transfers the requested amount
  • The borrower (user) uses a different set of smart contracts to execute an arbitrage, liquidation, or other DeFi operation using the borrowed funds.
  • The smart contracts return the funds to the provider as soon as the operations are complete. (with or without the borrowed assets)
  • The providers check their asset balance. If the returned funds are insufficient, the transaction is reversed immediately.

Why Flash Loans Must Be Instantaneous

All Ethereum transactions share a unique feature called atomicity. An atomic transaction is one in which either all or none of the operations in it occur. Flash loans are made possible because of these atomic swaps and transactions.

A typical flash loan transaction may involve:

  • Borrowing asset
  • Pay fee
  • Pay back the same borrowed amount

In case the borrower is unable to pay back the loan within the same transaction, any action taken using the borrowed amount gets voided as if it never existed. This feature, however limited, is what gives existence to flash loans.

Benefits of Using Flash Loans

Flash loans can provide millions of dollars in liquidity, transforming a user into a well-capitalised actor in the DeFi ecosystem for a brief period. Some more advantages that flash loans bring to users include:

  • Collateral-free loans: Borrowers are not required to provide collateral when borrowing funds.
  • Zero credit checks: Since these loans are permissionless and a product of DeFi, they do not require any traditional credit checks or underwriting.
  • Instant funds: Since such loans happen within the span of a single transaction, they provide funds instantly. Unlike conventional loans, which may take weeks and require extensive paperwork, these loans are coded as smart contracts, making the entire lending and repayment process autonomous.
  • Arbitrage: When two assets have different exchange rates in different markets, traders often capitalise on this market inefficiency. These loans can help traders leverage arbitrage opportunities to secure profits for themselves and restore market equilibrium. 75% of the flash loans had arbitrage as the motive.
Simple Flash Loan Triangular Arbitrage
Simple Flash Loan Triangular Arbitrage
  • Liquidations: Third-party liquidators use flash loans to liquidate loans that fail to meet the collateral requirement and keep the protocol solvent.
  • Collateral Swaps: These swaps are useful when a borrower uses the loaned capital to close one loan and immediately open the second loan with a different asset. This arrangement is useful for facilitating loan transfers between protocols.

Flash Loans Attacks (Risks)

  • Price Slippage: Price slippage is common when the loan involves a large sum of assets. Price slippage may result in a greater cost burden for the borrower, and they may be unable to repay the loan within the stipulated timeframe.
  • Smart Contract Vulnerabilities: Unless the smart code of the protocol has undergone DeFi security audits, there’s a greater chance that a bug or smart contract vulnerability during a flash loan may lead to loss of funds.
  • Gas Fees: Ethereum has been notorious for congestion and spikes in gas fees. Since such a loan involves multiple transactions, the combined gas fee may outweigh the profits an intended flash loan event may bring.
  • Market Manipulation: Bad actors may use these loans to manipulate markets. They can also exploit any vulnerabilities or arbitrage opportunities that may negatively impact the rest of the market participants.
  • Liquidation Risks: Price manipulation or any other kind of flash loan attack can trigger liquidations, and the assets used as collateral may start losing value.

OpenZeppelin shares best practices for securing smart contracts in DeFi protocols. The legal perspectives on flash loans vary widely.

Popular Platforms Offering Flash Loans

Aave

Aave is the largest lending and borrowing protocol on the Ethereum network. Users can access Aave flash loans through a web interface or directly using the protocol. The gas fee charged for such loans on Aave V2 is 0.07%, and on Aave V3, it is 0.05%.

dYdX

DEX dYdX enables users to leverage lending and borrowing, margin trading, and flash loans. It also offers highly liquid pools and advanced financial tools to help traders develop effective strategies.

Uniswap

Both Uniswap V2 and V3 offer flash loans. Any user can request an arbitrary amount of tokens as Uniswap loans, and the liquidity pools grant that. The crypto loans must be returned in the same transaction.

Common Misconceptions

Flash Loans are Only for Professionals

Anyone who knows how to write a smart contract and interact with a DeFi protocol can conduct a flash loan.

They are Illegal or Unethical

Malicious actors can use such loans to manipulate prices and facilitate other illegal activities, causing a loss of funds. But these loans are just a tool, which, if placed in the right hands, can be a great earning opportunity, and in bad hands, can cause liquidations, losses, and exploits.

Flash Loans are Risk-Free

No, these loans aren’t risk-free. We discussed the risks associated with such loans earlier in the article. However, flash loans can be considered zero-default risk loans, characterized by a maturity period of zero, no collateral requirements, and no limit on the loan size.

Conclusion

Flash loans are a fresh take on borrowing and lending rationale inherent in the conventional systems and carried forward as a legacy by DeFi, too. They can turn a pauper to a prince if used rightly. However, we must recognise the associated risks and vulnerabilities that accompany such loans.

Comment down below what you think about such instant loans in DeFi. Head over to NFT.EU to read more such interesting articles!

FAQs

What is a flash loan and how does it work?

Flash loan is a type of loan in DeFi that lets you borrow money from lenders without collateral. However, they require you to repay the loan within the same transaction, meaning that they are typically conducted instantaneously.

Are Flash Loans Beneficial or Risky?

Flash loans come with numerous benefits, such as being collateral-free, not requiring credit checks, opening arbitrage opportunities, and more. However, there are a few risks associated with them, such as price slippage, smart contract vulnerabilities, and liquidation risks.

Is it Possible to Profit from Flash Loans?

Yes, with adequate planning and enough research, you can create a smart contract that will allow you to make gains using flash loans.

Who is Eligible to Take Out a Flash Loan?

Flash loans are available to everyone, be they a professional trader or a beginner. As long as you are aware of how they work and the terms and requirements you need to meet, you can use them regardless of your experience, funds, or other factors.

0

Comments

0