What Is a Solana Flash Loan? How It Works
A Solana flash loan borrows with no collateral and repays in the same transaction. How lenders check it, what it costs and where it breaks.

A Solana flash loan lends you tokens with no collateral and no credit check, on one condition: the money is back before the transaction ends. If the repayment is missing or fails, the network rejects the whole transaction and the loan never existed. Nothing is ever left outstanding, which is why a lending protocol can offer one to any wallet.
That sounds like a loophole. It is two ordinary rules working together: a transaction is all or nothing, and a program can read the other instructions in the transaction it runs in. Everything a Solana flash loan does, including the ways it breaks, follows from those two facts.
How a Solana flash loan works inside one transaction
Solana runs a transaction as a list of instructions, in order. The Solana documentation on transactions states the rule plainly: if any instruction fails, the entire transaction fails and every state change is reverted. A flash loan is a list built around that rule.
- Borrow. The lending program moves tokens from its vault into your token account.
- Use. Your own instructions spend them: a swap, a liquidation, a deposit elsewhere.
- Repay. The lending program takes the same amount back, plus its fee if it charges one.
If step three cannot run, say because a swap returned less than planned, step one is undone with everything else and the vault ends where it started. No collateral is needed for the same reason: an ordinary loan needs it because time passes between borrowing and repaying, and here none does.

How the lender knows the repayment is coming
The borrow runs first, so it must decide before the repay has happened. It reads ahead: Solana exposes every top-level instruction of the running transaction through a special account, the instructions sysvar, and the Solana guide to instruction introspection names exactly this use: checking that a specific instruction sits in the same transaction.
Kamino Lend publishes its program source, and it shows the check. Its flash borrow walks every instruction after its own and refuses to lend unless it finds exactly one matching repay:
- the repay names the same amount;
- it lists the same accounts, in the same order;
- it points back at the borrow's position;
- no second flash borrow follows.
Like the other two lenders below, Kamino refuses a borrow called from inside another program, because the sysvar lists only top-level instructions. marginfi frames the loan differently: a start instruction checks that an end instruction sits later in the transaction, and the end runs the account's health check.
Details matter. Kamino's repay carries the borrow's position as a number, so a wallet that inserts its own guard instruction ahead of the borrow makes the repay point at the wrong instruction, and it is refused. Jupiter Lend's payback carries no position, which is one reason the Flash Volume tool borrows there.
Which Solana lenders offer flash loans
Three lending protocols document Solana flash loans in their own developer docs.
| Lender | Lender fee |
|---|---|
| Jupiter Lend | None per its docs, though its admin holds a fee setting |
| Kamino Lend | Set per reserve; a reserve can switch flash loans off |
| marginfi (docs now under Project 0) | None per its docs |
What people use flash loans for
Every job here needs a large amount for a few instructions and nothing afterwards.
- Arbitrage. Buy where a token is cheap, sell where it is dear, repay. If the gap has closed, the sell cannot cover the repay and the transaction reverts.
- Liquidations. The loan repays an unhealthy borrower's debt; the collateral received at a discount, swapped back, repays the loan.
- Collateral swaps and refinancing. Repay a loan with borrowed tokens, withdraw the collateral, swap it or move it to another lender, borrow again, repay.
- Self-liquidation. Paying debt down with your own collateral saves the premium a liquidator would take. Kamino's repay-with-collateral flow does this.
- Looping. Borrow, swap into the collateral asset, deposit, borrow against it, repay. Kamino's Multiply runs on this.
- Trading volume. Buy a token and sell it back in the same pool; the wallet pays only the round trip.
That last case is what the Flash Volume tool does: it borrows SOL from Jupiter Lend, buys your token in one pool on PumpSwap, Raydium, Orca or Meteora, sells it back, repays and pays its fee under one signature, with the full trade price shown before your wallet opens. Anyone reading the transaction sees a borrow, a buy and a sell from one wallet. To keep the tokens, use a Jupiter-routed token swap instead.
What a Solana flash loan costs
The principal is not a cost; it returns within the same transaction. You pay for everything around it.
The lender's fee. Jupiter Lend and marginfi document fee-free flash loans, and Kamino sets a fee per reserve. Jupiter Lend's admin can still change its fee setting, so Flash Volume reads it before each loan and refuses to build unless it is zero.
Swap fees and price impact. Every swap inside the loan pays its pool's fee, and a large amount against a thin pool moves the price against you twice, as how liquidity pool depth works shows. Set a minimum output on each swap, since a repay that comes up short sinks everything; choosing a slippage value covers the trade-off.
Network fees. The base fee is 5,000 lamports per signature, plus a priority fee priced per compute unit you request, and a flash loan requests far more compute than a transfer. How much priority fee to pay explains how to size it.
A failed loan is cheap, not free: an included transaction that reverts still pays its network fee, as Solana's documentation and Jupiter's flash loan guide both say. One that fails simulation and is never sent costs nothing.

Simulate before you sign. A flash loan that would fail shows up as a failed simulation, and at that point it has cost you nothing.
Limits: transaction size, compute and what the lender holds
A flash loan cannot outgrow one transaction: the v0 transactions these loans use carry at most 1,232 bytes and 1,400,000 compute units. The borrow, the repay, the swaps and their accounts must all fit, which is why builders lean on address lookup tables.
It cannot span two transactions either. The sysvar lists only the running transaction, so a repay in a second one is invisible to the borrow, even inside one Jito bundle. What a Jito bundle guarantees is a separate question.
Then there is what the lender holds. A loan draws on its vault, some lenders add a per-loan cap, and lending can be paused, so the maximum size is a reading, not a constant. Kamino and marginfi also allow one flash loan per transaction.
Risks: wallet warnings and oracle attacks
Expect a wallet warning. Phantom warns when it cannot simulate a transaction cleanly, citing size near the limit and failing transactions among the causes. A flash loan is large and calls a lender and a DEX at once. When a price has moved too far its simulation fails, which is the wallet telling you the loan would not repay.
Every flash loan is also public. Anyone can open the transaction in an explorer, and Wallet Scope's bulk wallet analysis shows the trades and PnL of the wallets behind it.
The darker history belongs to other protocols. A flash loan attack bends a price inside one transaction: the borrowed size pushes a thin pool, and a protocol reading that pool as its price feed acts on the distorted number. Kamino's docs describe time-weighted prices and price bands as the defence. Your own minimum outputs also limit sandwich attacks around a large swap.
Flash loan vs normal loan vs margin
| Flash loan | Collateralized loan | Margin | |
|---|---|---|---|
| Collateral | None | Worth more than the loan | Your deposit plus the position |
| Lasts | One transaction | Until you repay | While the account stays healthy |
| If unpaid | The transaction reverts | Collateral is liquidated | The position is liquidated |
| You pay | Lender fee if any, swap and network fees | Interest while open | Interest plus trading fees |
Collateralized loans and margin carry risk over time, because prices move while they are open. A Solana flash loan has no "while": you can lose a reverted transaction's fee, plus any trading loss your own balance covers.
This article explains how flash loans work and is not financial, investment, legal or tax advice. Trades inside a loan can lose money, and lenders can change terms or pause lending.
Frequently asked questions
Is a Solana flash loan free?
The loan itself can be: Jupiter Lend and marginfi document fee-free flash loans, while Kamino sets a fee per reserve. You still pay swap fees, the network fee and any fee of the tool you use.
Do I need collateral or a credit check?
No. The repayment only has to sit in the same transaction and succeed. Your wallet still needs SOL for the network fee and any shortfall the trades leave.
What happens if the loan cannot be repaid?
The whole transaction is rejected and every change inside it is undone, the borrow included. A transaction included in a block still pays its network fee; one that failed simulation and was never sent pays nothing.
Can a flash loan span two transactions or a Jito bundle?
No. The lender finds the repayment through the instructions sysvar, which lists only the running transaction, so a repay elsewhere does not count, even in the same bundle.
Why do flash loans appear in exploit reports?
They let anyone command a large amount for one transaction. The exploits hit protocols that trusted a spot price from a thin pool the borrowed size could move. Time-averaged prices make that far harder.


