In 2018, the Marble protocol was introduced, presenting a framework for a decentralized bank. This entity could lend any amount of money requested by a user without collateral, which they would call flash loans.
The magic trick behind the concept of flash loans is the ability for the money on the blockchain to be borrowed and repaid in the same transaction. The computer science definition of a transaction, whether it is on a blockchain or not, is a set of operations that have to be executed atomically. If one of these operations fails, none of the others is executed, and the transaction is reversed. Hence, a user can borrow the number of funds he deems necessary and perform arbitrary actions with it. However, if the operation of reimbursing the money does not go through, the transaction will never appear on a block. In other words, flash loans only exist when they succeed. It is also important to note that the gas prices always have to be paid, and the lender can ask to collect interest.
These types of loans are currently only used in few application cases. The main one is arbitrage trading, which takes advantage of tiny differences in values of currencies between exchanges to generate a profit. As an example: Let’s take the value of Bitcoin (BTC) compared to the US Dollar (USD) on Exchange1 and Exchange2. On Exchange1, the ratio is 10 USD / 1BTC, whereas on Exchange2 it is 10 USD / 0.9 BTC. By buying 1 BTC for 10 USD on Exchange1 and reselling it for 11 USD on Exchange2, the trader would have made 1 US Dollar of profit.
In a real environment, these profits would be almost insignificant if a large amount of money is not employed. But this is the force of flash loans, allowing users to borrow large amounts of resources, perform arbitrage operations and reimbursing in the same transaction. If prices changed negatively during that time, the trader only pays the gas fees. Other use cases can be collateral swap or self-liquidation, which are topics we’ll cover in another article. The current leading providers of such services are Aave and dYdX, both layer 2 solutions on Ethereum.
As promising as the technology appears, the young history of flash loans has already witnessed its use in destructive ways. The attack on Fulcrum during February 2020 allowed the so-called “hacker” to make around $350.000 in a transaction of only seven steps. The DeFi project was unprepared for this sort of possibility, and someone took advantage of the system.
In conclusion, the power and possibilities opened by flash loans are hard to imagine. This new type of instrument holds the potential to reshape the economy surrounding cryptocurrencies and the global economy.