Answer · Answers

What Was a dYdX Flash Loan, and Does dYdX Still Offer Them?

Illustration of tokens leaving one vault, passing through a swap, and returning
On this page

The short answer

A dYdX flash loan was a loan with no collateral that a smart contract borrowed and repaid within a single Ethereum transaction, using dYdX’s old Solo margin protocol. If the money wasn’t returned by the end of the transaction, the whole transaction reverted as if nothing had happened. dYdX charged no fee: you repaid the amount plus about 2 wei, a negligible sum, which made it a popular free source of flash liquidity for arbitrage and liquidation bots between 2019 and 2021.

That premise is now out of date. dYdX moved its Ethereum spot, margin and lending protocol into close-only mode on November 1, 2021, and today’s dYdX is a perpetual futures exchange on its own blockchain, dYdX Chain, with no flash-loan product. If you need a flash loan today, you would use a maintained lending protocol such as Aave.

How dYdX flash loans worked

dYdX never built a function called “flash loan”. The behaviour came from how its SoloMargin contract processed actions. Its operate function accepted a list of actions and only checked that accounts were properly collateralized at the end of the list. That allowed a developer’s contract to:

  1. Withdraw a large amount of a token (such as WETH, USDC or DAI) from dYdX’s pools, temporarily leaving its account with a negative balance.
  2. Call its own function (callFunction) to use the funds, for example to run an arbitrage or repay someone’s debt on another protocol.
  3. Deposit the amount back, plus about 2 wei.

If step 3 failed, the end-of-transaction check failed and every step was reversed. Lenders were never exposed to an unpaid loan, which is why no collateral was required. Using it required writing and deploying a Solidity contract; there was no button in the dYdX app.

Inside one Ethereum transaction Withdraw From Solo pool Call Use funds Deposit Amount + about 2 wei End check Account covered? Check passes Transaction completes Check fails Every step reverts
Solo checked the account only after all actions ran. A successful repayment completed the whole transaction; a failed check reversed every action.

Does dYdX still offer flash loans in 2026?

No. Here is how dYdX changed:

Period dYdX product Flash loans?
2019–2021 Solo protocol on Ethereum: lending, borrowing, spot margin Possible via operate, no fee
From November 1, 2021 Solo in close-only mode; new borrows disabled; focus on perpetuals Not supported
2021–October 2024 dYdX v3 perpetuals on a StarkEx layer 2 No
Late 2023 onward dYdX Chain (v4), a Cosmos SDK blockchain for perpetuals No flash-loan product

The Solo contract still exists on Ethereum, since smart contracts can’t be deleted, and our on-chain check in November 2026 found residual balances still in it: about 1,600 WETH, 0.8 million USDC and 1.5 million DAI. But dYdX stopped supporting the protocol in 2021, the remaining balances are small, and we have not verified whether flash loans against it still execute. Old tutorials that point to SoloMargin should be treated as historical.

dYdX Chain itself is built for order-book trading of perpetual contracts, with no lending pools to borrow from. For what the platform does offer now, see margin trading on dYdX.

Where flash loans are available today

Protocol How flash loans work Fee
Aave V3 flashLoan (multiple assets) and flashLoanSimple (one asset) 0.05% on Ethereum as of November 2026 (FLASHLOAN_PREMIUM_TOTAL = 5 basis points), adjustable by governance and can differ by deployment
Morpho A single flashLoan function on the core Morpho contract, repaid in the same transaction No fee, per Morpho’s documentation
Uniswap “Flash swaps”: receive tokens from a pool first, then pay or return them in the same transaction About the pool’s swap fee (roughly 0.3% on Uniswap V2 pools)

Aave’s multi-asset flashLoan can also leave the borrowed amount open as a normal collateralized debt instead of repaying it, which is used for collateral swaps and leverage adjustments. See how lending works on Aave and our Aave vs Compound comparison; Compound III has no native flash loan function.

What flash loans are used for

  • Arbitrage: buying an asset where it is cheaper and selling where it is dearer, repaying the loan from the difference. (The original version of this page gave an example of buying bitcoin at $41,000 and selling at $40,800 for an $800 profit; that is a $200 loss per coin, not a gain.) In practice, these gaps are tiny and contested by professional bots within the same block.
  • Collateral swaps: replacing one collateral asset in a DeFi loan with another without first repaying the debt.
  • Self-liquidation and refinancing: repaying a loan that is near liquidation, withdrawing the collateral, and selling part of it to repay the flash loan, which can cost less than being liquidated.
  • Liquidations: bots borrow funds to repay undercollateralized loans and collect the liquidation bonus. See forced liquidation.

The old page also claimed flash loans “minimize transaction fees”. They don’t: a flash loan transaction bundles many steps and typically costs more gas than a simple transfer, plus any protocol fee.

Flash loan attacks

Because flash loans give anyone temporary access to large sums, they are a common ingredient in DeFi exploits. Attackers borrow heavily, manipulate a thinly traded price that a protocol uses as an oracle, borrow or withdraw against the distorted price, and repay the loan in the same transaction. The flash loan is not the bug: the vulnerable protocol’s design is. Robust price oracles and audits reduce this risk. Read more about smart contract vulnerabilities.

What enables a flash loan attack? Flash loan: ingredient Supplies temporary capital and enables a large trade Protocol design: the bug Trusts a distorted price for borrowing or withdrawal Exploit outcome Borrow or withdraw at a distorted price Risk reduction: robust price oracles and audits
The flash loan provides scale, but the exploitable trust assumption belongs to the vulnerable protocol. Robust price oracles and audits target that design risk.

Risks and red flags

  • Flash loans are not a money-making product for ordinary users. Profitable opportunities are found and captured by specialized bots.
  • “Flash loan arbitrage” scams. Videos and tutorials that ask you to deploy a pre-written contract and send it ETH “for gas” or “liquidity” often contain code that sends your funds to the scammer. Never deploy or fund code you can’t read.
  • Failed transactions still cost gas. If a flash loan reverts, you pay the gas for the failed attempt.
  • Smart contract risk. Bugs in your own contract or in any protocol it touches can lose funds.

Nothing here is investment advice. For the basics of borrowing in DeFi, start with DeFi loans explained for beginners and what a DeFi loan can be used for.

Frequently asked questions

Does dYdX offer flash loans?

No, not as a supported product. Flash loans on dYdX relied on its Ethereum Solo contract, which dYdX moved to close-only mode on November 1, 2021. dYdX Chain, the current version, is built for perpetual futures trading and offers no flash loans.

What was the dYdX flash loan fee?

Effectively zero. dYdX charged no flash-loan fee; the borrower repaid the borrowed amount plus about 2 wei, a negligible amount, and paid the normal Ethereum gas for the transaction.

When did dYdX introduce flash loans?

dYdX never launched a flash-loan product as such. The technique became possible with its Solo protocol, launched in 2019, whose operate function let a contract withdraw, use and redeposit funds within one transaction.

Can I still use the old dYdX SoloMargin contract for flash loans?

The contract is immutable and still holds residual balances on Ethereum, but dYdX stopped supporting it in 2021 and we have not verified whether flash loans against it still execute. Developers today use maintained protocols such as Aave or Morpho instead.

Are flash loans legal?

Flash loans are a standard, legal smart contract feature. Using one to manipulate markets or exploit a protocol can still be illegal.

Sources

  1. dYdX: Layer 1 Wind Down (October 4, 2021)
  2. StudyDeFi Money Legos: dYdX flash loans (Solo operate example)
  3. Aave documentation: Flash loans (V3)
  4. Morpho documentation: Flash loans
  5. dYdX Docs: Architecture overview
  6. Uniswap docs: Using flash swaps (V2)
  7. Etherscan: dYdX SoloMargin contract

Educational content, not financial advice. DeFi carries risk, including total loss of funds.

↑↓ to navigate ↵ to open Esc to close