See More

What Is a Flash Loan?

9 mins
Updated by Ryan Glenn
Join our Trading Community on Telegram

Flash loans or atomic loans offer the perfect tool to profit from arbitrage opportunities. Although the crypto flash loan concept is new, some platforms provide user-friendly interfaces and make the tool available to anyone. Here is a comprehensive guide on how flash loans work and how you can use them to your advantage.

Got something to say about flash loans or anything else? Write to us or join the discussion in our Telegram channel. You can also catch us on Tik TokFacebook, or Twitter.

What is a flash loan?

Jerome Powell Money Transfer

A flash loan is an uncollateralized loan you can take out that needs to be repaid before the transaction ends. Ethereum-based decentralized finance (DeFi) protocols offer these type of loans.

Flash loans are also known as atomic loans. We consider transactions atomic If the sequence of operations that make up a transaction are indivisible or irreducible. The atomic transaction must meet all conditions before the blockchain records it.

While the essence of cryptocurrency lies in the decentralized nature of the blockchain networks, decentralized exchanges only handle a small portion of the total trading volume for crypto assets. To make decentralized exchanges more accessible, the market could use more arbitrage trading, which can aid price discovery and liquidity.

One potential solution is flash loans, which allow arbitrage traders to make arbitrage profits and not risk their capital, making it more accessible.

Atomic loan origins

The Marble Protocol introduced the flash loan, or flash lending in 2019, on the Ethereum blockchain. The innovation is like a “smart bank” that allows users to take out zero-risk loans through a smart contract.

Marble created flash lending to combat the two risks taken by traditional lenders. The most obvious one is when the borrower takes the money and disappears. The second risk for a lender is illiquidity. If a lender lends too much of its assets at inappropriate times or fails to receive timely repayments, it could become unexpectedly insolvent and be unable to fulfill its obligations.

Atomic loans mitigate both risks. These loans work in the following way:

  • Getting loaned as much money, you need for one transaction
  • Repaying the lender at least the amount lent by the end of the transaction
  • If unable to pay the amount, the transaction is rolled back

Flash loans, or atomic loans, revert if you can’t successfully pay back the loan.

It’s important to understand that flash loans can only take place on a blockchain. Centralized exchanges cannot offer flash loans. That’s because smart contract platforms do not process transactions sequentially. On the other hand, a centralized exchange can have race conditions that could cause a leg of your order to fail to be filled. Blockchain ensures that your code is executed line by line.

Features of flash loans

Most individuals who have interacted with a traditional financial system before must have an idea of how a loan works. A lender loans money to a borrower, after which the borrower repays in full. The borrower owes the lender interest, which the borrower repays.

An atomic loan is useful for traders who want to profit from arbitrage opportunities in two different markets that are pricing a cryptocurrency differently.

The flash loan concept has no corresponding service in real life. Aave, an Ethereum lending platform, pioneered this idea in early 2020. Since atomic loans use smart contracts, they have these unique features:

  • Unsecured
  • Smart contract
  • Instant

Unsecured loan

Most lending protocols require borrowers to provide collateral to guarantee that the lender can still get their money back if the borrower is unable to repay the loan. An unsecured loan does not require collateral. The flash loan lender won’t lose its money if there is no collateral. It is just returned in a different manner. The borrower must pay the money immediately and not offer collateral.

Smart contracts

Smart contract create flash loans. These are bits of code programmed on the blockchain, which doesn’t allow transactions unless certain conditions are met. The rule for a flash loan is that the borrower must repay the loan before the transaction ends. Otherwise, flash loan smart contracts are designed to reverse the transaction.

/Related

More Articles

Instant

Obtaining a loan is a difficult task. A loan approval typically means that a borrower must repay the loan over several months or years. However, a crypto flash loan is immediate. The smart contract that authorizes the loan requires that the borrower uses and then pays back the loan in a single transaction. This means that the borrower must use other smart contracts to execute instant trades with the loan capital before the transaction on the blockchain ends. This is often a matter of a few seconds.

How do atomic loans work?

flash loan on Aave
A flash loan on Aave: Aave

Let’s take a closer look at how crypto flash loans work on a lending platform such as Aave, dYdX, bZX, DeFi Saver, Furucombo, and others.

The borrower asks for a flash loan on the Aave platform. To make it a profitable transaction, the borrower must devise a strategy for using the funds. Usually, individuals use these flash loans to profit from arbitrage opportunities present on decentralized exchanges. After the DEX trading is performed, the borrower must pay back the loan within the same transaction. There is also a service fee which the user pays to the lending platform.

However, note that if the funds aren’t repaid within the same transaction the funds are returned to the lender, and the transaction is retracted. These conditions indicate that the smart contract was not fulfilled. The smart contract protects both the lender and the borrower. That is why atomic loans are a low-risk, easy way to access liquidity.

It’s important to understand that to make a profit from using flash loans, the person initiating the flash loan has to have a solid understanding of Solidity, Ethereum’s programming language. As long as you don’t fall for flash loan scams, it could be a great way to make money.

Flash loans become popular rather quickly due to their nature, allowing borrowers to quickly make a profit. The most popular lending platform, Aave, offers the option to take out flash loans fairly easily.

However, flash loans in crypto are not without risk. As the attacks on them have demonstrated, there are risks.

Aave flash loans

aave loans

Aave is an open-source, non-custodial liquidity protocol that helps investors to earn interest on their crypto deposits and borrows various assets.

The Aave protocol is known for its options to earn passive income, allowing users to deposit liquidity to earn a passive income. You must first deposit your preferred asset to begin using the Aave protocol. You will receive passive income from the market’s borrowing demand once you have made deposits. At the same time, you can also borrow against your assets by depositing assets.

What’s attracting many new investors to Aave, is its flash loans offer, which has many advantages over traditional loans. Crypto flash-loan parameters allow for both collateral and debt to be swapped in one transaction.

To better understand the flash lending process, there are several Ethereum-related concepts we need to address. When we talk about an Ethereum transaction, we talk about commands that the Ethereum blockchain accepts.

One command could be as simple as sending 1 ETH. But it could also be something much more complex, that required the users to understand more advanced concepts. To interact with the blockchain, users can write codes for smart contracts that can interact with other existing smart contracts. We can only execute these smart contracts when certain conditions are met, according to their programming.

However, smart contracts are not perfect. Ethereum uses a distributed ledger to record all transactions sent and received throughout the network’s history. Acceptance of a transaction adds it to the ledger. The transaction is canceled if it is rejected.

How to get a flash loan

To get a flash loan in crypto on Aave, you require some coding skills. You might want to check out the flash loan documentation provided by Aave.

However, there are also user interfaces like that provided by Furucombo. This lets you use crypto flash loans without coding skills. The Furucombo app is still in its beta version, and it may offer some unexpected outcomes. Use it at your own risk.

Since flash loans are used for arbitrage, you need to find some price discrepancies on different DeFi exchanges before you set the conditions. This will also point you towards DEXs.

You can set up a flash loan using the Furucombo interface. Here is an example:

  1. Connect your wallet to Furucombo
  2. Create a cube (Create > New Cube > Uniswap Swap Token) and select the token to swap (you need to know the price discrepancy to decide which tokens to swap. It can be any DEX.) Click Set after you choose the swap and the amount.
  3. Create a cube (New Cube > 1Inch Swap Token). Select the opposite trade to the one you made in the first cube to get the same token back. You will need it to repay the flash loan. Click Set when all the details are set.
  4. Create a cube (New Cube > Aave Flashloan) and select the same token and amount you used to start the trade at the first cube. Click Set. You will get two boxes and will need to move the first one on top of the other boxes. The first transaction is the one to borrow the funds, and the last transaction is to repay the loan and the 0.09% interest.
  5. Click Approve, approved the transaction from your wallet.
  6. Click Confirm and confirm the transaction from your wallet.

Furucombo

The entire flash loan through Furucombo should look like this:

furucombo

Flash loans use cases

We’ve talked about the many upsides of flash lending. But there are a bunch of flash loan use cases that can provide benefits to investors. These are the most important use cases:

  • Collateral swapping
  • Arbitrage trading
  • Saving transaction fees
  • Debt refinancing

Collateral swapping

DeFi users can also use collateral exchanges to obtain loans through multi-collateral lending applications. If you have taken out a DAI loan from Compound and deposited ETH as collateral, you will need to trade the ETH collateral for DAI collateral via a DAI flash loan. This will balance the amount of the DAI you borrowed.

Arbitrage trading

Another interesting use of flash loans transactions is arbitrage. Crypto investors have many opportunities to make money from the price discrepancies between different markets. Crypto arbitrage is the process of performing trades on one or two different exchanges to make a profit.

Flash loan arbitrage is buying coins at lower prices and then selling them on another exchange at higher prices. They could also make quick profits and pay back the loan quickly. Effective arbitrage could be achieved by executing all transactions within a short time frame.

Savings transaction fee

Flash loan allows aggregating a list of complex transactions in one step. This is an improvement on traditional transactions, where implementing the flash loan concept would have required multiple steps. Flash loan transactions can be accessed with a minimal transaction fee. Flash loans can serve traders to purchase and sell digital tokens or coins.

Debt refinancing

When we think about loans, there is an interest rate associated with them. Investors can use flash loans not only for collateral swapping, but to swap the attached interest rate. Aave has an entire post dedicated to flash loans use cases. Here, debt refinancing is clearly described.

For instance, you can borrow funds from Aave’s liquidity pools. Then you can then pay the debt back on Compound.finance protocol, and withdraw collateral from Compound. You can deposit the collateral on dYdX, and you can mint debt on dYdX, before returning the liquidity on Aave.

Flash loan attacks: what are they?

Crypto bitcoin atm theft

As with any technology, flash loan smart contracts are subject to security risks, which are known as flash loan attacks. 

Because collateral is not necessary and the lending protocol entirely relies on smart contracts to ensure that you pay back the loan, what happens if that software begins to behave badly due to a bug? Intruders can manipulate the rules, and alter the agreement. The flash loan attack is often referred to as the exploitation of blockchain software, where the smart contract can be manipulated.

This might sound like an extreme and unlikely situation, but we have some examples of past flash loan attacks. Many of these flash loan attacks used the dYdX platform. In Jun. 2020, flash loans were used to exploit Balancer Pools, which resulted in a $500k wETH loss. In Apr. 2021, $24 million was extracted from the xToken platform, with the help of flash loans. Other flash loans exploits involve market manipulation by borrowing the same assets from multiple lending platforms and exploiting specific protocols and tokens.

What is the future of flash loans?

The flash loan concept is still in its infancy, and we will likely see it used for innovative purposes in the future. However, there are still many risks associated with flash loans, and some platforms have decided to act against them. For instance, some may use them to borrow specific tokens to participate in governance voting.

However, the benefit of using flash loans is bringing new investors into the market. With the development of ever more secure protocols, they have the potential for market efficiency and give everyone money for free.

< Previous In Series | Loans | Next In Series >

Frequently asked questions

What is a flash loan exploit?

Do flash loans still work?

Do you need collateral for a flash loan?

Top crypto platforms | April 2024

Trusted

Disclaimer

In line with the Trust Project guidelines, the educational content on this website is offered in good faith and for general information purposes only. BeInCrypto prioritizes providing high-quality information, taking the time to research and create informative content for readers. While partners may reward the company with commissions for placements in articles, these commissions do not influence the unbiased, honest, and helpful content creation process. Any action taken by the reader based on this information is strictly at their own risk. Please note that our Terms and Conditions, Privacy Policy, and Disclaimers have been updated.

d5befed13dbe8576a52cefa7288535d4?s=120&amp;d=mm&amp;r=g
Iulia Vasile
Iulia Vasile is a seasoned professional in the cryptocurrency and blockchain industry, working full-time in the field since 2017. With a background in computer engineering, she has the unique ability to write about complicated topics, including DeFi, NFTs, trading, and AI, in a way that is easy to understand. Iulia learned multiple programming languages while completing her Software Engineering degree in Bucharest at Politehnica University. Iulia brings her expertise and personal...
READ FULL BIO
Sponsored
Sponsored