Flashloans are zero-risk instruments in the universe of Decentralized Finance (DeFi). Their purpose is not much different from the one held by more traditional loans: borrowing money to invest it in ventures or personal projects and lending it in order to gain a profit.
As the name itself suggests though, the novelty of the decentralized version lies in its instantaneous lifespan, a quality that on one hand enormously limits what a borrower can do with the received money, but that on the other hand manages to cancel credit risk, the possibility of a loss resulting from a borrower’s failure to repay a loan, making theoretically possible to lend any amount of money (Ether or tokens) to anyone without any risk.
At first it might sound counterintuitive, but by definition a flashloan can’t risk the lender’s assets, since it actually is nothing but a single, possibly articulate, transaction that either re-establishes the initial conditions, perhaps with the addition of some small
$$ \epsilon\downarrow 0 $$
compensation for the lender, in the same exact block it is mined or doesn’t even go through at all.
One user can’t borrow money, if the money isn’t returned as it is lent.
Having defused credit risk, the lenders won’t demand an interest to mitigate it anymore, but simply a fee to justify their engagement. A fee that will tend to zero as more lenders compete to get involved.
It is then clear that you can’t buy a house with a flashloan, but you might be able to do something else (hint: something more speculative), unfortunately even something illegal.
Less unethical than exploiting the vulnerabilities of a decentralized exchange is exploiting the price differences of identical or similar financial instruments in different and inneficient markets by nearly simultaneously buying and selling them, or, as the cool kids call it, an arbitrage.
Consider a scenario in which Alice knows both Bob and Charlotte are willing to trade a new social token called TikToken against Ether and constantly monitors their respective price fluctuations.
At a certain time Alice notices that Bob is willing to sell 1000 TikToken at 0.99 Ether and Charlotte is buying 1000 TikToken at 1.01 Ether, hence Alice can profit 0.02 Ether buying TikToken from Bob and transfering it to Charlotte.
Imagine now that Bob has 1000000 TikToken to sell and that Charlotte is looking for the same quantity of TikToken with the same prices as before, except Alice still has only 1 Ether to use in the arbitrage. By applying for a 1000 Ether flashloan, she could then profit 20 Ether without batting an eye.
Once again as an intellectual exercise, let’s monitor the pair UNI-ETH on different decentralized infrastructures.
Depending on the time of response from the APIs, it might take a few seconds to display the results (if it doesn't work it may be a problem with ad-blockers).