Flash Loans: the Latest Innovation in the World of Finance
By: Yam Wachiralappaitoon
In the minds of many borrowers, obtaining a loan can be a tedious process: there is usually a lot of paperwork involved, you need to do a credit check, and more often than not, you need to put up collateral if you want to borrow a large amount of money. It can also create a barrier for people who want to borrow the money to invest in something, whatever that may be, if they don’t meet the loan requirements. There’s a way to change this.
With the world of decentralized finance (DeFi) growing and gaining more popularity in recent years, many of the financial transactions or processes are becoming decentralized, meaning third parties like banks are no longer involved. More and more innovative projects are created and one of the latest innovations in DeFi is a flash loan, a way for you to borrow money in a flash, as the name suggests.
How Does a Flash Loan Work?
The idea of a flash loan became a reality in early 2020 by Aave, a decentralized lending platform on Ethereum blockchain. Flash loans run on Ethereum blockchain’s smart contracts, which is a program that self-executes a contract as codes whenever certain conditions are met. This way, the contracts can’t be altered and the conditions are strictly enforced, eliminating the need for the lenders to worry about whether the borrowers will pay back their money.
Originally, flash loans are meant for developers as you need to know the Ethereum mechanism and write codes to execute the transaction. Although it’s not widely available for the public, end users are now able to utilize this innovative feature using tools like DeFi Saver, Furucombo, and Collateral Swap. Flash loans can be done on many platforms, but Aave is still the biggest platform flash loans are being executed on, having issued almost $4 billion of flash loans in June 2021 with the most lent cryptocurrencies being DAI and USDC.
Flash loans are similar to traditional loans in the way that lenders lend money to borrowers and borrowers must pay the loan back in full along with any interests and transaction fees. However, flash loans actually have some distinguishing characteristics that attract many people.
● Fast: A transaction of a flash loan only takes seconds, or minutes at most. This puts an end to the tedious process of traditional loans as you can make the transaction and get the money right away.
● Uncollateralized: As opposed to traditional loans or even other loans in DeFi, flash loans require no collateral at all which breaks the barrier to entry and catches the attention of investors who couldn’t obtain other loans due to a low capital.
Don’t get too excited just yet! By now, flash loans must sound like a very attractive opportunity. But here’s another important piece of information you need to keep in mind: the condition of flash loans on smart contracts is that the borrowers need to pay back the loan before the transaction ends and as the transaction occurs in an instant, that means seconds. If this condition isn’t met, the transaction of the flash loan would reverse, giving back lenders their money and making it seem as if this transaction never happened. This is to ensure that the borrowers pay back the lenders.
Flash Loans are Innovating the Finance World
If the loans need to be paid right after they’re borrowed, what good does it do? Well, despite this thought that might pop up in your mind, flash loans are innovating the world of finance and are very useful in many instances. Here are some examples:
● Arbitrage: As the pricing of a cryptocurrency slightly differs across different exchange markets, you can take advantage of this using flash loans to gain money. For example, if the price of a particular coin is $10 at Exchange X and $15 at Exchange Y, you can buy coins at a lower price from Exchange X and sell at a higher price on Exchange Y, gaining profits from the price difference.
● Collateral Swap & Self-Liquidation: Some decentralized exchanges, such as Binance, require your crypto as collateral when borrowing on their platforms. With the use of flash loans, you can swap your collateral for a different crypto if your crypto collateral is volatile or its value is decreasing and you’re at risk of being liquidated.
● Wash Trading: As trading popularity of an asset is indicated by trading volume, trading the asset maliciously (i.e., selling the asset and then buying it back) can inflate the trading volume and bring more attention to the asset. This is called wash trading and flash loans easily let this happen on decentralized exchange (DEX) as DEX usually needs you to hold and use the asset when wash trading. (Note: wash trading is illegal in many countries such as the U.S.)
● Lower Fees: With all the transactions of traditional loans combined into one, a flash loan transaction fee is lowered, enabling you to save money quite a few bucks.
As of now, flash loans are only used in the DeFi world. But as we progress into the future, it is possible that the idea of flash loans could be integrated into centralized finance and essentially change different traditional markets (e.g., foreign exchange and trading markets) in a whole lot of ways based on its current usages mentioned above.
Challenges with Flash Loans
Every innovation and its benefits never come without a cost and the same goes with flash loans. Flash loan is still in its early stage having launched in 2020 but has already been facing some questionable problems, namely, flash loan attacks.
Not so long after flash loans entered the DeFi space, flash loan attackers have been using flash loans to manipulate the price of cryptocurrencies and earning a huge amount of profits, which exploited many DeFi platforms resulting in losses of hundreds of millions dollars to this date. They do this through loopholes in DeFi protocols as smart contracts don’t execute as they’re designed to or data flowing into smart contracts is tampered with, enabling them to trick lenders that they’ve paid the loan in full. Usually, attackers rely on manipulating centralized pricing oracles used in decentralized exchange (DEX) which use only one node to transmit pricing data to a DeFi protocol, making it more vulnerable to attacks compared to using multiple nodes in decentralized pricing oracles.
The first flash loan attack occurred on February 14th, 2020 (aka Valentine’s day!) on bZx, an Ethereum-based decentralized platform, with a loss of more than $350,000. Other attacks have been occurring throughout 2020 and 2021. Some of the famous attacks are on Harvest Finance (a DeFi yield farming aggregator) in June and October 2020, Cream Finance (a DeFi lending protocol) in February 2021, and PancakeBunny (a DeFi yield farming aggregator) in May 2021.
In addition to the attacks to gain money, flash loans have also been used as governance attacks. This is what happened on Maker protocol in October 2020. To simply explain, B protocol initiated a proposal for a governance vote on Maker protocol and then borrowed MKR governance tokens using flash loans to vote on the proposal and make it pass. B Protocol basically took advantage of flash loans to manipulate governance votes.
Flash loan attacks are becoming increasingly common among incidents in DeFi due to its low cost, high reward, and the fact that none of the flash loan attackers has been caught yet as a flash loan doesn’t require personal identification. You can see that uses of flash loans not only cause monetary loss, but also affect the governance structure.
How Could Flash Loan Attacks Affect the DeFi World?
Flash loan attacks clearly unfold the loopholes in the DeFi and blockchain world, raising doubts among users and developers and pointing out the need for improvements in this increasingly popular innovation. Vulnerabilities in DeFi obviously don’t need just a quick fix, but a sustainable solution and mechanism. Additionally, not all of the DeFi platforms had incidents of flash loan attacks. Why attackers chose to attack a particular platform and use certain cryptos is still unknown. So, does this indicate that some platforms are better than others? It’s a question that needs to be investigated.
It’s also important to note that flash loan attacks can also impact the value of tokens or cryptos used in the attacks as a large amount of different currencies are being borrowed and returned in such a short window of time. As with the PancakeBunny attack, the value of its BUNNY token dropped more than 95% of its previous value after being exploited by flash loan attackers.
Are Flash Loans Here to Stay?
The most likely answer is yes. Sure, flash loans have unlocked ways to take advantage of DeFi vulnerabilities to a whole new level and caused problems in the DeFi space. But this doesn’t completely trash out the benefits and convenience it can give us, especially when it’s only been a year since it entered the market. It’s still early in its development and there are a lot of improvements to be made.
The good news is that actions have already been taken by some platforms like OpenZeppelin to detect smart contract exploits and there are other hopeful solutions to prevent flash loan attacks and eliminate loopholes in DeFi. The most important solution is for all DeFi protocols to have their codes for smart contracts audited. Another of the proposed solutions is to use decentralized pricing oracles such as Chainlink which uses multiple nodes to transfer data and is less vulnerable to manipulation. Another possible solution is to carefully design flash loans in a way that makes the transaction go through two blocks. Though this is still questionable as it could lead to more attacks and would affect DeFi protocols if not designed properly.
It’s quite positive that most challenges, if not all, with flash loans will be solved in the years to come. As flash loans become more accessible to the public and people can take advantage of it in an unharmful way, we should see flash loans be more widely used in the DeFi space and who knows, maybe it will even be implemented in traditional centralized finance!