0

On BSC chain, i am facing this situation.

I am scaning mempool for a transactions ( nodejs and web3.eth.subscribe('pendingTransactions', ...) ) and when i find the one i am concerned, i fire a transaction with same params (gas, gasprice). The weird thing (in my opinion) is that in many cases my transaction is mined in the same block but BEFORE the one i am monitoring. (eg mine is at position 10 in the block, monitored transaction at position 20)

It is assumed that this can happen?

As far as i have understand how miners works, network shouldnt allow transactions (with same gasprice) to overrun existed transactions with same params. Or i am missing something here?

1
  • There are no rules for transaction ordering, a miner can sort transactions in any order they want.
    – Ismael
    Apr 8 at 23:04
0

As Ismael mentioned, miners are free to include transactions in any order they wish. The only constraints they have is that the transactions need to: 1) be valid 2) lower nonce from the same account can't be after a higher nonce from the account.

Transaction ordering may even affect which transactions get reverted: if, for example, two transaction try to do something which can be done only once, the latter one will revert.

Otherwise, miners typically order transactions based on their gas price (or miner fee), due to getting maximum rewards. But nothing forces them to act like that, so they can do almost whatever they want.

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.