- Borrow as much money as you want
- Put up little to no collateral
- All this, risk free
Introducing Flash Loans
Here’s the basic premise.
What if you could loan someone a million dollars, with the an absolute guarentee that:
- They pay you back 1,000,500
- The whole transaction is reversed and you get your money back
This can be (and has been) done with smart contracts.
Flash loans are atomic. This means that unless the loan is paid back within one transaction block, the whole loan is reverted as if it never happened. It sounds a lot like going back in time and changing the past in a way.
It’s risk free for the loaner, since they are gaurenteed their money back. The lender gets to play like a whale with other people‘s money. Block times are very short, around 15 seconds. So the lender has very little time to play with the money. If they’ve got a plan for it, it’s got to be automated and executed quite quickly.
What’s the Use of Flash Loans?
What can you do with 15 seconds? Baseline, it sounds pretty cool to legitimately say “I became a millionaire at age 23”. There are also some oportunities to profit for savvy people.
With just a 1% difference in price and a million dollars worth of cryptocurrency, you can make 1000 dollars. Borrow the money, buy X token for cheap on Y Dex, sell X token for higher on Z Dex. This requires smart contract programming as we only have 15 seconds to execute and pay back the loan.
Say I have only 100 dollars in Dai. I’ve taken out a loan of 50 dollars in Eth. I want to move my 100 dollars from to Compound for better rates.
Normally, I’d do this:
- I would need to have 50 dollars Eth to repay the debt
- I could then move my funds to Compound
With flash loans, I can:
- Flash borrow 50 dollars Eth to pay the debt
- Move 50 dollars of my Dai funds to Compound
With the flash loan, I didn’t need to have any money of my own to perform the feat
Hacks and Sneaky Stuff
A lot of money becomes a lot of power in the cryptocurrency ecosystem. Making attacks expensive to perform is a security feature... that ends as soon as it becomes trivial to obtain large sums of money.
Oracle manipulation is one example.
Maybe we will do a tutorial on this later. Being a 15 second millionaire sounds fun. 😅
We write briefs like these weekly. If you’d like to keep up with them you can subscribe directly to this blog, or to our newsletter which contains even more. Our newsletter is curated and you can reply directly to it with any questions, comments, or suggestions.
Lastly, if you’re looking to purchase cryptocurrency and follow along, you can use CardxCoin to buy cryptocurrencies with unwanted gift cards or just your debit card.