<p>By "<a href="https://en.bitcoin.it/wiki/Difficulty" rel="nofollow">difficulty</a>" I mean the number that determines the minimum acceptable hash. Higher difficulties mean lower hash minimums and thus, on average, more hash attempts needed to produce a valid block. (Related terms are <a href="https://en.bitcoin.it/wiki/Target" rel="nofollow">target</a> and <a href="https://en.bitcoin.it/wiki/Dump_format#CBlock" rel="nofollow">nBits</a>).</p>

<p>Every 2,016 blocks there is a difficulty change block. Unless the block is a difficulty change block, the difficulty must be precisely the same as the previous block or the block is invalid.</p>

<p>On a difficulty change block, the difficulty must be precisely what the difficulty algorithm requires or the block is invalid. The algorithm takes into account the amount of time it took to generate the previous group of blocks and computes a new difficulty such that the block generation time will be, on average, once every ten minutes if the network hashing power stays the same.</p>

<p>If you want to see this in the source code, check out the <code>GetNextWorkRequired</code> function in the <code>main.cpp</code> file.</p>

CC BY-SA 3.0
2011-09-23T12:04:19.523Z
2011-09-23T12:04:19.523Z
David Schwartz
<p>Edit: They do not agree on a specific target hash. Any hash lower than or equal to the difficulty is sufficient. This means clients only have to agree on difficulty.</p>

CC BY-SA 3.0
2011-09-23T11:59:01.840Z
Are you asking [how the difficulty is determined](http://bitcoin.stackexchange.com/questions/855/what-keeps-the-block-difficulty-at-10mins)?
David Schwartz
CC BY-SA 3.0
2011-09-23T12:19:09.657Z
Hmm, I had not understood the process correctly. I had thought the network was looking for a specific target but it is looking for any hash lower or equal to the difficulty. So it is enough to agree on the difficulty. Thanks David!
kermit
<blockchain><hash>
How do the clients agree on the target to hash for?
kermit
# How do the clients agree on the target to hash for?

(Asked by: username_0 on 2011-09-23)

Edit: They do not agree on a specific target hash. Any hash lower than or equal to the difficulty is sufficient. This means clients only have to agree on difficulty.

**Tags:** blockchain, hash

> **Comments:**
> **username_1**: Are you asking [how the difficulty is determined](http://bitcoin.stackexchange.com/questions/855/what-keeps-the-block-difficulty-at-10mins)?  
> **username_0**: Hmm, I had not understood the process correctly. I had thought the network was looking for a specific target but it is looking for any hash lower or equal to the difficulty. So it is enough to agree on the difficulty. Thanks David!  

---

## 1 answers

### Answer by username_1 on 2011-09-23. Score: 3 | Accepted answer

By "[difficulty](https://en.bitcoin.it/wiki/Difficulty)" I mean the number that determines the minimum acceptable hash. Higher difficulties mean lower hash minimums and thus, on average, more hash attempts needed to produce a valid block. (Related terms are [target](https://en.bitcoin.it/wiki/Target) and [nBits](https://en.bitcoin.it/wiki/Dump_format#CBlock)).

Every 2,016 blocks there is a difficulty change block. Unless the block is a difficulty change block, the difficulty must be precisely the same as the previous block or the block is invalid.

On a difficulty change block, the difficulty must be precisely what the difficulty algorithm requires or the block is invalid. The algorithm takes into account the amount of time it took to generate the previous group of blocks and computes a new difficulty such that the block generation time will be, on average, once every ten minutes if the network hashing power stays the same.

If you want to see this in the source code, check out the `GetNextWorkRequired` function in the `main.cpp` file.


---

