# Are the blocks produced by different nodes in the network comparable in terms of the order of transactions contained in them?

Having a transaction from person A to B and another transaction from person C to D that both took place in more or less the same time I assume that there might be a situation in which different nodes will receive these transactions in different order. Both transactions are valid but the order in which they will be included into the block will be different for mining nodes and therefore they will produce different hash / nonce / Proof of Work.

Is my assumption correct and if so then does it even matter? Or it is a natural thing that blocks produced by different nodes will be completely different in terms of order of the transactions (and maybe in terms of number of transactions contained in them) and the only thing that matters is correct nonce needed for proof of work (and if it's being found then the block will be accepted by other nodes).

I am happy to hear if answer to my question would be different in case of other projects (e.g. Ethereum or Cardano).

The order that two independent transactions appear in a block does not matter. It has an effect on the block hash, but so too do many other things. As a last resort, miners may choose to reorder the transactions in their block in order to achieve a different hash, but there are far easier things to do first.

However miners that use the block assembly algorithm implemented in Bitcoin Core are likely to result in blocks that have transactions in the same order. This algorithm does not take into account the time that a transaction was received as it's irrelevant. What it does account for are dependencies and fee rate (specifically ancestor set fee rate). Transactions with a higher ancestor fee rate will be included first, so two nodes constructing the same block will have a similar transaction order. That being said, there is still some randomness in the ordering when transactions have the same ancestor fee rate as the order at that point is not defined.

• If A has 1 btc and B has 0 btc and A sends one btc to B with fee equal to x and then B sends this 1 btc back to A with fee 2x then I assume that this 2nd transaction couldn't be included first (even though it had higher fee). But maybe this case is covered by what you meant by "dependencies". Commented Oct 7, 2023 at 19:35
• Yes. The 2nd is dependent on the 1st, and so it must come after. That's really the only consensus rule regarding sorting.
– Ava Chow
Commented Oct 7, 2023 at 19:50

Two or more miners might produce a new block at the same time with different transactions or transactions in a different order.

There can only be one block accepted at any specific block height. Which means only one block with a specific parent (previous) block.

Every node independently chooses which of several competing blocks it accepts in its live blockchain. Since all nodes use the same rules, they all end up choosing the same block eventually.

This means that eventually, all nodes have identical blocks (though probably not stored in the same order on disk)