If you’ve been in the cryptosphere for a while, the chances are that you’ve heard about Flash Loans. This is especially after two hackers used flash loans to breach the bZx margin trading protocol a few months ago. The first one spirited away with $350,000 and the second with $600,000 in a copycat attack.
The attacks were strange since the involved a penniless attacker borrowing thousands of dollars in ETH. Once they received the loan, the sidestepped some vulnerable on-chain protocols, extracted thousands in stolen assets, and paid back their ETH loans – all of this is just a single Ethereum transaction. You may be wondering about Flash Loans, what they are, and their impact. Our guide will answer some of your questions.
What are Flash Loans?
A Flash Loan is an innovative Decentralized Finance (DeFi) tool. The term was conceptualized by Marble Protocol in 2018. The firm called itself a “Smart Contract Bank,” and called their innovation a zero-risk loan via smart contract. This is a loan that you can borrow and repay in a single Ethereum transaction. You don’t need to relinquish collateral for you to access a flash loan. The most prominent properties of a Flash Loan are:
- Borrow and repay in a single Ethereum transaction
- You don’t need collateral
- Return the principal plus a small fee of about 0.09%
- You must complete the transaction successfully or it reverts
- You only pay Gas fee to complete the transaction
How do Flash Loans work?
Traditional lending carries two forms of risk: the default risk and the illiquidity risk. The default risk refers to the situation where a lender disappears with the money. On the other hand, the illiquidity risk refers to the situation where the lender gives out too much of their assets at the wrong time or fails to receive timely repayments. This can render the lender illiquid, meaning they’ll not be able to meet their obligations.
Because of its nature, a flash loan mitigates both risks. The lender will advance you as much money as you want for that single transaction. The caveat is that you need to repay the entire amount at the end of the transaction. If you’re unable to repay, the lender will automatically revert your transaction.
A flash loan is facilitated by a smart contract and is atomic. This means that when you fail to repay the loan, the entire thing reverts as if nothing ever happened. This is only possible on a smart contract platform since it can process one transaction at a time. Everything related to a particular transaction gets executed serially as a batch operation. Your transaction behaves like “freezing time” while executing, and since it’s on the blockchain, all the codes will run one line after the next.
Benefits of Flash Loans
Flash Loans are the buzz word in the world of DeFi. The biggest advantage of this tool is its ability to enable anyone to access insane amounts of liquidity without collateral. This means that anyone willing can become a “whale.”
Flash Loans Use Cases
Flash Loans are the newest kid on the block, and, as a result, their use cases are innumerable. Since they are being integrated all over the DeFi Ecosystem, we want to look at their most prominent use cases:
This is a system through which an investor can take advantage of the price difference between different markets. You can employ a flash loan to access a huge amount of liquidity and arbitrage between several decentralized exchanges. One such project that’s aggressively taking advantage of Flash Loans is ArbitrageDao.
If you are facing a liquidation penalty for a DeFi loan at the range of between 3-15%, you are looking at a truly hefty price. You can leverage a flash loan to build self-liquidation. Let’s say you encounter an open position, but you can’t access your funds for whatever reason, any simple market event can easily trigger liquidation.
You can avoid this by self-liquidating your loan, taking a flash loan, and your deposit to pay back. Even though flash loans aren’t free, it’s more affordable at 0.09% compared with a liquidation penalty of 15%.
All DeFi lending protocols are these days, allowing multi-collateral deposits. You can take advantage of the flash loans to benefit from the highly fluctuating markets. In a situation where one Asset is more bullish than another, you simply swap collateral to enable you to keep a trading position then add a passive “long” as you hold another asset collateral.
In a case where the new Asset you used as a deposit over performs the initial one, you end up with a huge profit. If you didn’t take a flash loan, you would have had to pay back the open loan before you can swap collateral. After that, you would have had to re-open a new loan. This would require several transactions to “wind down” your debt if you didn’t have enough capital to execute the operation.
Debt Refinance – Interest Rate Swap
You can use collateral swaps for much more than a single protocol. If you get an open position that’s on compound interest on Platform A and witness more favorable rates at different platform B, you can use flash loans to your advantage:
- Borrow Asset from platform A
- Pay back debt on compound
- Withdraw collateral from the compound
- Deposit collateral on Platform B
- Mint debt on Platform B
- Return liquidity to Platform A
All these will be done in a single transaction.
Debt refinancing — ‘Currency Swap’
We have used the example above to demonstrate how you can use a flash loan from one platform to refinance debt on a lower interest rate in another lending platform. You can use the same formula to extend to swapping the rate of one currency to another, where the rate is lower for a while. Simply add a flash loan circuit for the currency to be sold to another one:
- You have a Compound loan with 8% on Dai borrow
- Borrow Dai as a flash loan from Platform A
- Close compound borrow and unlock ETH from the collateral
- Send ETH to Platform B where the interest is maybe 5% on USDC
- Borrow USDC from platform B
- Send USDC to UniSwap or Kyber and convert it back to Dai
- Repay Dai flash loan to Platform A
By using a flash loan, you refinanced a loan from 8% Dai to 5% USDC, and you didn’t have to return the Dai loan first. You can extend this function, so it works algorithmically by rebalancing to the lowest Stablecoin rate.
Flash Loans and DeFi
The concept of Flash Loans has been around for only a year or two. The surge of Decentralized Finance is perhaps what has brought attention to them besides a few ‘exploits’ by a few users. Flash loans are anew thing, and we cannot judge them based on a few unfortunate incidents like the two heists we mentioned at the beginning of this article.
This looks like a huge innovation that could lead to a revolution in the world of finance. Flash Loans can level the playing field so anyone can become a whale. This is what technologies like blockchain are striving for so we can have some freedom in the world of finance. The main attraction for flash loans seems to be not requiring collateral to raise a loan.
The Future of Flash Loans
As time progresses, we can expect to see DeFi protocols complying with a higher standard of security. This should apply from within the protocol besides being part of integration testing for the DeFi ecosystem. This is likely to lead to a form of standard for financial security, similar to what we see in banks and conventional financial institutions in centralized banking.
Like all new technologies, flash loans are still in their infancy. You can expect them to experience several associated pitfalls, risks, and all forms of weirdness. Like all inventions in the blockchain space, you can expect to meet a few bad actors. The actors will have to practice due diligence in protective procedures like Know Your Customer, and Anti-Money Laundering (KYC/AML) checks to disincentivize the bad boys.
The fact that the idea of flash loans is getting challenged makes it a sort of landmark in innovation. Flash Loans have demonstrated that it can become a decentralizing revolution. They remain one of the newest decentralized, algorithmic, episodic finance protocols whose impact we are only starting to witness.