3

I am just a beginner trying to understand technical details of bitcoin. As far as I know, the Merkle root of a block works to provide summarizing hash of list of transactions. And according to my understanding, mining works by first hashing block header, appended with some bits and testing whether the resulting hash satisfies difficulty requirement.

My confusion is this: when hashing to perform mining, is Merkle root included? I am asking this as if Merkle root is included, then this would mean that mining depends on the transactions chosen to form a block. Thus it seems to me that if this is the case, then a miner can, by luck, choose some group of transactions that turns out to provide the hash that is under then target faster than other agents, assuming that other conditions are equal.

3
  • "some group of transactions that turns out to provide the hash that is under then target faster": why? if that is the case, the hash function would be considered completely broken Mar 26, 2017 at 18:05
  • but then it's just enough for group of transactions that turn out to be faster very difficult to know beforehand. After all, doesn't most cryptography work this way?
    – Geo Mez
    Mar 26, 2017 at 18:11
  • Every hashing attempt has the same chance at being below the target, independent of any other related attempts. If that is not the case, the hash function is broken. Mar 26, 2017 at 18:44

1 Answer 1

2

[…], mining works by first hashing block header, appended with some bits and testing whether the resulting hash satisfies difficulty requirement.

Yes, although it's actually just the block header that is being hashed. One part of the block header is the nonce that allows to try 232 different possible block headers for the same block template. Another part of the block header is the Merkle root of the transaction tree, which must be recalculated when the extra-nonce in the coinbase transaction or the transactions included in the block template are updated.

The Merkle root has to be included in the block header because that's what cryptographically ties the transactions to the block in the first place.

No miner can predict whether a particular set of transactions would give them an advantage to find a block quicker, because the only way of doing so would be to try out all the possible options, which is exactly what they are doing anyway when they are mining. This follows from the hashing algorithm being based on a cryptographic hash function. If it weren't true, the hash function would be broken.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.