2

I restarted my Bitcoin Core node after a gap of about a day and when seeing the console log, I noticed that it calculated the progress of my blockchain even before connecting to peers. The log information is pasted below. If you look at the last line, it says the progress=0.999577.

2020-02-03T09:02:15Z init message: Loading banlist...
2020-02-03T09:02:15Z Cache configuration:
2020-02-03T09:02:15Z * Using 2.0 MiB for block index database
2020-02-03T09:02:15Z * Using 8.0 MiB for chain state database
2020-02-03T09:02:15Z * Using 390.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space)
2020-02-03T09:02:15Z init message: Loading block index...
2020-02-03T09:02:15Z Opening LevelDB in C:\Users\ugamk\AppData\Roaming\Bitcoin\blocks\index
2020-02-03T09:02:15Z Opened LevelDB successfully
2020-02-03T09:02:15Z Using obfuscation key for C:\Users\ugamk\AppData\Roaming\Bitcoin\blocks\index: 0000000000000000
2020-02-03T09:02:21Z LoadBlockIndexDB: last block file = 1951
2020-02-03T09:02:21Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=79, size=71688771, heights=615600...615678, time=2020-02-02...2020-02-02)
2020-02-03T09:02:21Z Checking all blk files are present...
2020-02-03T09:02:21Z LoadBlockIndexDB(): Block files have previously been pruned
2020-02-03T09:02:21Z Opening LevelDB in C:\Users\ugamk\AppData\Roaming\Bitcoin\chainstate
2020-02-03T09:02:22Z Opened LevelDB successfully
2020-02-03T09:02:22Z Using obfuscation key for C:\Users\ugamk\AppData\Roaming\Bitcoin\chainstate: f5c820df867e2ff2
2020-02-03T09:02:22Z Loaded best chain: hashBestChain=000000000000000000034ff79a0c7ec61ea44e59514172d2a8d83033aaf9416b height=615678 date=2020-02-02T17:29:57Z progress=0.999577

I was appalled because my node hadn't connected to any peers until this point of time. The only reasonable explanation in my opinion is that Bitcoin Core calculates the "estimated" progress assuming 10 minute block time and when it last received the block. Is my assumption correct, or is there something else that allows Bitcoin Core to know the progress.

3

The progress number is the ratio between the total number of transactions in the active (validated) chain, and the expected total number of transactions at the current point in time. The latter is estimated based on statistics that are hardcoded in the Bitcoin Core source code, and updated every major release.

For example in version v0.19.0, the source code, you find:

chainTxData = ChainTxData{
    // Data from RPC: getchaintxstats 4096 00000000000000000005f8920febd3925f8272a6a71237563d78c2edfdd09ddf
    /* nTime    */ 1569926786,
    /* nTxCount */ 460596047,
    /* dTxRate  */ 3.77848885073875,
};

Which implies that at timestamp 1569926786 (Tue Oct 1 10:46:26 UTC 2019), the total number of transactions in the chain was 460596047. After that point in time, 3.7785 transactions per second are expected.

The total number of transactions at present is then estimated as:

  • If last_block_time < nTime, (current_time - nTime) * dTxRate + nTxCount
  • If last_block_time > nTime, (current_time - last_block_time) * dTxRate + last_block_total_tx_count
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.