Bitcoin Forum
May 03, 2024, 05:47:51 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Obscure question about calculating the hash rate  (Read 1238 times)
ffe (OP)
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250



View Profile
August 21, 2012, 05:59:47 PM
 #1

Clients must agree on the next mining difficulty level every so many blocks. To do that they must effectively calculate the hash rate over the last period. To do that, an estimate of the time elapsed since the last update must be agreed to.

How do all the clients collectively agree on a consistent time?

Are the blocks time-stamped by the miner that solved it? If so, what is the validity check that other client execute against the time stamp of a newly minted block?

1714758471
Hero Member
*
Offline Offline

Posts: 1714758471

View Profile Personal Message (Offline)

Ignore
1714758471
Reply with quote  #2

1714758471
Report to moderator
1714758471
Hero Member
*
Offline Offline

Posts: 1714758471

View Profile Personal Message (Offline)

Ignore
1714758471
Reply with quote  #2

1714758471
Report to moderator
1714758471
Hero Member
*
Offline Offline

Posts: 1714758471

View Profile Personal Message (Offline)

Ignore
1714758471
Reply with quote  #2

1714758471
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714758471
Hero Member
*
Offline Offline

Posts: 1714758471

View Profile Personal Message (Offline)

Ignore
1714758471
Reply with quote  #2

1714758471
Report to moderator
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
August 21, 2012, 06:09:32 PM
 #2

The network uses loose time syncing.  The node finding the block includes a timestamp in the block header.  This can't be altered without altering the block hash.  Other nodes don't require that timestamp to be exact (obviously unworkable) but they will reject new blocks which have a timestamp that deviates by more than 3 hours from the expected.  Yes this means blocks can have timestamps "in the past".  If you check blockchain.info they show both the block timestamp and the detected timestamp.  Sometimes block timestamps will be out of sequence.


So some manipulation of the timestamps and difficulty is possible but the real world effect is minimal.  A miner trying to exploit this would need to solve either the first or last block and even then at most could manipulate the difficulty by ~1% (3 hours vs 2016*10/60 = 334 hours).
twmz
Hero Member
*****
Offline Offline

Activity: 737
Merit: 500



View Profile
August 21, 2012, 06:12:15 PM
 #3

Yes, every block has a timestamp in it and the difficulty adjustment algorithm looks at these timestamps when deciding how to adjust difficulty.

Nodes trust the timestamp in a given block based on pre-defined rules:

Quote
A timestamp is accepted as valid if it is greater than the median timestamp of previous 11 blocks, and less than the network-adjusted time + 2 hours. "Network-adjusted time" is the median of the timestamps returned by all nodes connected to you.

https://en.bitcoin.it/wiki/Block_timestamp

Was I helpful?  1TwmzX1wBxNF2qtAJRhdKmi2WyLZ5VHRs
WoT, GPG

Bitrated user: ewal.
ffe (OP)
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250



View Profile
August 21, 2012, 07:09:34 PM
 #4

Thanks guys
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
August 21, 2012, 08:44:44 PM
 #5

Heh, this is one of the things that I really wish Satoshi had done better.  NTP has been around since forever, and there is no reason why bitcoin couldn't have insisted on accurate clocking.  A +/- window of 10 minutes would have been plenty to account for just about any possible network conditions.

But, like D&T said, it doesn't really matter in practice.  The natural variation in the random process of solving blocks is dominant over the 3 hour window allowed.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
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!