<p>Most of the mining code was removed from Bitcoin Core as CPU mining gave way to GPU, FPGA and ASIC mining. The minimal amount of code that's left is intended for testing purposes, i.e. creating blocks on regtest. This code is in <a href="https://github.com/bitcoin/bitcoin/blob/v27.1/src/rpc/mining.cpp" rel="nofollow noreferrer">src/rpc/mining.cpp</a>, and the function that handles incrementing the nonce is <a href="https://github.com/bitcoin/bitcoin/blob/v27.1/src/rpc/mining.cpp#L130" rel="nofollow noreferrer">GenerateBlock</a>.</p>

CC BY-SA 4.0
2024-07-14T11:35:53.733Z
2024-07-14T11:35:53.733Z
Vojtěch Strnad
<p>I've been looking for months for the real mining code in the Bitcoin Core source code for the function/s that implement the incrementing of the nonce and hashing blocks for mining and never found anything useful. Can anyone Help me find it?</p>

<bitcoin-core><bitcoin-core-development><hash><proof-of-work><nonce>
Where exactly is the mining code in Bitcoin Core?
Ahmad Naji
# Where exactly is the mining code in Bitcoin Core?

(Asked by: username_0 on 2024-07-14)

I've been looking for months for the real mining code in the Bitcoin Core source code for the function/s that implement the incrementing of the nonce and hashing blocks for mining and never found anything useful. Can anyone Help me find it?

**Tags:** bitcoin-core, bitcoin-core-development, hash, proof-of-work, nonce


---

## 1 answers

### Answer by username_1 on 2024-07-14. Score: 3

Most of the mining code was removed from Bitcoin Core as CPU mining gave way to GPU, FPGA and ASIC mining. The minimal amount of code that's left is intended for testing purposes, i.e. creating blocks on regtest. This code is in [src/rpc/mining.cpp](https://github.com/bitcoin/bitcoin/blob/v27.1/src/rpc/mining.cpp), and the function that handles incrementing the nonce is [GenerateBlock](https://github.com/bitcoin/bitcoin/blob/v27.1/src/rpc/mining.cpp#L130).


---

