“Now you see me” (Source: Photo by Icons8 Team on Unsplash)

Flash Loans — An Intro

Berk Orbay
DataBulls
Published in
4 min readMay 15, 2023

--

Imagine you can get a loan from a lender at sunrise, but you should bring it by sunset. Flash loans have a similar butterfilical lifespan. For them sunset is the end of the block transaction.

I’m not a blockchain or cryptocurrency fan (or an expert per se), but I’m a sucker for financial innovation. I also learn best by writing down what I research. Therefore, take everything you read here with a grain of salt and disabuse me if I write anything wrong.

Some Background

According to this Coindesk article Flash Loan is first coined in Aave platform (in January 2020). For starters Aave is a “liquidity protocol”. This is the point where I’m taking guesses.

Simply put, suppose you have some crypto (say, Ethereum). You “lend” this crypto to a liquidity pool in exchange for some other token (in this case Aave). Then Automated Market Makers use this pool to provide liquidity to markets by constantly working as a market maker (i.e. putting bid and ask orders at the same time and earning money from the “spread”/difference).

These are the guys you are getting your flash loan from.

Working Principles

I’m following the Aave documentation for this part. The fundamental thing is a flash loan occurs in a smart contract. I infer we are in Ethereum domain for that (perhaps not necessarily).

You get the money. You do your trades. According to the documentation it is used for liquidity swap (like trading but in a pool). It can also be used for arbitrage or closing borrowing positions. You pay it back in full plus fees and interest. For instance, Aave has a flash loan fee of 0.09%.

The loan is unsecured (i.e. you do not need a collateral). If the payback does not happen in a single block transaction, the loan and all transactions are reversed (this is the part that I don’t understand). But you still pay the fee. Currently, on Ethereum, this period is a little over 12 seconds.

According to this chart, flash loan volume can be as high as USD 3.5 Billion. Arbitrage can be as profitable as USD 370k according to this article. Remember everything happens in a brief time measured in seconds and you do not need to put collateral.

Whaaat?

Let’s break it down and digest the news piece by piece.

  • You do not need to put collateral
  • If you cannot repay, the transaction is reversed (you still pay a fee)
  • Everything shall happen in a short time window

If you are into an arbitrage, your gross profit should be above the fee of the flash loan. Otherwise, it is of no use.

How the transaction is reversed is a bit confusing to me. Because any significant transaction will have an effect on the price and it will affect other transactions. I assume there are also the counterparties whose trades will be reversed if flash loan fails?

What can go wrong?

There are a few ways to use flash loans for manipulative intents. Chain Link documents Price Oracle Attacks. Coindesk has some examples as well. Briefly you can use flash loans and not pay them back due to a problem with the reference smart contract or you can use the abundant liquidity to throw one or more cyptocurrencies off balance. Here is a full post on Flash Loan exploits.

These attacks have nice names like “Pump attack and arbitrage”. Also, here is a nice thread with resources on YC discussions.

Conclusion

Flash loans are idiosyncratic to cryptocurrency markets. They have exciting features which we do not see in ordinary financial markets. As the speed is a differentiating factor in cryptocurrency markets, it is more than possible to see other innovations such as Flash Loans.

Since I’m not an active participant or an expert on the market, my coverage is a bit limited with pointers to some resources and the basics. I hope we will see more of these antiquities of the new world.

https://www.linkedin.com/in/berkorbay/

More…

--

--

Berk Orbay
DataBulls

Current main interests are #OR and #RL. You may reach me at Linkedin.