So the question is can you bundle 3 transactions into one transaction where the first transaction borrows using a flash loan executes certain conditions, requires a middle victim transaction be executed (note the attacker is viewing the mempool waiting for this victim transaction), then after this 2nd victim transaction is executed pay back the flash loan possibly in a 3rd transaction. So the real question is can an ethereum transaction require an independent party's transaction in the middle and use a flash loan borrow before and payment after victim transaction, but note this is all within one block?

1 Answer 1


Flashloans lifecycle is limited to a single transaction, and cannot be used in a sandwich attack.

  • Flash loans must happen in one transaction. If you do not refund the token you get from flash loan pool, the transaction will be reverted. So you can not use flashloan for the sandwich attack even though all three transactions happen in same block. Sep 12, 2023 at 10:52
  • So for clarity, a sandwich attack doesn't roll 3 transactions in to 1 transaction (as alluded to in the question), but bundles 3 transactions to land in a row. And as pointed out, needs to be repaid within the same tx when the function you called to borrow, makes a callback for the repayment.
    – Maka
    Sep 12, 2023 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.