
A flash loan is a loan that is borrowed and repaid within the same blockchain transaction. The protocol lends the funds, your contract uses them—usually to execute some profitable sequence of trades—and the borrowed amount plus a small fee is returned before the transaction ends. If the repayment cannot be completed, the entire transaction reverts as if it had never happened. The lender never takes risk because the loan literally cannot fail.
This atomic guarantee is what lets flash loans be uncollateralized. There is no concept of default within a single transaction—either everything succeeds or everything is rolled back. Lenders earn a fee for providing capital that earns yield otherwise idle; borrowers gain access to liquidity that would be impossible to assemble in any other way. Aave, dYdX, and several other protocols offer flash loans with limits in the tens of millions.
Legitimate uses are mostly arbitrage and collateral swaps. If two DEXs quote different prices for the same token, a flash loan can finance buying low on one and selling high on the other, capturing the spread without any starting capital. The same primitive can refinance collateral across lending markets without unwinding a position. Less wholesome use cases—price-oracle manipulation attacks—have stolen billions and remain one of the most common exploit vectors in DeFi.