Flashloans — Borrow Millions of Dollars Without Collateral on Blockchain
Imagine that you can borrow any available amount of an asset (even millions of dollars) without giving any collateral, but only if you can prove that you will pay it back in the same transaction. Is it possible? Maybe you think that’s crazy but with blockchain technology, yes, it’s possible! And that, ladies and gentlemen, is a Flashloan ⚡
The emergence of Blockchain technology has allowed for a lot of innovation in the finance world.
The Decentralised Finance (DEFI) protocols have led to the rise of a new kind of lending and borrowing mechanism, that is not similar to traditional loans taken from brick-and-mortar companies. This is because the traditional banking loan requires a number of documents that need to be provided, including a formal ID and proof of income to take out a loan which is then repaid after years. In case of a flash loan, none of this is necessary due to the lack of collateral.
An uncollateralized instantaneous loan aka Flash loan is only possible due to Smart Contracts. A smart contract is a program on the blockchain which ensures that a certain function can only succeed once all conditions are met (all or nothing principle).
For flash loans, the condition is that the borrower will need to repay the full amount of the loan plus interest to the lender before the transaction is completed. This is possible because flash loans are one blocktime loans. As such, no collateral is needed, because if the borrowed money including interest is not given back before the transaction is completed, the entire loan (transaction) is immediately reversed.
We will discuss block building on blockchain and how transactions work in another article.
Flashloans for arbitrage opportunities. 💱
The most common method of using flash loans for profit is through arbitrage. This is an operation that uses the price difference of the same asset in two different markets. Imagine that you find a token X on DEX A listed for $1, and the price of the same token on DEX B is $1.10.
You could now use AAVE which is an open-source, decentralised, non-custodial protocol on Ethereum that allows users to do flashloans to buy up the cheaper tokens on DEX A, then sell them on DEX B at a profit. Once the AAVE Flashloan is paid back at the end of the transaction, you can keep the extra sum for yourself.
Flashloans attacks. 🥷
Flashloans are not only used for arbitrage trading, some of them can also exploit structural vulnerabilities in Defi platforms. As an example a trade was executed in the night from 14.February — 15.February 2020 (not a great end of Valentine’s Day), which did exploit a bug in bZx smart contract implementation.
The exploiter profited ~$350k from a single transaction due to a clever arbitrage execution.
Transaction on Etherscan
Here is a full analysis of the attack by Peckshield.
Is There any Risk Involved in a Flash Loan?
Flash loans are risk-free because no money is ever given away in the lender’s perspective. If all of the smart contract criteria are met, both the borrower and the lender will benefit from the transaction. If one of the steps doesn’t succeed the transaction fails and the money is simply handed back to the lender and the borrower only pays the gas fee. The borrower has no outstanding debts, while the lender still has their money.
Blockchain technology and DeFi protocols have revolutionized the traditional lending and borrowing system with the introduction of flash loans, which offer swift, collateral-free loans. These have been leveraged for profit through arbitrage, but they are not without pitfalls, as their ability to exploit structural weaknesses in DeFi platforms has shown. Despite appearing risk-free from a lender's perspective due to smart contract safeguards, the broader DeFi ecosystem is prone to risks such as contract vulnerabilities and regulatory uncertainties. As we navigate this exciting yet complex landscape, it's crucial to approach with caution, acknowledging both the opportunities and challenges it presents.