Flash loan is a very innovative and useful tool in the field of Decentralized Finance (DeFi), mainly in the Ethereum network. For critics, this loan offers criminals the opportunity to use poorly protected agreements to attract millions of people.
Flash loans were first launched in 2018 by the pioneers of the open-source bank Marbles DeFi. Thanks to the groundbreaking decentralized lending platform Aave, they arrived on the Ethereum network in January 2020. Throughout July of that year, Aave was regularly making over $100 million in Flash loans every day. In June 2021, the platform made nearly $4 billion in flash loans
We’ll be exploring the Flash loan highlighting what it is, its unique properties, how it works, its benefits and how its attacks work.
What is Flash Loan?
Flash loan is an unsecured loan that has become popular in many Decentralized Financial Protocols (DeFi) based on the Ethereum network.
This type of loan has made headlines lately because it has been used to take advantage of many vulnerable DeFi protocols, resulting in millions of dollars in losses. However, proponents believe that flash lending has brought the financial world an innovative and useful tool for arbitrage and fast transactions, which was impossible before the advent of the blockchain.
The Unique Properties of Flash Loans
Unsecured Loans: No collateral is required for unsecured loans. The lack of collateral doesn’t mean flash lenders won’t get their funds back. It will just be returned differently. The borrower does not have to provide collateral but has to repay the money immediately.
Instant Transaction: Usually, obtaining and fulfilling a loan is a long process. If the borrower is approved for the loan, he usually has to repay continuously over several months or years. However, flash loans are available immediately. The loan smart contract must be performed in the same loan transaction. This means that the borrower will have to call another smart contract to make an instant transaction on the borrowed funds before the transaction ends, which usually takes a few seconds.
Smart Contracts: Flash loans use smart contracts, which are tools activated by the blockchain that don’t allow funds to change hands unless certain rules are followed. With flash loans, the rule applies that the borrower must repay the loan before the transaction is completed, otherwise the smart contract will reverse the transaction – as if the loan was never approved.
How do Flash loans work?
Flash loans are unsecured loans simply because you do not provide collateral or pass a loan check. All you have to do is ask the lender if they can borrow.
The Flash loan must be repaid immediately in the same transaction. We assume the process is not nice because we are used to a typical transaction format in which funds are transferred from one user to another.
However, Ethereum is a very flexible platform – that’s why some people call it programmable currency. With flash loans, you can think of your transactional process as having three parts: borrowing, loan processing, and loan repayment which happens in the blink of an eye.
The Benefits of Flash Loans
Arbitrage Trading: Traders can make money by looking for price differences on several different exchanges. Let’s say the two markets have different prices for the DAI token. The price on exchange A is $1 and the price on exchange B is $2. Users can use Flash loans and appeal to a separate smart contract to buy 100 DAI tokens on Exchange A for $100 and then sell them on Exchange B for $200. The borrower then pays back the loan and pocket the difference. This can be a little risky too because it will happen in a very short window of time
Collateral Swaps: Traders also use Flash loans to quickly exchange low quality collateral that backs up the loan with some other high-quality collateral.
Save Transaction Fees: Since the introduction of Flash loan brings all complex transactions together in one step, a normal transaction usually requires several steps, so the gas fee required is quite low. Some traders can also use Flash Loan Utility to buy and sell related digital coins/tokens, saving some gas fees.
How Do the Flash Loan Attacks Work?
Flash Loan was founded less than two years ago and has a long line of confused struggles with different types of characteristics. DeFi is a very experimental field, with so much money at risk, it is only a matter of time before the loopholes are discovered.
The first attack occurred in early 2020. The attacker borrowed an ether Flash loan from the dYdX lending DApp (Defi exchange), split the loan in two and traded it on two different loan platforms called Compound & Fulcrum.
Only a few days later bZX became the target of a flash loan attack: the borrower was able to deceive the lender that they had made the full repayment, but the borrower did not. It does this by temporarily increasing the price of stablecoins used to repay loans.
More flash loan attacks followed in June and October 2020 when a hacker stole $34 million from the DeFi Harvest Finances protocol, due to design flaws. The attack lasted until 2021; In February, the attackers took advantage of flash loans and spent just $15,000 in transaction fees to withdraw $37 million from the Cream Finance contract.
The PancakeBunny event that recently took place in May 2021: a platform for Yield Farming based on Defi. The attackers used PancakeSwap to buy a large amount of BNB tokens and thus manipulate the prices of USDT/BNB and BUNNY/BNB in the PancakeBunny liquidity pool.