DeFi: What are flash loans

Gianluca Busato
Venice Swap
Published in
7 min readMar 27, 2023

In the history of traditional finance, taking out a loan from a bank has always been accompanied by fairly cumbersome administrative procedures. The emergence of decentralized finance (DeFi) in recent years has allowed a number of innovations and alternatives to traditional finance, including making borrowing easier.

Indeed, today, thanks to smart contracts on the blockchain, there is no need to make a file to convince your banker of your solvency. Anyone can interact with a DeFi protocol and borrow a certain amount of money, in exchange for a collateral deposit. This is the idea behind DeFi lending. The rules of the loan and repayment are governed by the code in the blockchain.

DeFi has also seen the emergence of a new type of loan known as flash loans. First appearing in 2019, this type of loan allows borrowers to borrow without depositing collateral, with the borrowing and repayment occurring within the same transaction. We will see in the rest of the article that flash loans can be very useful for traders wishing to take advantage of arbitrage opportunities, but they also represent big risks for DeFi protocols, the site of many hacks.

DEXs: Buy certain types of crypto and participate in different parts of crypto ecosystems

How a loan works in traditional finance

In the world of traditional finance, there are 2 main types of loans:

  • Secured loans
  • Unsecured loans

In the case of secured loans, when you borrow, you agree to put a collateral (asset with value) in exchange for the amount borrowed. This collateral can be a bank account (pledge) or a property (mortgage) for example. It allows the lender to reduce its risk in the event that the borrower cannot repay the loan. If the borrower were to go bankrupt, the collateral would be seized by the lender.

In the case of unsecured loans, the lender trusts you. No collateral is required, but it is often necessary to provide evidence of creditworthiness in advance. To borrow from a bank, you must prepare a file containing a number of documents to prove the borrower’s good financial health.

People’s assets and People’s control: Decentralized Swaps

Traditional loan

In both cases, these loans often require heavy administrative procedures, which take a lot of time. That’s the whole point of decentralized finance loans (DeFi), which are revolutionizing the loan industry. With DeFi, there is no need to put together a file proving your financial health or your social status. Anyone can borrow, as long as they deposit collateral. Except in the somewhat special case of flash loans.

How a flash loan works in DeFi

A flash loan is a loan made on the blockchain thanks to a smart contract, which does not require collateral and which must be repaid within the same transaction. Initially, flash loans were implemented in DeFi in order to minimize the risks associated with traditional unsecured loans (risk of insolvency and risk that the borrower disappears without repaying). Flash loans actually work as smart contracts that meet the following conditions:

  • The borrower borrows a certain amount without collateral
  • The borrower pays back the same amount in the same transaction
  • If the borrower fails to repay, the transaction is canceled
  • Since the borrower has to repay the amount borrowed in the same transaction, flash loans only last a few seconds, hence their name.

Loans with DeFi

Become a borrower

It is possible to borrow and lend through the blockchain. But while this is simpler than borrowing from the bank, there are some constraints for this to work. Indeed, both parties must be covered. And since these are automated and anonymous contracts, there are conditions that must be met.

If you want to apply for a loan from your bank, you will have to provide a number of documents. You will have to indicate your marital status, your salary, your level of indebtedness… so that the bank can study this and grant you the loan or not.

None of this of course in DeFi. But for the lenders to have a guarantee, you will have to leave a deposit, also called “collateral”. This deposit will be higher than the amount requested. Put like that, it’s weird. At first glance, one might wonder why you would borrow less than what you leave as collateral. Especially since you will have to pay, as in a traditional loan, interest. But what you need to know is that the deposit is left in cryptocurrencies, and that you can get back against FIAT currency. Let’s say you think Bitcoin is going to explode in the next few days or weeks. You will be able to apply for a loan to get dollars by leaving Bitcoins as collateral. With those dollars, you can buy back Bitcoins, for example. And if the price of Bitcoin rises sharply, you will indeed benefit greatly and doubly.

Let’s take a concrete example. Bitcoin is at $50,000. You have two of them, which you leave as a deposit. Knowing that the deposit is $100,000, you will be able to borrow about $75,000. With this $75,000, you buy bitcoins (so 1.5 more bitcoins). If the price rises to $80,000, your 1.5 bitcoins bought with the loan are worth $120,000. So you can easily pay back the loan with interest, and still have plenty of profit. And the icing on the cake, the 2 bitcoins you left as a deposit and that you get back are now worth 160 000$. However, it is easy to understand that this little game is risky if bitcoin ever falls.

There may be other cases as well for investment purposes. For example, you mine Bitcoin and you have the funds to buy back equipment. You leave the bitcoins you have as collateral to buy back your equipment. As your equipment earns a return on your investment, you can liquidate your loan.

The liquidation of the collateral

We said that it was possible to borrow a certain amount of money, leaving more than what you borrowed as collateral. The idea is to secure the loan so that you have an interest in coming to repay it with interest. But what happens if the cryptocurrency you left as collateral sees its price drop? This is a very important point because it could cause you very bad surprises. At that point, if your loan is no longer covered by your collateral, the blockchain will sell your collateral to cover your loan. This is called liquidation. So you have to keep a close eye on the prices to see if your collateral is still in the clear, or else it will be sold.

Become a lender

It is also possible to become a lender. There, the advantage is to be able to count on an interest rate to make your cryptos work passively. These interest rates are not fixed, and depend on supply and demand. Depending on the platforms, you can also in addition to the rate touch tokens of this platform via their also rate.

For example, on the platform Aave, which is one of the references of the DeFi, you will touch in addition to the interests a percentage of the token also. This is also true if you are a lender, or if you are a borrower.

For example, AAVE homepage:

At the top left, you have the “market size”, i.e. the amount currently stored on the AAVE blockchain. This is important to know because the larger it is, the more likely it is that the project is serious and properly audited.

At the top right, you have different buttons allowing you to switch from one market to another (Ethereum protocol, Polygon, Avalanche…). This can be important because on the Ethereum network, the fees can be important.

And below, you have the different assets. For each one you will have its capitalization (market size), the total borrowed, the rate for a deposit (here 5.5% on the DAI, plus 1.11% in AAVE token), the rate for a loan (here 7.59% on the DAI, but you will get 1.38% in token)

You then have buttons to initiate a deposit or a loan.

It is possible to chain several actions together to increase your earnings (borrow to deposit, borrow again). This can be interesting, but it is complex to set up and you have to take all the parameters into account.

All these mechanisms are based on the blockchain and on smart contracts in particular. I invite you to click on each of these terms if you want to know more.

What’s the point of an investor borrowing money if they have to pay it back immediately?

In reality, although flash loans only run for a few seconds, there is still a lag time between the borrowing and the repayment, while the transactions are validated by the whole network. This lag time usually allows those using flash loans to deploy strategies to leverage the amounts borrowed.

Would you like to get into the decentralized finance world? Start with Venice Swap.

Source

--

--

Venice Swap
Venice Swap

Published in Venice Swap

Venice Swap will introduce two main applications in the market: a centralized crypto exchange to trade crypto-crypto and crypto-fiat and decentralized swap app for crypto-crypto trade

Gianluca Busato
Gianluca Busato

Written by Gianluca Busato

accepting challenges - tw @gianlucabusato