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

<p>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 2<sup>32</sup> 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.</p>

<p>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.</p>

<p>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.</p>

CC BY-SA 3.0
2017-03-27T13:37:07.643Z
2017-04-26T16:02:54.307Z
2017-04-26T16:02:54.307Z
Murch
<p>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. </p>

<p>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.</p>

CC BY-SA 3.0
2017-03-26T18:05:19.497Z
"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
Pieter Wuille
CC BY-SA 3.0
2017-03-26T18:11:37.097Z
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
CC BY-SA 3.0
2017-03-26T18:44:43.220Z
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.
Pieter Wuille
<mining-theory><hash>
When mining, does one also include Merkle root data into block header when testing for hashes?
Geo Mez
# When mining, does one also include Merkle root data into block header when testing for hashes?

(Asked by: username_0 on 2017-03-26)

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.

**Tags:** mining-theory, hash

> **Comments:**
> **username_1**: "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  
> **username_0**: 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?  
> **username_1**: 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.  

---

## 1 answers

### Answer by username_2 on 2017-03-27. Score: 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.


---

