Flash Loan
DEX & liquidity
A flash loan is a loan that is borrowed and repaid inside a single transaction, with no collateral. If the loan is not repaid by the end of the transaction, the whole transaction fails and the loan never happened. On Solana, lending protocols expose flash-loan instructions that a bot wraps around a trade, so it can use more capital than it holds.
Detailed explanation
A flash loan works because Solana transactions are atomic. The first instruction borrows from a lending pool. The instructions in the middle use the money, for example to run an arbitrage route. The last instruction repays the loan plus a fee. The protocol checks that the repayment is there, and if it is not, the transaction fails and the loan is undone.
Because the borrower cannot walk away with the funds, no collateral is needed. The only risk to the lender is that the transaction could be built wrongly, and the protocol closes that off by enforcing the repayment inside the same transaction.
For a bot, the point is size. An arbitrage route that is worth running at ten times the balance in the wallet becomes possible. The cost is the protocol’s borrow fee, which has to be subtracted from the profit, and the limit is how much the lending pool holds.
It does not make a route safe. If the route fails, the transaction fails and still pays its network fees. A flash-loan route is also more complex, so it uses more compute and more of the transaction’s size, and it needs more careful simulation before it is sent.
When you'll see this
You see flash loans in arbitrage and liquidation bots, in transactions that begin with a borrow instruction and end with a repay, and in lending protocols’ documentation where the instructions are listed.
How NoLimitNodes uses this
The flash-loan arbitrage bots we build wrap the borrow and the repay around a route, add the borrow fee to the cost check, and simulate twice before sending. We make no claim about returns.
Related terms
- Atomic Transaction · A transaction that completes in full or has no effect. If one instruction fails, every change is rolled back.
- Triangular Arbitrage · Three swaps through three tokens that end where they began, so a price gap anywhere on the cycle can pay.
- Backrun · A transaction that runs right after another to use the state that one leaves behind, most often to arbitrage a price gap.
- Slippage · The gap between the price you quoted and the price you actually got, set as a tolerance on every swap instruction.
- Compute Unit Budget · The CU limit and price you set with the ComputeBudget program to control how much work and priority fee a transaction uses.