Bitcoin Forum
October 08, 2024, 05:29:55 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How does Bitcoin Core estimate the time left until synced?  (Read 100 times)
BlackHatCoiner (OP)
Legendary
*
Offline Offline

Activity: 1666
Merit: 8212


Bitcoin is a royal fork


View Profile WWW
June 04, 2024, 07:08:02 PM
Last edit: June 04, 2024, 07:18:10 PM by BlackHatCoiner
Merited by ABCbits (1), Felicity_Tide (1)
 #1

Given the current block height, and given the announced chain tip from other nodes, how does it estimate when it will finish syncing? There is no known time that it takes to verify a block. It can be filled with lots of complicated scripts like this one and take up to even 12 minutes, or just by one transaction which is a 4 MB long message, and thus can be verified very quickly.

What's the optimal approach? Average verification time of the past x blocks?

Edit: I'm trying to sync the testnet3. I've reached the recent spam phase, and it went from 89 minutes remaining to 100.  Tongue
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3514
Merit: 6847


Just writing some code


View Profile WWW
June 04, 2024, 09:30:37 PM
Merited by BlackHatCoiner (4), ABCbits (3), tranthidung (1), Knight Hider (1)
 #2

Bitcoin Core has a few hard coded values that are updated each release. The values relevant for this estimate is the number of transactions in the blockchain, the average number of transactions per second for a window of recent blocks (usually 4096), and the timestamp of the block for which this data was generated. Using these values, Bitcoin Core estimates the total number of txs in chain currently, then computes the progress by calculating the percentage of txs that have actually been processed so far.

When the hard coded tx count is passed, the progress estimator switches to using the current tx count and the current block's timestamp, rather than the hard coded tx count and timestamp. It does still use the hard coded tx rate though.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!