dYdX logo
dYdX logodYdX icon
English
中文
日本語
한국어
русский
Türkçe
Français
Português
Español

Crypto Loans in a Flash: What Are Flash Loans in DeFi?

dYdX
dYdX
Flash Loans
dYdX
dYdX

Crypto trading history has plenty of strange stories—arguably one of the most memorable on record happened in June 2023, when an unknown crypto trader took out a risky loan for $200 million but only earned a profit of $3.24 after making a series of elaborate token swaps. What’s even crazier is the trader didn’t put any money down as collateral to take out $200 million from decentralized finance (DeFi) protocol MakerDAO. 

The specific service used to pull off this trade is called a flash loan, an option for crypto traders needing instant access to capital. 

Not everyone in the crypto community has positive opinions on flash loan protocols, but they are a common—albeit high-risk—product unique to DeFi lending. Let’s discover the meaning of flash loans, how they work, and why they’re so controversial. 

What are flash loans in crypto?

Flash loans are a financial service offered on lending and borrowing decentralized applications (dApps), which provide traders instant access to crypto funds without collateral requirements. DeFi borrowers don’t have to deposit their crypto holdings onto a protocol to take out thousands or millions of dollars from a flash loan. However, DeFi lending protocols like MakerDAO and Aave aren’t simply giving away free crypto. 

There’s one major string attached to taking out crypto with this uncollateralized loan: Borrowers must pay back the loan and any associated fees within one transaction on the blockchain. If a trader can’t repay funds to the dApp offering the flash loan within a few seconds, the crypto instantly returns to the DeFi protocol’s treasury. 

How do flash loans work? 

Flash loans work thanks to the coding instructions in blockchain-based programs called smart contracts. Think of smart contracts as digital automated agreements that execute commands according to their code. 

In the case of flash loans, a smart contract knows whether the borrower repaid their loan within the same transaction, and it only releases funds to the requesting crypto wallet if it registers this transaction data on the blockchain’s payment ledger. For borrowers who don’t repay the flash loan in an instant, the smart contract automatically reverses the transaction to put the loaned crypto back into the dApp’s digital vault. 

What are flash loans used for? 

Since flash loans don’t have long-term interest repayment schedules like traditional loans, they’re only suitable for a few high-speed trading scenarios. Often, traders who use flash loans have tools like high-frequency trading algorithms, artificial intelligence (AI) software assistants, and bots to fulfill the demands for flash loans in milliseconds and pocket a profit from their trading activity. 

Here are a few use cases of flash loans:

Flash loan arbitrage

Traders search for discrepancies between the price of the same crypto asset on two markets and use flash loans to maximize their position size when swapping this cryptocurrency. 

For example, if centralized exchange (CEX) Gemini lists Ethereum (ETH) as $2,500 per coin, while ETH on decentralized exchange (DEX) Uniswap trades for $2,750, an arbitrageur takes out a flash loan, buys ETH on Gemini, sells ETH on Uniswap, and repays the loan in one transaction. 

Self-liquidation

While crypto traders aim to avoid liquidation, some situations exist where it makes more sense to self-liquidate a bad position with a flash loan rather than pay liquidation fees. 

To execute a self-liquidation, traders typically take out a flash loan, repay the collateral on another crypto loan, and use the collateral to pay off the flash loan. This trade setup makes the most sense if the fees to take out a flash loan are cheaper than liquidation costs and if traders don’t have the funds to close a crypto position.

Collateral swaps 

Suppose traders have an outstanding crypto loan, and the asset they used as collateral keeps dropping. Here, flash loans provide a way to change this crypto collateral with another accepted digital currency. 

For example, a trader took out a crypto loan on Compound with Ethereum as collateral, but they feel more comfortable using Wrapped Bitcoin (wBTC). In this case, the trader:

  • Takes out a flash loan equivalent to their other loan to pay it off

  • Swaps the ETH collateral for wBTC

  • Takes out another loan on Compound with wBTC

  • Uses the borrowed funds to pay off the flash loan 

This strategy is helpful to avoid the threat of margin calls and liquidation if the asset used as collateral continues to drop.  

Are flash loans risky? 

While flash loans are common financial products on DeFi lending sites, they’re typically considered high risk due to their fast execution speed and the large amounts traders take out with these products. 

Also, since flash loans rely heavily on smart contracts, there’s a risk of bugs or vulnerabilities in the dApp’s code. This opens the door to hacks and other safety threats to the integrity of this service. If traders want to use flash loans, they must work with crypto loan projects with a solid reputation in DeFi and transparent third-party smart contract audits. 

There are also debates over whether crypto flash loans as a product category are a safe idea for the entire crypto space. Since the release of flash loans, there have been multiple major hacks and exploits on DeFi dApps with this technology. Flash loans can put into question the integrity of crypto lending protocols and impact the liquidity throughout DeFi due to their large transaction sizes. 

On the positive side, the extra liquidity from flash loans corrects price discrepancies when traders use arbitrage opportunities. In other cases, however, these spikes in volume lead to greater price volatility for digital assets. While proponents of flash loans argue the uniqueness of this service outweighs its potential adverse effects, critics believe it increases the vulnerabilities and uncertainties of the growing DeFi sector. 

Can flash loans be profitable? 

Even if a strategy works out for a crypto trader using flash loans, it’s never guaranteed to be worth the risk. For example, remember the crypto trader who took out a $200 million flash loan only to receive $3 in profit? 

The competition to snatch opportunities for crypto price arbitrage is fierce, and it’s challenging to snag great opportunities when countless other traders have high-frequency trading algorithms ready to pounce on these discrepancies. In fact, flash loans come with many fees, including blockchain network fees (or gas fees), capital gains taxes, and any extra costs dApps charge for issuing these loans. 

Lastly, since flash loans often involve large amounts of cryptocurrencies, they sometimes trigger price fluctuations on exchanges, which may lead to a mismatch between a trade’s quoted and actual price (aka slippage). If the price slippage during a flash loan is too high, it either eats into a trader’s profits or creates a loss. 

Although traders can profit from flash loans, they must factor these risks and expenses into their strategy for the most realistic outlook.

What happens when borrowers don’t pay back flash loans?

Not paying back a flash loan typically results in immediate and significant consequences due to the unique nature of these loans in the cryptocurrency and DeFi spaces. Here are the key consequences:

  • Automatic liquidation: If a borrower doesn’t repay a flash loan, the transaction is automatically reversed. This means any actions taken with the borrowed funds are undone as if they never happened.

  • Loss of transaction fees: Although the transaction is reversed, traders still lose any transaction fees paid to the blockchain network. These fees can be substantial, especially on networks with high gas prices like Ethereum.

  • Loss of collateral (if applicable): In some DeFi protocols, if traders use a flash loan for leveraging positions and fail to repay, they might lose any collateral they've put up.

  • Reputational damage: In the DeFi community, trust and reputation are important. Failing to repay a flash loan might harm a borrower’s reputation, especially if they’re a frequent user or a known entity in the space.

  • Potential for financial loss: If a borrower uses the flash loan for complex financial maneuvers like arbitrage, failing to repay could mean they’re left with an unprofitable position, resulting in financial loss. 

Deepen your DeFi wisdom on dYdX Academy 

Want to learn more about the unique possibilities in DeFi? Enroll in dYdX Academy. On our education hub, you’ll find easy-to-read guides and tutorials for dozens of hot DeFi topics, including liquidity pools, crypto staking, and yield farming. Also, for eligible traders, dYdX offers a low-fee decentralized exchange for swapping crypto perpetual contracts. Visit our official blog  for more details on dYdX’s latest products and services, and eligible traders can start trading on dYdX today. 

Disclosures

The content of this article (the “Article”) is provided for general informational purposes only. Reference to any specific strategy, technique, product, service, or entity does not constitute an endorsement or recommendation by dYdX Trading Inc., or any affiliate, agent, or representative thereof (“dYdX”). Use of strategies, techniques, products or services referenced in this Article may involve material risks, including the risk of financial losses arising from the volatility, operational loss, or nonconsensual liquidation of digital assets.  The content of this Article does not constitute, and should not be considered, construed, or relied upon as, financial advice, legal advice, tax advice, investment advice, or advice of any other nature; and the content of this Article is not an offer, solicitation or call to action to make any investment, or purchase any crypto asset, of any kind.  dYdX makes no representation, assurance or guarantee as to the accuracy, completeness, timeliness, suitability, or validity of any information in this Article or any third-party website that may be linked to it.  You are solely responsible for conducting independent research, performing due diligence, and/or seeking advice from a professional advisor prior to taking any financial, tax, legal, or investment action.

You may only use the dYdX Services in compliance with the dYdX Terms of Use available here, including the geographic restrictions therein.

Any applicable sponsorship in connection with this Article will be disclosed, and any reference to a sponsor in this Article is for disclosure purposes, or informational in nature, and in any event is not a call to action to make an investment, acquire a service or product, or purchase crypto assets.  This Article does not offer the purchase or sale of any financial instruments or related services.

By accessing this Article and taking any action in connection with the information contained in this Article, you agree that dYdX is not responsible, directly or indirectly, for any errors, omissions, or delays related to this Article, or any damage, injury, or loss incurred in connection with use of or reliance on the content of this Article, including any specific strategy, technique, product, service, or entity that may be referenced in the Article.