I'm building a DAPP game that would require users to submit a transaction after a specific block. The first one to have a transaction submitted and processed wins the round. As soon as the first transaction gets processed, the smart contract sets a locked flag so that others can't execute the winning function call.

My questions are when 2 or more people submit a transaction at the same block:

1 - Would paying a higher gas fee make a transaction precede another within the same block?

2 - How feasible would it be for a miner to manipulate the transaction orders so they can say which is the winner?

3 - If 5 transactions are submitted at the same block, which variables tell which will be processed first?

  • Miners are always scanning the mempool in the lookuot of the higher earnings, so yes, whoevere sends the higher gas on their tx is going to frontrun all the other txs
    – Julissa DC
    Oct 20 at 20:12
  • Not by definition, miners are free to choose any particular order for transactions. Usually it's highest gas price comes first.
    – Morten
    Oct 20 at 20:23
  • So, if higher gas ordering is the current standard, could I, theoretically, prevent frontrunning by requiring the function to be processed only if the gas price is below a certain threshold?
    – sigmaxf
    Oct 20 at 20:28

Your Answer

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

Browse other questions tagged or ask your own question.