1

I'm trying to better understand flashbots impact on frontrunning. Can anyone help me understand why this sandwich attack tx from a Flashbots bundle would pay such a high gas price? Here is a similar question but I'm specifically interested in the Flashbots aspect as I thought that would avoid the high-gas requirement.

enter image description here https://gist.github.com/j2abro/7c31b1150ff079a47cf5ff19c5699c7c

Here are the three transactions:

And here are all the flashbot transactions for the block from the Flashbots API.

Any insight appreciated!

2 Answers 2

1

As you already mentioned I found the solution in the following paper, if you are interested you really should read it! https://pub.tik.ee.ethz.ch/students/2021-FS/BA-2021-07.pdf

Basically, there are a lot of bots trying to win the "Flashbots Auction". In the beginning, there weren't as many bots that tried to do this so there was much more profit to be made. Nowadays the profit is spent to bribe the Miners to take their transaction.

Hope I have helped you to understand it a bit better!

Have a nice day!

1

The reason for this is generally the last transaction in the bundle is the one that pays the miner tip.

Basically, anything in excess of the required gas goes to the miner. It's weird now that Type 2 transactions are the standard. You don't need to directly tip you just include it in the gas price.

I typically have an amount that is a percentage of my expected profits from the simulation, and I add that value to the base fee as a tip for the miner.

Example:

// "PRIORITY_GAS_PRICE" is a variable that I set that is effectively the miner tip.

const gasEstimates = await Promise.all(bundledTransactions.map(tx =>
    provider.estimateGas({
      ...tx,
      from: tx.from === undefined ? walletExecutor.address : tx.from
    }))
  )
  const gasEstimateTotal = gasEstimates.reduce((acc, cur) => acc.add(cur), BigNumber.from(0))
  const block = await provider.getBlock("latest");
  const gasPrice = PRIORITY_GAS_PRICE.add(block.baseFeePerGas || 0);

Good luck, let me know if you have any other questions.

--0xc0ffe3

1
  • So there are (potentially) multiple bundles in a block and it's the last tx in the bundle that pays the miner. But to clarify: it's the tipping miner that gets to specify the order of those 3 txs in the bundle, right?
    – j2abro
    Jul 4, 2022 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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