Flash loans 101 conceptual design (part 1)

in #bitcoin4 years ago (edited)

image.png

In this article I'm going to show you how some people borrow millions of dollars in cryptocurrency with zero collateral, so how they can do this? well with something called a flash loan this is a brand new technique that's sweeping the cryptocurrency and defi space and it's creating endless new possibilities for blockchain technology flash loans have also caused a lot of drama recently because they've been the source of some recent exploits

We're going to look at flash loans from a conceptual point of view, are they bad? And how can you perform one?

So as always remember this is not financial advice

So what is a flash loan? Well basically it's a way of borrowing cryptocurrency with zero money, no collateral, but there's one catch you have to payback all of the money you just borrowed as soon as you borrow it.

So in technical terms this means that you have to payback all the money that you borrowed in the same transaction so I know that it's probably pretty confusing

So I'm going to pull an example here and try to explain this better

whenever you are working on the blockchain you're dealing with transactions, like in really simple terms I just want to send money to you, if I send cryptocurrency to you that's one single transaction, and it's a very simple transaction, I get over my cryptocurrency well like metamasks that I have and you enter in your etherium address and send you a cryptocurrency, just in a single transaction,that's what's happening on the blockchain right, so transactions can be actually much more complicated than this you can perform more operations inside of a single transaction than just sending money to one person for example it can have

Multiple steps like step one operation A step2 operation B and then step three operation C

2.png

all those can happen in one go on the blockchain that's what a more complex transaction looks like all right so let's actually put some flesh on these bones instead of these abstract and your concepts operation ABC in the case of a flash loan it basically looks like

step one borrow money step two you do something with the money and then step three is pay back money

2.png

and there's all kinds of stuff that you can do in this second step here whenever you borrow the money as long as you pay it back in the same transaction, so this is what a complex transaction would look like inside of a flash loan.

what are kinds of stuff you can do with flash loans?

flash loans usage distribution:

2.png

  1. Dexes arbitrage is usually a much more frequent event compared to liquidations
  2. Collateral swap has only been recently built and it’s still very experimental.

Source : (https://medium.com/aave/flash-loans-one-month-in-73bde954a239)

Arbitrage trading

so let's just get a little clearer picture about one of the most used application of flash loans arbitrage trading, I'm going to explain this over and show you what it looks like in terms of all the people involved in the flash loan operation and how they use it in arbitrage trading, so basically there is a borrower and a lender and then you have some sort of exchange operation let's say it's an DEX for example so the borrower can take money from the lender and then go do something with these funds over DEXs platform they can put it on an exchange and trade it for arbitrage and then they get the funds back and pay back the lender, the money can move around in this triangle as long as it happens all in one transaction that's how a arbitrage trading works.

2.png

and the reason you can do this with zero money with no collaterals that the transaction will fail if the lender doesn't receive all their money back inside the transaction so for example if you borrowed $1,000 from the lender and did something with it on an exchange and then didn't pay the lender back in the transaction none of this would actually happen the blockchain wouldn't allow it.

so why arbitrage are profitable?

you can actually automate arbitrage with one of these flash loans if you have to just borrow all this money and pay it back in one go, well there are a few different use cases popping up but the main what I'm going to focus on right now is arbitrage trading basically it means taking advantage of price differences on cryptocurrency exchanges, so imagine a cryptocurrency sells for $100 on exchange A and then it sells for 101dollars on exchange B all right, there's an arbitrage opportunity here because you can basically buy it on exchange A and sell it on exchange B and making a $1.00 in profit so now that may not sound super appealing for you to take a hundred dollars out and then just go sell somewhere else to make $1.00 in profit minus fee yeah maybe you're talking about a few cents at that point right but imagine if you did this at scale what if you took a million dollars with a cryptocurrency and took advantage of this $1 price difference then the profit gets way bigger and that's where the value of a flash loan comes into play it allows you to take much bigger sums in some cases millions of dollars and do these kinds of trades basically anybody can become a cryptocurrency whale without needing any money in the first place and this is creating just endless possibilities of what you can do with these flash loans as long as you pay the money back in the same transaction.

Sort:  

A good post about Aave flashloans! Consider posting DeFi related posts in DeFi Campus. It is an upcoming community which aims to educate Hivers about DeFi 😀

thanks alot for your comment sure i will consider posting all my related Defi posts in Defi campus