Block verification and propagation

+2 votes

Let's say a block is being propagated troughout the network.

Does every receiving node have to to verify the block before it propagates it further?

If it is so, then how exactly is the block verified and is there a way to estimate or measure the time of verification process?


asked Aug 5, 2020 by Igor

1 Answer

+1 vote

Yes, a node verifies a block before it propagates it further. Verification means checking all the transactions within are valid and non-conflicting, both within themselves and with references to the state of the chain before the block. If you use the debug runtime parameters you should be able to see log details of the related internal operations.

answered Aug 6, 2020 by MultiChain
I added the debug=mcblock parameter but I'm not sure if I'm reading the correct timestamps. Does the information below mean that the block was verified in around 2 seconds (time between 'Received block' and 'Chain activated' messages)? Is there a way to include ms in the logs so the time measurements are a little more precise?

2020-08-06 18:46:14 mchn-block: Received block:   00ed4da2e3d9abb62aba6c84eb3c41bcd47fc872d9513b517f0f4c164303d6cc,  peer=1

2020-08-06 18:46:14 mchn-block: New block index:   00ed4da2e3d9abb62aba6c84eb3c41bcd47fc872d9513b517f0f4c164303d6cc, prev: 00aabc0f1b3fcc54940fed703cdf39b5ef851c736ac50dde5ab4fdc21f172f4b, height: 9, mined-by-me: 0, can-mine: 0

2020-08-06 18:46:16 UpdateTip:            new best=00ed4da2e3d9abb62aba6c84eb3c41bcd47fc872d9513b517f0f4c164303d6cc  height=9  log2_work=11.321928  tx=31205  date=2020-08-06 18:45:22 progress=1.000000  cache=0

2020-08-06 18:46:16 mchn-block: height: 9, miner: 13GqtdmG8WNGva9A5kAMjYEVDwVcLKjtPe

2020-08-06 18:46:16 mchn-block: Chain activated:   00ed4da2e3d9abb62aba6c84eb3c41bcd47fc872d9513b517f0f4c164303d6cc (height 9), can-mine: 0
Yes, you should look at the 'Received block' and 'UpdateTip' lines with matching block hashes to see the time taken. To log milliseconds try using the -logtimemillis runtime parameter when starting up multichaind.