#1 TOKENIZATION PLATFORM

What are DeFi flash loans? How does it work?

Flash loans are one of the best use cases of DeFi or Decentralized Finance. In simple words, it is a type of loan facilitated by crypto instruments to enable instant loans without the need for the lender to submit any collaterals. In this article, we will explain the concepts of DeFi flash loans,  how they work, and some of their popular use cases. 

If you’d like to brush up your knowledge on DeFi you can refer to this article – Decentralized Finance – DeFi use cases, products. Here, we’ll help you gain better insights into the below topics:

What are DeFi flash loans?

A DeFi flash loan is a form of uncollateralized lending that works using Ethereum-based decentralized finance protocols. DeFi flash loans make use of smart contracts, which run on blockchain-enabled mechanisms that prevent funds from changing hands until certain conditions are fulfilled. In the case of a DeFi flash loan, the rule is that the borrower must repay the debt before the transaction is completed; otherwise, the smart contract reserves the payment as if it never occurred. 

Difference between secured and unsecured loans

In the finance industry, there are generally two primary forms of loans- secured and unsecured loans. Unsecured loans refer to loans where the borrower do not need to provide any sort of collateral to the lender during transactions. Some banks give access to these loans after checking the borrower’s financial records.

A secured loan would ask a borrower to put down some type of collateral before allowing them to borrow money. This collateral could be anything that is considered valuable like jewelry, real estate, etc. One of the primary reasons for this is that when you default on your promise to pay, the institution takes the collateral automatically. This measure enables the lender to recover the borrowed fund. In a secured loan, the lender may subject the borrower to the following:

  • Evaluating the borrower for credible business experience
  • Blueprint of how the money is expected to be spent
  • Submission of business plan
  • Submission of some detailed personal information
  • Collaterals

In order to borrow funds in certain DeFi platforms like Compound or Maker, users need to provide collateral. These loans are usually over-collateralized. This means that the borrower needs to provide assets that are worth more than their debt. This provides the lenders with a guarantee that borrowers will be able to repay their loan, as there are no credit ratings in DeFi. Secured loans also help avoid the uncertainty of trading with volatile cryptocurrencies.

How do DeFi flash loans work? 

A DeFi customer can borrow cryptocurrencies without laying down any collateral by taking a DeFi flash loan. Most platforms employ smart contracts to enforce these loans. The loan terms and conditions are programmed into these smart contracts to allow users to repay the loan in the same transaction until the Ethereum blockchain changes the user’s account balances.

The deal would collapse if they do not repay. Another main feature of a flash loan is that it operates on an open-source protocol. Such loans have no third party or middleman in control of your funds. Flash loans promote financial accessibility to a large extent as everyone is able to access them. You can also transact with strangers from all over the world. In addition to all this, you don’t have to disclose any personal information either. 

Many would assume that such loans would be very short-term, which would mean that they won’t be very useful in the long run. Contrary to this, many flash loans provide DeFi users with great long term gains, depending on what they can do with the loan in a single purchase.

To understand this better, consider a dex trade where you use uncollateralized DeFi capital. The processes involved are executed very quickly and efficiently so that there isn’t a great risk of fund loss. Here, you can use your assets to drop the price of a particular cryptocurrency across markets. This will trigger DeFi apps with oracles to sell at the desired spot price. DeFi apps like Bzx, Dydx, and Compound use price oracles to determine the prices across various decentralized exchanges (DEX) like Kyber’s Uniswap.

The pricing information mostly has huge discrepancies across exchanges, which allow for market anomalies like slippage and arbitrage. The speed of a flash loan’s execution is so fast because the loan, trade, settlement, and profits are executed simultaneously in a single transaction. The individual who performed the first massively sized flash loan against Bzx simply borrowed funds from the DeFi platform’s smart contract without any collateral and they were able to pay the loan back in a single transaction. In essence, the user bought low on one market and sold high on another. This allowed them to pay the borrowed loans back and keep the profit.

Need help with DeFi implementation?

Reach out to us today and get started!

Reach out

The role of smart contracts in DeFi flash loans

If you want to properly understand flash loans, you will need to look into what a smart contract is. This is because these contracts are the applications upon which DeFi runs. Smart contracts are essentially a computer application that runs on a blockchain as a self-executing computer program. It automatically executes when certain rules are fulfilled. Smart contracts run on blockchain precisely as they are programmed, without any chance of censorship, downtime, fraud, or third-party interference. 

One of the prominent concepts in flash loans is RUP (Receive Use and Pay) according to some predetermined rules. The rules of smart contract ensure that the process of receiving, use, and payback must complete in the same transaction. If the transaction fails to complete demand by the system programmed set-off, security measures are activated. The security measure is that the network will automatically turn down the transaction. By this, the funds return to the lender. This is why most flash loans do not need collateral during transactions. The system is designed to make sure that the lenders’ funds are secure

Are DeFi flash loans risky?

Since many people are concerned about cyber security when it comes to flash loans, it is reasonable to ask whether flash loans are risky or not. Many hackers are capable of breaking into the system and instantaneously borrowing thousands of dollars of ETH. They often prey on vulnerable on-chain protocols and extract millions of dollars in stolen assets. After this, they pay their ETH loans back anonymously, which makes it impossible for authorities to trace them. For example, the lending platform Bzx saw $954,000 siphoned from two flash loans.This sends a very bad message to the crypto community, implying that flash loans are subject to malicious attacks from hackers.

In light of the above incident, the bZx team has put in great effort to secure the network and prevent future attacks. The firm already implements a check that will disallow even over-collateralized loans in the future. It has already put a cap on maximum trade sizes so as to limit the scope of potential attacks. It will also be implementing a Chainlink oracle to supplement Kyber’s price feed to be able to get correct price info at any given time.

Use cases of DeFi flash loans

  • Arbitrage: Individuals can use price differences between markets to make money. This process is called arbitrage. With flash loans, individuals can use a great amount of liquidity to arbitrage between multiple decentralized exchanges. Assume a DAI/USDC trades at a 1:1 ratio on Uniswap, but you can buy 1 USDC for 0.99 DAI on Curve Finance. On Curve Finance, a trader who borrows 10,000 DAI will sell it for 10,101 USDC. They will then exchange them for DAI at a 1:1 ratio on Uniswap, repaying the 10,000 DAI loan and pocketing the 101 DAI gap. Arbitrage provides a mechanism to ensure prices do not deviate substantially from fair value for long periods of time. 
  • Collateral swaps: Collateral exchanges enable DeFi consumers to access loans from a multi-collateral lending app. For example, suppose you borrowed Dai from Compound and put Ethereum up as collateral. You will exchange the Ether collateral for Dai collateral by taking a Dai flash loan to offset the Dai borrowed.
  • Debt refinance: Assume that you have taken a debt from Compound at a 10% interest rate. However, another protocol offers debt at 5%. In such scenarios, you can refinance your debt at 5% without any collateral by following these steps- 
      1. Borrow the flash loan from Aave protocol 
      2. Pay your debt on the compound protocol
      3. Borrow on 2nd protocol at 5% protocol
      4. Payback your flash loan

What’s the future of DeFi flash loans? 

DeFi campaigns are gaining momentum as people become more accustomed to the world of modern banking. The concept of flash loans is still emerging, and given its success, they are going to rise in popularity as the years pass on. However, despite this, there have been a few hiccups along the way that imply that the flash loan concept still needs to be reworked and improved upon to prevent misuse and malicious activity.

To know how to launch a DeFi project, refer to this article – How to launch a DeFi project


Need help with DeFi implementation?

Reach out to us today and get started!

Reach out

Author

Rahul A R is a technologist and full stack developer who specializes in Blockchain technologies and Cryptocurrencies. Though he’s worked within numerous privacy and security sectors, Rahul’s recent emphasis has been on solutions built on Ethereum, Tezos, smart contracts, and smart signatures, in particular, decentralized self-sovereign identity. He’s Helped clients, from start-ups to Fortune 500 companies, across North America and Asia, develop their blockchain strategy and build several decentralized applications using blockchains and smart contracts.

Get Started

ICOs and STOs are disrupting the business finance realm. Wait no more, reach out to us today to discuss how to launch an ICO or STO for your project.