Hashing Transactions for Mining

2

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.

Иосиф Виссарионович Сталин

Posted 2019-02-01T19:58:58.137

Reputation: 31

Answers

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.

Andrew Chow

Posted 2019-02-01T19:58:58.137

Reputation: 40 910