What is a flash loan?
In short
A flash loan is an uncollateralized crypto loan that must be repaid within the same transaction, along with any fee. If it isn’t repaid, the transaction is reverted.
You borrow funds without putting up collateral, but you can’t hold on to them even until the next transaction? In decentralized finance (DeFi), this happens through a smart contract, meaning code that executes predefined rules on the blockchain.
Picture a merchant who temporarily lends you money to buy a product from one store and sell it for more at another. The deal only stands if every step is completed and the merchant gets their money back. Otherwise, it’s as if the purchases and transfers never happened.
In a flash loan, borrowing, using the funds and repaying are steps of a single transaction that executes either in full or not at all. The contract checks that the amount and the fee, where there is one, have been returned. If the check fails, the transaction’s changes are reverted. There’s no room for the borrower to promise to pay later.
Why it matters
A common use is arbitrage, meaning taking advantage of a price difference between markets. Someone can borrow funds, buy a token on one decentralized exchange and sell it for more on another. If there’s a difference left after repayment and costs, that’s their profit.
Flash loans can also be used to swap the collateral on a loan or to liquidate positions on lending protocols. We think what’s interesting is access to temporary liquidity without upfront collateral, not the promise of easy profit. Using them usually requires code or specialized tools.
What to watch out for
Reverting doesn’t mean zero cost: a failed transaction can still be charged for the computational resources it consumed, known as gas. Fees, price changes and competing transactions can also wipe out an expected profit.
Flash loans are also used in attacks, because they temporarily give access to large amounts of capital. An attacker can exploit weaknesses in a protocol’s code or in the way it calculates prices. A flash loan isn’t an exploit in itself, but it can amplify the damage when a vulnerability exists, affecting even users who have simply deposited funds in the protocol.