1

Transaction order in a block matters, since that's the order those transactions are executed and take effect on the state of the EVM. But what or who decides the order of transactions? Is it hard-coded based on the price of gas paid by the sender, so that TXs with higher gas paid would be ordered first? Or is it completely up to the miner to decide the order of transactions in a proposed block?

3

It depends, really. Some miners on the Ethereum chain, like Ethermine, use non-conventional ordering for their benefit, aka they generally don't do the by-gas sort. Other miners can choose to sort by gas and nonce, others can choose to sort by gas and first-seen-time, others can first sort by gas and then randomize the order, others can sort by gas first and then put the "greatest" sender addresses at the top or bottom, which is basically converting an address to a 160-bit integer and working with those values.

Most other POA networks that run on the EVM, like BSC or Polygon, generally sort by gas and first-seen-time.

2

The order of transactions (we are talking about transactions with the best gas price) is decided by the miners to make the most profit out for them. To find out more about the subject google keywords Miner Extractable Value (MEV)

For example, if you send a transaction to buy some large amount of tokens, the miner will insert his own transaction to buy this token before you, amd make some money. So, the order of transactions "will depend" so to speak. They all have their own custom algorithms and nobody knows how they maximize profits, this is part of the dark forest (also keyword) of Ethereum

1
  • I suppose this would also imply that if I code my flash loan TX to bribe the miner with a portion of the profits to be made, this would give me more advantage over front-runner bots trying to execute the same transaction. Would that be correct? Jul 4 at 10:18

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.