Flash loans

What would you do if you could borrow a near unlimited amount of money, only need to pay the interest, and not need to provide any collateral?

Sure, we have something like that with credit cards, at an outrageous interest rate, and with fairly small credit limits. But what if I’d give you this non-collateralized loan for just 0.09%?

Sure, you’d think, I’m happy to rip you off. But here’s the thing, you can’t rip me off, and I’m not scamming you.

The above is possible with something called flash loans, a new type of financial instrument, only possible on blockchains like Ethereum.

In short, it’s a DeFi protocol where you obtain the loan at the start of your transaction, do whatever you want to do with it, and then return it back with interest at the end of the same transaction. If you’re unable to return it, the flash loan protocol fails, failing the transaction, rolling back the whole set of actions as if nothing happened.

This only works because everything that happens within one transaction is atomic. It either all happens as described or nothing is saved to the blockchain state.

Having access to liquidity this cheaply opens a huge amount of opportunity, but also headaches. An example of a flash loan provider is Aave, with their, as of writing this, 0.09% fee.

There’s been a few examples of this causing issues. Offering anyone access to this much liquidity enables smart people to explore and exploit insecure protocols. Examples include a couple of attacks on the margin trading protocol bZx, and more recently an attack on the governance voting system used by MakerDAO, the system behind the 2 billion dollar DAI stablecoin.

Taking a step back, its not like flash loans themselves are causing these issues. Anyone could with similar liquidity, without using flash loans, trigger the same set of conditions. Instead, what flash loans enable, is firstly a very efficient tool to enable a lot of great things, and secondly an opportunity to highlight issues that need fixing in insecure or inefficient blockchain protocols. No hacks needed, they’re just pointing out the obvious.

A typical use case of where flash loans add much benefit to everyone involved is when you’d like to change the collateral used for minting DAI. With a flash loan you can cheaply get access to the liquidity needed to make this swap in one transaction, rather than the usual multi transaction setup. This brings more stability to the DAI ecosystem, and removes price movement risks you’d otherwise expose yourself to if you had to perform this swap over multiple transactions.

So flash loans are here to stay, and they’ll help shore up bad protocols, and enable more efficient financial transactions. Another example of where DeFi delivers tools not available in the old CeFi world.