Once I connect to the bitcoin p2p network using bitcore-p2p
and requesting the headers from the peers I end up with a large JSON containing several blockHeaders.
From this I would like to verify the different blocks. If I am correct I would have to perform the following steps:
- Verify the hash from the previous block is indeed the equal to this block’s blockHeader.prevHash
- Recompute the block hash using the blockheader version, prevHash, merkleRoot, time, bits and nonce
- Verify the computed hash is indeed the hash that was send by the peer
- Verify the headers using
validTimestamp()
andvalidProofOfWork()
Could anyone tell me if the above steps seem valid? I Also I am wondering or computing the block hash from the blockHeader has been implemented in bitcore-lib
?