A flash loan is arguably the most unusual instrument in decentralized finance (DeFi, financial services without banks or intermediaries, built on smart contracts). It lets you borrow any available volume of cryptocurrency with no collateral at all, but with one hard condition: everything must be returned within the very same blockchain transaction in which you borrowed. If you do not return it, the loan is treated as if it was never issued.
It sounds like a trick, and that is essentially what it is. Traders use flash loans for arbitrage (profiting from price differences between venues), collateral swaps, and complex multi-step strategies that would require large capital on hand in conventional finance. For an intermediate trader, this is a door into advanced DeFi operations and sources of profit that simply do not exist in traditional finance.
The main advantage here is capital efficiency. You do not need your own reserves to execute a million-dollar trade: you borrow that million for a fraction of a second, exploit the market inefficiency, return the loan, and keep the difference.
MECHANICS
A flash loan is executed as a single atomic transaction (atomic: indivisible, either everything goes through entirely or nothing happens at all). The borrower takes funds from a lending protocol and immediately puts them to work, for example in an arbitrage trade between two decentralized exchanges (DEX). The profit from that operation, minus a small protocol fee (usually 0.09% to 0.3%), goes toward repaying the principal and the fee itself.
The entire reliability of the scheme rests on this atomicity. If the loan is not repaid by the end of the transaction, the blockchain rolls it back completely: the funds have gone nowhere, there was technically no loan, and there are no losses (other than the gas already paid). The lender is therefore guaranteed to get the money back, and the borrower ends up in profit only if the strategy worked profitably within that same transaction.
Let's walk through the numbers. A trader borrows 1,000 ETH. On DEX A they buy ETH at $3,000, and on DEX B they immediately sell it at $3,005. The $5 difference per ETH yields a gross profit of $5,000. The protocol fee of 0.1% on 1,000 ETH comes to roughly $100. After subtracting it, the net profit of $4,900 together with the principal is returned to the lending protocol, and the earnings stay with the trader. If the prices had converged and the spread disappeared before the sale, the transaction would simply have rolled back, and the trader would have lost only the gas.
EXECUTION
In practice, a flash loan is not a button but a pre-written smart contract that carries out the entire chain of actions in a single call. Time sensitivity is critical: the opportunity lives only until the next block. A typical scenario looks like this:
- Find a profitable arbitrage spread between two or more DEXes.
- Choose a DeFi lending protocol that offers flash loans and a suitable audited smart contract (your own or a ready-made one) that automates the "borrow, trade, repay" cycle.
- Calculate the exact loan amount based on the spread size and the available liquidity on both venues.
- Launch the contract: it takes the flash loan, immediately executes the arbitrage trades, returns the principal plus the protocol fee, and transfers the remaining profit to your wallet.
If anything does not add up at any of these steps (the spread disappeared, liquidity was insufficient, the calculation did not close in profit), the entire transaction rolls back, and the profit transfer simply never happens.
COMMON MISTAKES
The most common beginner mistake is underestimating gas fees (gas, the network's payment for computation). Complex interactions with smart contracts are expensive, and on narrow spreads gas can completely eat up all the arbitrage profit. Always factor in a gas estimate when calculating the potential P&L (profit and loss) before launching the contract.
The second trap is insufficient liquidity on one of the venues. If the market is too "thin" and the entire loan volume cannot be filled at the expected price, the arbitrage does not work. In the best case the transaction rolls back; in the worst case (with partial execution) you end up with a loss. Before launching, confirm that market depth is sufficient for the full trade volume, not just its beginning.
And finally, the security of the contract itself. Unverified or poorly audited code through which a flash loan passes exposes capital to exploits (exploit, an attack through a vulnerability). Work only with reputable protocols and audited contracts so that the profit-making instrument does not become a backdoor for an attacker.
RISK MANAGEMENT
Flash loans require no collateral, but that does not mean they are risk-free. The main risk is that the strategy does not close in profit within a single transaction: the trade rolls back, but the gas has already been paid. To keep such misfires from hitting your wallet, size your strategy so that the maximum gas cost does not exceed 1% of the borrowed capital. On a large loan, the fixed gas cost becomes a negligible fraction, and that works in your favor.
Direct liquidation (the forced closure of a position at a loss), as in margin trading, does not exist here thanks to atomicity. But the risk of a smart contract failure or exploit is significant. The contract logic is worth thoroughly testing and auditing, and the volume of capital in any single flash strategy should be kept at a level that would not put the entire portfolio at risk if something goes wrong.
Keep slippage (the deviation of the actual price from the expected one) in mind separately. If the market moves between when you spotted the opportunity and when the contract executes it, the price may have shifted against you. Model the worst-case scenario in advance and only take strategies where even a 0.5% unfavorable price movement still allows the loan and the fee to be repaid.
How to tell a real opportunity from a false one: a genuine arbitrage spread survives the deduction of gas, the protocol fee (0.09-0.3%), and a 0.5% slippage buffer and still comes out positive. If profit disappears after any of these deductions or holds up on adequate liquidity only for part of the volume, that is a false signal, and the contract should not be launched.