What is a flash loan?
The beginner's guide to flash loans
A flash loan is a type of loan offered within the decentralized finance space that allows users to borrow cryptocurrencies without providing any collateral upfront.
Experienced crypto traders may use flash loans for arbitrage or other crypto trading strategies.
Flash loans allow traders to borrow funds in order to increase the size of their positions while trading different types of cryptocurrencies or crypto derivatives.
While flash loans offer unique trading opportunities, they also require a deep understanding of the specific DeFi protocols and platforms being used, as well as the risks of actively trading cryptocurrency.
How are flash loans different from traditional loans?
In traditional finance, borrowers typically need to complete extensive credit checks before they are able to secure a loan.
They also need to deposit some amount of value up front to secure these loans.
Deposits serve to show the lender that borrowers have means to repay the borrowed amount, and helps the lender to reduce some of the counterparty risk. In other words, if the borrower defaults, the lender can seize the collateral to offset their losses.
In finance, the assets that a borrower deposits in order to back the value of their loan is known as collateral.
Flash loans represent a completely different type of loan that leverages smart contracts and blockchain technology.
Unlike traditional loans, flash loans do not require the borrower to post any form of collateral to access the borrowed funds. Nor do they require borrowers to complete any form of credit or background check to qualify for loans.
How do flash loans work?
Offering unsecured loans to unscreened borrowers might seem like an incredibly risky endeavor — but there's a catch.
To secure a crypto flash loan, the borrower must pay the lending protocol back in full within the same transaction block, plus interest and transaction fees, also known as gas fees.
A transaction block might only last around a few seconds in total. For example, the Ethereum blockchain typically creates a new block every ~12 seconds.
Automated software programs called smart contracts manage the entire flash loan process.
If the borrower does not repay their loan within the same transaction block, the smart contract simply rolls back the loan as if it never happened. This means the lender gets their funds back in full, plus interest paid by the borrower, without any problems.
How do crypto traders use flash loans?
You might ask, why would someone want to borrow crypto funds if they have to repay it within a few seconds?
Borrowers execute flash loans using smart contracts on DeFi platforms such as Aave, dYdX and Uniswap.
A person can write smart contracts to use the borrowed funds for various purposes, such as arbitrage trading, collateral swapping or participating in token sales. These computer programs can complete tasks near-instantly, allowing a person to leverage the funds and return them back within the short time period.
Taking out a flash loan consists of three main steps:
- Borrow funds: A user takes out a flash loan by borrowing a specific amount of cryptocurrency from a DeFi platform's liquidity pool.
- Execute transaction: The borrower uses smart contracts to execute a specific trading strategy using the funds within the same transaction.
- Repayment: The borrowed amount, along with transaction fees and interest, must be repaid within the same transaction. If the user fails to repay the loan in the same transaction, the entire transaction, including the loan, is reverted.
The uniqueness of flash loans lies in their requirement for the entire process to be completed within a single transaction block.
This feature prevents borrowers from holding onto the borrowed funds for an extended period and helps to negate counterparty risk for lenders.
Flash loan attacks
While these types of uncollateralized loans offer considerable advantages regarding flexibility and efficiency, this financial tool has also paved the way for malicious activities known as "flash loan attacks."
These attacks exploit the short time frame of a single transaction block to manipulate prices, exploit arbitrage opportunities or cause disruptions within DeFi lending platforms.
You can learn more about best-practices to protect yourself from these risks with our Kraken Learn Center article How to keep your crypto safe.
The most infamous type of flash loan attack involves the attacker first borrowing a substantial amount of cryptocurrency through a flash loan.
The flash loan attacker(s) then execute a series of transactions across different platforms, manipulating asset prices to their advantage. This process can involve exploiting price discrepancies, causing cascading liquidations or artificially inflating the value of a token.
If the attacker's strategy results in profits, they repay the borrowed amount along with the interest, keeping the profits for themselves. If the flash loan exploit does not yield the expected profits, the entire transaction, including the loan, is reverted, and the attacker only pays interest fees.
Flash loan attacks have targeted various DeFi platforms in the crypto space, leading to significant financial losses for both users and the platforms themselves. The largest flash loan attack to date took place on the Euler Finance protocol in March 2023.
Exploiting an error found in the platform's DonateToReserve function, hackers stole almost $200 million worth of USD Coin (USDC), Staked Ether (stETH), Dai (DAI) and Wrapped Bitcoin (WBTC), using a $30 million flash loan from Aave.
However, by some interesting twist of fate, the hacker(s) decidedly returned all of the stolen funds within a few days and formally apologized via several transaction messages.
Popular DeFi platforms for using flash loans
Aave Price
dYdX Price
Uniswap Price
Why are flash loans important?
Flash loans represent a revolutionary innovation within the DeFi ecosystem.
They allow DeFi traders to access substantial amounts of liquidity without needing to post collateral.
These loans have opened doors to innovative financial strategies and quick transactions, but they also carry inherent risks due to their short-term nature and potential for price manipulation.
As the DeFi space continues to evolve, it is crucial for both developers and users to be vigilant about security measures and best practices.
Staying vigilant and educated ultimately helps to mitigate the risks associated with flash loans and ensure the long-term sustainability of decentralized finance.
Get started with DeFi
Kraken lets you buy, sell and trade the leading cryptocurrencies that are shaping the DeFi ecosystem, including those in the yield farming space.
Sign up for your Kraken account today to get started in the exciting world of decentralized finance and the assets shaping the space.