follow us on twitter . like us on facebook . follow us on instagram . subscribe to our youtube channel . announcements on telegram channel . ask urgent question ONLY . Subscribe to our reddit . Altcoins Talks Shop Shop


This is an Ad. Advertised sites are not endorsement by our Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise Here

Author Topic: ViaWallet|What Are Flash Loans  (Read 2346 times)

Offline CoinEx

  • Full Member
  • *
  • Activity: 201
  • points:
    8989
  • Karma: 5
  • Trade Count: (0)
  • Referrals: 0
  • Last Active: April 20, 2023, 08:06:36 PM
    • View Profile

  • Total Badges: 9
    Badges: (View All)
    Second year Anniversary One year Anniversary 100 Posts
ViaWallet|What Are Flash Loans
« on: November 18, 2022, 07:12:32 PM »
Recently, Supremacy, a blockchain security team, tweeted that the contract of DeFi investment management tool Earning. Farm suffered a flash loan attack, through which MEV bots earned 480 ETH and the hacker made a profit of 268 ETH.

Though veteran DeFi users are very familiar with flash loans, the term could be confusing for many crypto beginners. In this article, we will focus on flash loans and help new crypto users understand these loans that are unique to the crypto space.


Types of loans

We are all familiar with loans in everyday life. There are two types of typical loans: secured loans and unsecured loans. For example, if someone needs funds to start a business, he can apply for a loan to a bank with his property as collateral. The borrower will still own the property once the loan is repaid. However, if he fails to repay the loan when it becomes due, the bank will be entitled to take away his property.

Unsecured loans, also called credit loans, including the credit cards that we use when shopping in a mall. As such loans are unsecured, the bank will check your credit records and cash flow when you apply for a credit card to make sure that you’ll be able to repay the loans.

In DeFi, lending is also one of the most frequent use cases. In our previous article ViaWallet|What is Decentralized Lending, we elaborated on the most common over-collateralized loans in decentralized lending. In addition to secured loans, decentralized lending also offers unsecured loans called flash loans, which are our focus today.

Flash loans explained

Simply put, flash loans describe a process of borrowing and repaying loans in the same block. In the case of Ethereum, we should first make it clear that a block can accommodate multiple transactions, and one transaction can involve many steps. As shown in the picture below, this particular transaction involves 24 transfer records.



This means that we can include the following steps in one transaction: Borrow a loan, spend the loaned funds on something, and repay the loan. Unlike regular interactions, these steps must be put into a transaction through programming in the specified order. Once the last step (repaying the loan) is completed, the steps will be packaged into the transaction and uploaded onto the blockchain. Meanwhile, if the steps included even one error (e.g. the loan was not repaid), then the whole transaction would be rolled back, and the transaction would fail.

Therefore, in this case, the flash loan provider does not worry about the borrower’s ability to repay, and it only needs to adjust the contract so that the borrower must repay the loan within the same transaction. In this way, the loan will be revoked automatically if it is not repaid. Since all records will be rolled back, there is no risk of default.

Use cases of flash loans

Now that you know how flash loans work, you might ask a new question: what’s the use of flash loans if they can be instantly borrowed and repaid? In fact, flash loans have a lot of use cases. Most typically, flash loans are used for arbitrage.

To veteran traders, arbitrage is nothing new. It refers to the process of buying low on one exchange and selling high on another when there is a price gap between the two exchanges. The more funds you’ve got, the more arbitrage opportunities there will be, and the larger the arbitrage profit. In this context, flash loans provide users access to massive funds.

Suppose you could now swap 1 USDC for 1.01 USDT on UniSwap and exchange 1 USDT for 1 USDC on Curve. You could then borrow 100,000 USDC through a flash loan and sell the borrowed crypto on UniSwap to get 101,000 USDT. Then, you could trade the USDT for 101,000 USDC. Finally, you repay the 100,000 USDC flash loan, which means that you would get 1,000 USDC without paying a dime.

Of course, the above case is merely an example, and arbitrage through flash loans involves much more complicated operations. To start with, flash loan providers charge a certain fee. Moreover, large transactions often come with significant slippages, in which case you wouldn’t be able to swap cryptos at the current price. As such, real-world arbitrage through flash loans is more subtle and involves more accurate timing. In addition to arbitrage, flash loans are also used for liquidation. For instance, some users conduct self-liquidation through flash loans to reduce the cost of liquidation.

Flash loans can also be exploited by hackers to launch flash loan attacks, which refer to the process of earning huge profits by manipulating the crypto prices using massive funds. Such behaviors often cause losses to other users, and are thus regarded as malicious attacks.

For example, suppose a hacker borrowed 10,000 ETH through a flash loan to attack a DeFi protocol that allows him to swap 1 ETH for 1,500 USDT. He would first convert all the ETH borrowed into USDC. At this point, the ETH price would plummet due to the large order, and 1 ETH can now only be swapped for 750 USDC, allowing the hacker to make a profit of 11,250,000 USDT (as the AMM algorithm and the K value are both uncertain, the figure is for reference only and does not reflect actual price changes). Subsequently, the hacker borrows cryptos on the same platforms. At the current swap rate (1 ETH: 750 USDC), according to the collateral ratio of 75%, he could borrow 11,250 ETH with his USDC holding, which means that the hacker would get 1,250 ETH after he pays off the flash loan. While the hacker made a huge windfall, he also brought an enormous impact on the market prices.

Controversial as flash loans are, most people believe that hackers could still pull off similar attacks using massive funds even without flash loans because such attacks exploit the flaws of the oracle mechanism of the relevant protocols. Flash loans, a type of loans unique to DeFi, are undoubtedly innovative. As a typical case of code execution, these loans might inspire new ways to design financial products in the future.

Altcoins Talks - Cryptocurrency Forum

ViaWallet|What Are Flash Loans
« on: November 18, 2022, 07:12:32 PM »

This is an Ad. Advertised sites are not endorsement by our Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise Here


Offline LazyMadis

  • 1st Step
  • *
  • Activity: 3
  • points:
    187
  • Karma: -1
  • Trade Count: (0)
  • Referrals: 0
  • Last Active: January 04, 2023, 05:33:28 PM
    • View Profile

  • Total Badges: 2
    Badges: (View All)
    One year Anniversary First Post
Re: ViaWallet|What Are Flash Loans
« Reply #1 on: January 04, 2023, 05:24:37 PM »
Thank you for sharing this  ;)

 

ETH & ERC20 Tokens Donations: 0x2143F7146F0AadC0F9d85ea98F23273Da0e002Ab
BNB & BEP20 Tokens Donations: 0xcbDAB774B5659cB905d4db5487F9e2057b96147F
BTC Donations: bc1qjf99wr3dz9jn9fr43q28x0r50zeyxewcq8swng
BTC Tips for Moderators: 1Pz1S3d4Aiq7QE4m3MmuoUPEvKaAYbZRoG
Powered by SMFPacks Social Login Mod