<p>Line 132 in src/mining.cpp in the generateBlocks method.</p>

<pre><code>while (nMaxTries &gt; 0 &amp;&amp; pblock-&gt;nNonce &lt; nInnerLoopCount &amp;&amp; !CheckProofOfWork(pblock-&gt;GetHash(), pblock-&gt;nBits, Params().GetConsensus())) {
    ++pblock-&gt;nNonce;
    --nMaxTries;
}
</code></pre>

<p><strong>Update</strong>: Given @MeshCollider's answer I guess this is now only relevant on the regtest network.</p>

CC BY-SA 3.0
2017-11-11T06:37:00.367Z
Oh yes, there is still a miner for regtest, forgot about that :)
meshcollider
CC BY-SA 3.0
2017-11-11T06:32:35.920Z
2017-11-11T06:32:35.920Z
sipsorcery
<p>The internal miner was removed from Bitcoin Core in version 0.13.0, in this PR:
<a href="https://github.com/bitcoin/bitcoin/pull/7507" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/pull/7507</a></p>

<p>It used to be incremented in ScanHash(), but as of the removal, there is nowhere which increments the nonce, that would be done by mining software.</p>

CC BY-SA 3.0
2017-11-11T06:24:04.050Z
2017-11-11T06:24:04.050Z
meshcollider
<p>Where is the nonce incremented in Bitcoin source code?
I found where the extra nonce is incremented, but not the regular nonce?</p>

<bitcoin-core-development><nonce>
Where is the nonce incremented in Bitcoin source code?
newbie newbie
# Where is the nonce incremented in Bitcoin source code?

(Asked by: username_0 on 2017-11-11)

Where is the nonce incremented in Bitcoin source code?
I found where the extra nonce is incremented, but not the regular nonce?

**Tags:** bitcoin-core-development, nonce


---

## 2 answers

### Answer by username_1 on 2017-11-11. Score: 1

Line 132 in src/mining.cpp in the generateBlocks method.

```
while (nMaxTries > 0 && pblock->nNonce < nInnerLoopCount && !CheckProofOfWork(pblock->GetHash(), pblock->nBits, Params().GetConsensus())) {
    ++pblock->nNonce;
    --nMaxTries;
}

```

**Update**: Given @MeshCollider's answer I guess this is now only relevant on the regtest network.

> **Comments:**
> **username_2**: Oh yes, there is still a miner for regtest, forgot about that :)  

---

### Answer by username_2 on 2017-11-11. Score: 0

The internal miner was removed from Bitcoin Core in version 0.13.0, in this PR:
<https://github.com/bitcoin/bitcoin/pull/7507>

It used to be incremented in ScanHash(), but as of the removal, there is nowhere which increments the nonce, that would be done by mining software.


---

