<p>The regtest difficulty is not 0. It is around 0.0000000005 initially (corresponding to 1 hash in 2 being valid), and retargets the same way that the main network does, every 2016 blocks.</p>

<p>The fact that you see this error is a bug though, which will probably be fixed in Bitcoin Core 0.11.</p>

CC BY-SA 3.0
2015-05-03T21:11:45.927Z
OK. Thanks Pieter! But only, I'm not understanding your formulation of "[...] corresponding to 1 hash in 2 being valid [...]" ... Would you rephrase that, please?
Aliakbar Ahmadi
CC BY-SA 3.0
2015-05-04T09:18:23.440Z
Of every two candidate block you try, one will be valid.
Pieter Wuille
CC BY-SA 3.0
2015-05-02T09:06:45.143Z
2015-05-03T08:45:05.857Z
2015-05-03T08:45:05.857Z
Pieter Wuille
<p>I am running bitcoind v0.10.0.0-047a898 in regtest mode on a Raspberry PI. I see lots of those "ERROR: CheckProofOfWork() : hash doesn't match nBits" and they slow bitcoin down quite a bit. In the end I have commented the check out. Surprisingly, everything seems to work fine now, but I must be missing something here...</p>

CC BY-SA 3.0
2015-05-15T20:00:06.647Z
2015-05-15T20:00:06.647Z
Pieter Hartel
<p><br/></p>

<p>I'm getting this error in <strong>regtest</strong> mode after <code>setgenerate</code> RPC:<br/></p>

<blockquote>
  <p>ERROR: CheckProofOfWork() : hash doesn't match nBits<br/></p>
</blockquote>

<p>After looking for error text in src I found a match in <code>pow.cpp</code> (obviously standing for proof of work) with following extract from code: <br/></p>

<pre><code>// Check proof of work matches claimed amount
if (hash &gt; bnTarget)
     return error("CheckProofOfWork() : hash doesn't match nBits");
</code></pre>

<p>Does it mean there's a target in regtest?If yes, isn't it contradicting to difficulty being 0?</p>

<error><proof-of-work><difficulty><regtest>
Generating blocks in regtest: "hash doesn't match nBits"
Aliakbar Ahmadi
# Generating blocks in regtest: "hash doesn't match nBits"

(Asked by: username_0 on 2015-05-01)

I'm getting this error in **regtest** mode after `setgenerate` RPC:

> ERROR: CheckProofOfWork() : hash doesn't match nBits

After looking for error text in src I found a match in `pow.cpp` (obviously standing for proof of work) with following extract from code:

```
// Check proof of work matches claimed amount
if (hash > bnTarget)
     return error("CheckProofOfWork() : hash doesn't match nBits");

```

Does it mean there's a target in regtest?If yes, isn't it contradicting to difficulty being 0?

**Tags:** error, proof-of-work, difficulty, regtest


---

## 2 answers

### Answer by username_1 on 2015-05-02. Score: 2 | Accepted answer

The regtest difficulty is not 0. It is around 0.0000000005 initially (corresponding to 1 hash in 2 being valid), and retargets the same way that the main network does, every 2016 blocks.

The fact that you see this error is a bug though, which will probably be fixed in Bitcoin Core 0.11.

> **Comments:**
> **username_0**: OK. Thanks username_1! But only, I'm not understanding your formulation of "[...] corresponding to 1 hash in 2 being valid [...]" ... Would you rephrase that, please?  
> **username_1**: Of every two candidate block you try, one will be valid.  

---

### Answer by username_2 on 2015-05-15. Score: 0

I am running bitcoind v0.10.0.0-047a898 in regtest mode on a Raspberry PI. I see lots of those "ERROR: CheckProofOfWork() : hash doesn't match nBits" and they slow bitcoin down quite a bit. In the end I have commented the check out. Surprisingly, everything seems to work fine now, but I must be missing something here...


---

