← Glossary

Trading & DeFi

What Is a Flash Loan? Borrowing Millions for One Transaction

A flash loan is an uncollateralised loan of any size that is taken out and repaid within a single blockchain transaction, which reverts entirely if the loan is not repaid by the end.

Key takeaways

What makes it possible

Blockchain transactions are atomic: either everything in a transaction succeeds or all of it is undone. A flash loan uses this. A smart contract lends a sum, the borrower uses it for a series of actions and the transaction must end with the loan repaid, usually plus a small fee. If repayment fails, the entire transaction reverts as if nothing had happened. Because of that, the lender takes no risk, and no collateral is needed.

Legitimate uses

Flash loans can fund arbitrage across exchanges without the trader owning the capital, let borrowers swap the collateral on a loan in one step or help refinance a position into a cheaper protocol. They open up large-scale strategies to small participants, who pay only the fee and gas.

Why they feature in attacks

The same property gives attackers temporary access to enormous funds. Encyclopedic accounts note that exploits of DeFi platforms have used flash loans to manipulate cryptocurrency spot prices. An attacker borrows a huge amount, distorts the price in a thin pool that a protocol relies on as its price source, profits from that protocol's reaction and repays the loan, all in one transaction.

What this means for users and builders

A flash loan is a tool that is neither good nor bad. The lesson is that protocols must not depend on a single easily moved price, and should use robust oracles and checks. As a user, it explains why some DeFi hacks happen without an attacker owning any funds. Check whether a protocol you use has been audited and how its prices are sourced, and keep exposure modest.

Example

In one transaction, a contract borrows 10 million dollars, uses it to move the price in a small pool that a lending protocol trusts, borrows against the inflated price, repays the flash loan and keeps the profit. If any step failed, the whole sequence would revert.

Put it into practice

Prefer protocols that source prices carefully

Prices that can be moved cheaply are a risk. Scrypt Price explains how its prices are built from multiple independent venues, which makes them harder to push.

Explore Scrypt Price Get Scrypt for Android

Frequently asked questions

Are flash loans free?

There is usually a small fee, plus the network fee for the transaction.

Can I use one?

Yes, but you need to write or use a smart contract that completes all steps and repays in the same transaction.

Are they illegal?

The tool is not, but using it to exploit a protocol can be unlawful. Rules vary.

Related terms

Go deeper

Written by the Scrypt Wallet team · Updated 2026-10-02. General education, not financial, tax or legal advice.