What Are Flash Loans?
Flash loans are a kind of crypto loan without collateral & a popular option for arbitrage traders. Learn about flash loans, how to use them & more in our guide.
What is a flash loan?
Flash loans are a specific kind of uncollateralized and instantaneous loan in the crypto market. Flash loans let an investor borrow assets with no collateral to conduct a given transaction, provided those assets are paid back in the same blockchain transaction.
It’s a little confusing as there’s no real-world comparison for flash loans, so let’s delve a little deeper.
Read next: 15 Best Crypto Loans and Lending Platforms
How do flash loans work?
In simple terms, with a flash loan, you’ll borrow funds to execute a given transaction and immediately return them in the same transaction. This is achieved using smart contracts - so it’s all automated and the terms of your flash loan, like returning your funds immediately, are predetermined. Effectively, flash loans let investors utilize a huge amount of leverage for a given transaction, allowing them to amplify their profits.
It can help to have an example - so we’ll use Aave and go through the steps of a typical flash loan in layman’s terms:
You apply for a flash loan on Aave.
For your transaction, you create an arbitrary logic. In other words, a series of sub-transactions that you hope will result in a profit - including sales, swaps, etc. Whatever string of transactions you create, your last transaction must always be the repayment of the loan.
You repay the loan, pay the fee for the transaction and hopefully make a profit.
This is a really simplified version of how it works on Aave. You’ll actually need solid knowledge of Ethereum transactions, programming, and smart contracts in order to execute flash loans - and it’s the same story for most DeFi platforms currently. Although there are some protocols popping up like DeFiSaver to try and make this process simpler.
As it’s a smart contract with pre-determined conditions, this means if any one part of the overall transaction fails, the entire transaction fails. It’s a concept known as atomicity, but for smart contracts, it just means the transaction must entirely succeed or entirely fail - there is no middle ground.
This means if you don’t pay back your flash loan within the transaction or if the trade does not lead to a profit, then the transaction fails and nothing is recorded on the blockchain besides a record of the failed transaction.
What are flash loans used for?
So now you know the fundamentals of what flash loans are and how they work - you’re probably wondering why someone would use a flash loan, and the answer is simple - leverage.
Flash loans are a means to make more substantial gains, without putting your own funds at risk. The most common reasons an investor may use a flash loan include:
Arbitrage: Arbitrage traders make a profit by looking for price discrepancies between exchanges. Of course, these discrepancies are usually small, but if you’re using a flash loan to massively enhance your position, the profits amplify as well.
Collateral swaps: Collateral swaps in crypto let investors switch the collateral they’ve used to take out a loan on a multi-collateral lending app, like Compound.
Lower transaction fees: Flash loans combine what would usually be several transactions into a single transaction, so in some instances, it can also save users costly fees.
How secure are flash loans?
For loan providers, flash loans are relatively safe, as if the funds are not returned in the same transaction, then the transaction will fail. In theory, it sounds fool-proof thanks to the atomicity concept we discussed earlier. But it’s not quite the case, as flash loan attacks are on the rise.
What are flash loan attacks and how do they work?
A flash loan attack is an umbrella term for flash loans essentially not being used as intended. There are three common ways that flash loan attacks work currently:
Price manipulation: Someone uses a flash loan to manipulate the price of a given cryptocurrency by artificially inflating or deflating its value, and makes a profit somehow from that manipulation.
Arbitrage: With enough funds from a flash loan, it’s possible to create artificial arbitrage opportunities, by manipulating markets with enough collateral.
Smart contract exploits: Smart contracts are still in their infancy, and as such, some have vulnerabilities that hackers can use to steal funds or execute other attacks during the process of a flash loan.
Each flash loan attack has been slightly different but some notable examples include a flash loan attack on bZX where the borrower tricked the lender into thinking the loan was repaid in full but had actually manipulated the price of the stablecoin loaned. In another, someone used a flash loan to get extra votes for a MakerDAO proposal and swing the entire vote.
The largest loss to date was on Beanstalk, where an attacker used a flash loan to secure voting right, change the code of the protocol, and then send the loaned funds to their own wallet, creating a loss of $182 million.
Where can I get a crypto flash loan?
All of the above options will require a strong knowledge of Ethereum programming and arbitrary logic for smart contracts. There are however a select few platforms trying to allow users access to flash loans with an easier AI. Many of these still require technical knowledge and you should always DYOR to ensure you understand what you’re doing before actioning a trade.
Read next: Learn how your DeFi transactions are taxed.
More questions about flash loans? We have you covered.
Are flash loans risky?
Flash loan attacks are a very real risk for investors. If you lack the programming knowledge to create a secure smart contract, then your assets may be at risk.
What happens if you don’t pay back a flash loan?
Nothing. If you don’t pay back a flash loan within the same transaction, your transaction will fail - as though it never happened at all. All that will remain is a record of a failed transaction on the blockchain.
How much flash loan can you take?
Provided there’s enough liquidity in the pool(s) to conduct your transaction, there’s no limit to the amount you can loan in a flash loan.
How are flash loans reversed?
If any single sub-transaction within a flash loan transaction fails, the entire transaction fails. So if a flash loan was made up of let’s say, borrowing funds on Aave, a trade on Sushiswap, a trade on Uniswap, and then a repayment on Aave, but the trade on Uniswap failed, then the previous transactions would be reversed and the entire transaction would be recorded as a failed transaction on the blockchain.
How to make money from flash loans?
There are a number of ways to make money with flash loans, but the most popular current use for flash loans is arbitrage trading.
Can you trade with flash loans?
Yes, you can trade with flash loans, but you’ll need a strong understanding of Ethereum smart contracts and programming to do so currently, although some platforms are working to rectify this.
Are flash loans free?
Generally, the lender for a flash loan will charge an interest fee - for example, Aave charges 0.09% of the amount loaned upon repayment. You’ll also pay standard gas or network fees.