Decentralized finance on Ethereum has created a new monetary paradigm. Ethereum's smart contract mechanism laid the foundation for a nearly limitless open system, spawning groundbreaking innovations. This approach makes DeFi very different from anything else in the traditional financial world. And among the most discussed innovations in the crypto space today, flash loans are of great importance.

In DeFi, a flash loan is a type of loan that does not require a guarantee or collateral but should be repaid in one transaction block. At first glance, the benefits of a loan, in which the borrowed money must be repaid after a few moments, may seem weak. But this hypothesis is refuted by the fact that the blockchain is programmable, which means that instructions can be encoded into a smart contract.

In this article, we will examine the basic principles of flash loans, including why people use them, how they work, and their advantages and disadvantages. We will also explore what a flash loan attack is and how to prevent one.

What is a Flash Loan?

A flash loan is a type of loan that is taken out and repaid within the same transaction. This stands in contrast to a traditional loan, which can take days or weeks to process.

Flash loans are extremely powerful as they provide leverage for any transaction that can be executed on the blockchain. The most common application is arbitrage. The essence of arbitrage is buying an asset in one market and immediately selling it in another for a higher price, thus earning a profit.

Arbitrage opportunities are often found between exchanges that offer different prices for the same asset. For example, let's say you find that Asset X is being sold for $100 on Exchange A and $105 on Exchange B. You could buy Asset X on Exchange A with flash loaned ETH, then sell it immediately on Exchange B.

With a flash loan, you can do this all in one transaction. You borrow ETH from a flash loan provider, buy ETH on the first exchange, and then sell it immediately on the second exchange. When the transaction is complete, you repay the flash loan and keep the difference in price as your profit.

How Does a Flash Loan Work?

To understand how a flash loan works, it is first essential to understand how a traditional loan works. With a traditional loan, you would go to a bank or other financial institution and apply for a loan. The bank would then review your application and, if approved, deposit the loan amount into your account. You would then have a certain period of time to repay the loan, plus interest. If you failed to repay the loan, the bank could take legal action against you and potentially seize your assets.

With a flash loan, there is no need for a bank or other financial institution. A smart contract on the blockchain provides the loan. You must return the money within a single transaction, which usually takes a couple of seconds. Once the transaction is complete, you must repay the loan amount plus interest.

The key difference between an ordinary crypto loan and a flash loan is that you have to repay the loan amount within the same transaction with the latest. This means that if you take out a flash loan of 100 ETH, you must repay 100 ETH within the same transaction. If you do not, the smart contract will automatically take back the ETH and send it to the flash loan provider.

What makes Flash Loans unique?

There are 3 features of flash loans that make them unique.

Smart contracts

Some unique features make quick loans more attractive to both the borrower and the lender, most notably the use of smart contracts. Smart contracts are computer protocols that facilitate, verify or enforce the negotiation or performance of a contract, eliminating the need for a third party.

This means that flash loans can be processed and completed without needing a bank or other financial institution. Using smart contracts also reduces the risk of fraud and creates a more efficient process.

Instantaneous transactions

Another key feature of flash loans is that they are taken out and repaid in the same transaction. This means there is no need to wait for a bank to process the loan, which can take days or even weeks.

The instantaneous nature of flash loans also makes them well-suited for trades. For example, a flash loan can be used to buy an asset before selling it immediately for a profit. This is possible because the loan is repaid in the same transaction.

Unsecured Loans

Flash loans are unsecured, so they do not require collateral. In traditional lending, lenders require borrowers to have collateral to issue loans, and if they fail to meet the loan terms, the lender can still get his money back using the collateral.

Unsecured loans are riskier for the lender, but they offer several benefits for the borrower. First, unsecured loans are easier to obtain because the borrower does not need to put up collateral. Second, unsecured loans often have lower interest rates because the lender is taking on more risk. However, it doesn’t mean that in the case of unsecured loans the lender will not return his money; the transaction will simply be cancelled if the user can’t return the funds.

Why Do People Use Flash Loans?

There are a few reasons why people use flash loans.

  • The first is that flash loans offer a great deal of flexibility. This is because they can be used for any purpose, including trading and lending.
  • The second reason is that flash loans often take advantage of arbitrage opportunities. Arbitration is the process of taking advantage of a price difference between two exchanges. For example, let's say that Ethereum is trading for $200 on one exchange and $210 on another. A flash loan can be used to buy Ethereum on the first exchange and then immediately sell it on the second exchange for a profit.

Advantages and disadvantages of Flash Loans

Flash loans have a few advantages and disadvantages that should be considered.


  • Security. A person should return the money borrowed; otherwise, the transaction will be canceled, and he will pay a commission to the blockchain.
  • Maximising profit. Flash loans can be used to take advantage of arbitrage opportunities, allowing users to maximize their income.
  • Instantaneous. Flash loans are fast. This means that there is no need to wait for a third party, such as a bank, to process the loan.
  • Don’t require collateral. Another advantage of flash loans is that they often don't require collateral. This is because the flash loan smart contract requires collateral before releasing the desired amount of cryptocurrency.


  • The main disadvantage of flash loans is high entry barriers. Flash loans may not be available to anyone who wants to use them, as most sites require coding skills, and in many cases, only developers can benefit.
  • Another disadvantage is that flash loans are often used for speculative purposes. This means they can be used for arbitrage purposes, leading to losses.
  • Flash loans often have a fee for using collateral. For instance, one of the most popular lending platforms - Aave - requires the borrower to repay the borrowed amount with an additional 0.09% of the total borrowed amount as a fee. This commission is then distributed between the lenders and the platform.
  • As the flash loan is a developing product, some risk is still associated with using it, for instance, platform vulnerabilities.

What is a Flash Loan Attack?

A flash loan attack is a type of attack that can be used to exploit the flash loan smart contract. Typically, these attacks are complex, multi-step processes performed by very experienced DeFi users. In many cases, they are related to the depletion of the liquidity pools that ordinary users have invested in, causing many people to suffer significant losses.

Example of a Flash Loan attack:

In September 2020, the platform PancakeBunny was used to exploit a flash loan of $150 million worth of Ethereum. The attacker took out a flash loan from the Aave protocol and then used this money to buy up a large number of tokens from the PancakeSwap liquidity pool. The price of Bunny tokens increased, and the attacker was able to sell their tokens back to the liquidity pool for a profit.

The flash loan attack on PancakeBunny caused many users to lose money, and it also resulted in the loss of $30 million worth of Ethereum from the Aave protocol. Moreover, the attack repeated in 2021 with even more loses. These attacks highlight the risks associated with flash loans and the need for users to be very careful when taking out flash loans.

How Does a Flash Loan Attack Work?

A flash loan attack typically works by the attacker borrowing a large amount of cryptocurrency from a flash loan smart contract. The attacker then uses this money to buy up a large number of tokens from a particular liquidity pool. This causes the price of the tokens to increase, and the attacker can then sell their tokens back to the liquidity pool for a profit.

The flash loan attack can also be used to exploit other DeFi protocols. For example, the attacker could use flash loans to buy up a large number of tokens from a particular protocol and then sell them back to the protocol at a higher price. This would cause the protocol to suffer losses and potentially collapse.


Flash loans are a powerful innovation in the crypto space thanks to Ethereum and the innovative protocols built on top of it. They offer great flexibility and can be used for various purposes. However, it is crucial to understand the risks involved before taking out a flash loan. Since flash loans came to the fore in 2020, they have been the cause of many large-scale DeFi attacks. Thus, it is essential to know the potential dangers before using flash loans.