<p>Yes, the order matters. Changing the order of bytes of data being hashed will result in a different hash. Thus changing the order of transactions for the merkle root will also result in a different merkle root. There is no requirement that miners try different orders of transactions. But they may choose to do that instead of re-selecting transactions for the block. Note that transaction order does matter (coinbase must come first, parents must come before children, etc.) so a miner cannot try all possible permutations of transactions.</p>

CC BY-SA 4.0
2019-02-01T20:21:28.413Z
2019-02-01T20:21:28.413Z
Ava Chow
<p>After reading that Mining involves Taking a root hash of a transaction and combining that hash with a nonce it is required to find a number that is equal or below the given target, i was wondering if you have to try different orders of hashing the transactions or you just hash them all at once. For example does it make a difference if i hash a transaction A first and then transaction B or B first and then A.</p>

<transactions><hash>
Hashing Transactions for Mining
Иосиф Виссарионович Сталин
# Hashing Transactions for Mining

(Asked by: username_0 on 2019-02-01)

After reading that Mining involves Taking a root hash of a transaction and combining that hash with a nonce it is required to find a number that is equal or below the given target, i was wondering if you have to try different orders of hashing the transactions or you just hash them all at once. For example does it make a difference if i hash a transaction A first and then transaction B or B first and then A.

**Tags:** transactions, hash


---

## 1 answers

### Answer by username_1 on 2019-02-01. Score: 1

Yes, the order matters. Changing the order of bytes of data being hashed will result in a different hash. Thus changing the order of transactions for the merkle root will also result in a different merkle root. There is no requirement that miners try different orders of transactions. But they may choose to do that instead of re-selecting transactions for the block. Note that transaction order does matter (coinbase must come first, parents must come before children, etc.) so a miner cannot try all possible permutations of transactions.


---

