Author

Topic: Obscure question about calculating the hash rate (Read 1271 times)

kjj
legendary
Activity: 1302
Merit: 1026
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.
ffe
sr. member
Activity: 308
Merit: 250
Thanks guys
hero member
Activity: 737
Merit: 500
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
donator
Activity: 1218
Merit: 1079
Gerald Davis
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).
ffe
sr. member
Activity: 308
Merit: 250
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?

Jump to: