<p>I have been learning the ins and outs of the bitcoin source code over the past 3 months but I can say I have not fully mastered it yet. I wish to understand how the genesis block is validated using the CheckProofOfWork() function. I would like to do something like this in chainsparams.cpp:</p>

<p>while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;</p>

<p>Where I seem to be stuck is how to obtain chainparams.GetConsensus() inside of chainsparams.cpp</p>

<p>Any guidance would be appreciated.</p>

<p>Thanks In Advance</p>

CC BY-SA 3.0
2018-02-23T07:06:28.693Z
I am also stuck at this stage... searched a lot, but none... Have you found anything?
creator
CC BY-SA 3.0
2018-02-23T07:11:18.177Z
And what is variable 'block'? Isn't it 'genesis' variable in newest source?
creator
<testnet><proof-of-work><genesis-block>
How to check that Genesis Block has valid proof of work using CheckProofOfWork() function?
Alfonso A.
# How to check that Genesis Block has valid proof of work using CheckProofOfWork() function?

(Asked by: username_0 on 2018-02-13)

I have been learning the ins and outs of the bitcoin source code over the past 3 months but I can say I have not fully mastered it yet. I wish to understand how the genesis block is validated using the CheckProofOfWork() function. I would like to do something like this in chainsparams.cpp:

while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;

Where I seem to be stuck is how to obtain chainparams.GetConsensus() inside of chainsparams.cpp

Any guidance would be appreciated.

Thanks In Advance

**Tags:** testnet, proof-of-work, genesis-block

> **Comments:**
> **username_1**: I am also stuck at this stage... searched a lot, but none... Have you found anything?  
> **username_1**: And what is variable 'block'? Isn't it 'genesis' variable in newest source?  

---

## 0 answers

