Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: icaro on August 31, 2010, 12:55:44 PM



Title: Warning : Check your system clock (help me)
Post by: icaro on August 31, 2010, 12:55:44 PM
Warning :Check your system data and time , you may not be able to generate or receive the most recent blocks !

What does it mean ?    ???   I'm just with 2 connections and 500 blocks.


Title: Re: Warning : Check your system ( Help me )
Post by: MoonShadow on August 31, 2010, 01:27:53 PM
If your system clock is too far off, blocks that you create would be rejected, and your client will reject any blocks that it views have been created with a future date.


Title: Re: Warning : Check your system ( Help me )
Post by: satoshi on September 05, 2010, 11:36:20 PM
Any suggestions for better text to put for this error message so the next person will be less likely to be confused?

It's trying to tell them their clock is wrong and they need to correct it.

It's relying on 3 time sources:
1) the system clock
2) the other nodes, if within an hour of the system clock
if those disagree, then
3) the user (asking the user to fix the system clock)

I've thought about NTP, but this is more secure.


Title: Re: Warning : Check your system ( Help me )
Post by: BioMike on September 06, 2010, 05:19:29 AM
I've thought about NTP, but this is more secure.

IMHO there is no reason for a modern system to not run a NTP client/daemon.


Title: Re: Warning : Check your system ( Help me )
Post by: Insti on September 06, 2010, 12:48:08 PM
I dont think the bitcoin client should start bloating itsself with additional NTP client functionality.


Title: Re: Warning : Check your system ( Help me )
Post by: Insti on September 06, 2010, 12:51:37 PM
Any suggestions for better text to put for this error message so the next person will be less likely to be confused?

"Please check that your computers date and time are correct. If your clock is wrong Bitcoin will not work properly."





Title: Re: Warning : Check your system ( Help me )
Post by: Cdecker on September 06, 2010, 12:54:07 PM
I'd go for a small server that returns a unix timestamp, the client fetches it, computes the clock drift (difference in time) and all the protocol related times are based on that drift. The clocks would still drift a little (they'd do it anyway on the system clock) and we would not get perfect synchronization (impossible in distributed systems), but it would solve our current problems.

The code is about 5 lines and some simple math (sums) when calculating the timestamps.


Title: Re: Warning : Check your system ( Help me )
Post by: BioMike on September 06, 2010, 05:25:18 PM
I dont think the bitcoin client should start bloating itsself with additional NTP client functionality.


Hell no, NTP does a good job. Don't have other services changing the clock (also counts for bitcoin). Right tool for the right job!


Title: Re: Warning : Check your system ( Help me )
Post by: satoshi on September 06, 2010, 09:41:06 PM
Any suggestions for better text to put for this error message so the next person will be less likely to be confused?
"Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly."
Thanks.


Title: Re: Warning : Check your system ( Help me )
Post by: ribuck on September 07, 2010, 11:14:20 AM
Thanks.
Thank you Satoshi for sneaking that possessive apostrophe into "computer's date"!


Title: Re: Warning : Check your system ( Help me )
Post by: agaumoney on September 09, 2010, 04:34:57 PM
I'd go for a small server that returns a unix timestamp, the client fetches it, computes the clock drift (difference in time) and all the protocol related times are based on that drift. The clocks would still drift a little (they'd do it anyway on the system clock) and we would not get perfect synchronization (impossible in distributed systems), but it would solve our current problems.

The code is about 5 lines and some simple math (sums) when calculating the timestamps.

Why a server when so many are already out there?

I'd agree that we don't want bitcoin client bloat, and definitely NO WAY the bitcoin client should be setting the system time.

But maybe it is worth it in the error case for the bitcoin client to put a message in the log and attempt to use a network time instead of system time.

As for the servers out there, the bitcoin client already has http, right?  Well, most http servers now provide the date in their headers.  For example, in python:
Code:
import os, re, urllib
info = urllib.urlopen('http://www.yahoo.com/').info()
regx = r'Date:\s+[A-Z][a-z]{2}, (\d{1,2}) ([A-Z][a-z]{2}) (\d{1,4}) (\d\d:\d\d:\d\d)'
d, M, Y, T = re.search(regx,str(info)).groups()
m = 1+"JanFebMarAprMayJunJulAugSepOctNovDec".index(M)/3
print '%04d.%02d.%02d-%s' % (int(Y), m, int(d), T)

(that output format happens to work with "date -us" if you did want to set some system time)

of course it would be better to check a couple of sites rather than relying on just yahoo to keep their http server time set properly.  :)


Title: Re: Warning : Check your system ( Help me )
Post by: Cdecker on September 19, 2010, 08:14:08 PM
I think we all agree that setting the system time is a no go, but why can't we just use an offset internally and just circumvent the whole issue? We already have ways to synchronize (approximately) the clients, so why not make use of that?


Title: Re: Warning : Check your system ( Help me )
Post by: LZ on September 20, 2010, 03:39:55 AM
Agreed. There is no need to set the system time.
We only need to use correct time in the program.


Title: Re: Warning : Check your system ( Help me )
Post by: satoshi on September 23, 2010, 04:28:25 PM
I don't understand, are you under the impression that the program sets the system clock?  It doesn't.

We already have ways to synchronize (approximately) the clients, so why not make use of that?
We use an internal offset based on the median of other nodes' times, but for security reasons we don't let them offset us by more than an hour.  If they indicate we're off by more than an hour, then we resort to alerting the user to fix their clock.


Title: Re: Warning : Check your system ( Help me )
Post by: agaumoney on October 12, 2010, 06:33:31 PM
I don't understand, are you under the impression that the program sets the system clock?  It doesn't.

We already have ways to synchronize (approximately) the clients, so why not make use of that?
We use an internal offset based on the median of other nodes' times, but for security reasons we don't let them offset us by more than an hour.  If they indicate we're off by more than an hour, then we resort to alerting the user to fix their clock.

It was proposed that the program set the clock, and several of us said, "no, don't do that."

Another proposal, which Cdecker was confirming, was for the program to use the "network time" when the local computer time was broken.  This would be an enhancement to the 3.10 behavior of not working.


Title: Re: Warning : Check your system ( Help me )
Post by: joe on October 13, 2010, 06:34:15 AM
Bitcoin should absolutely not be sending the computer's time to the network. Nor should it depend on the clock being set properly. Each node can keep track of when they see transactions come through. If they want to reject a block because it contains a transaction they saw too long ago, then they are free to reject it; no reason for the nodes to compare each other's clocks. If it's too old they will all reject it, which is what we want.


Title: Re: Warning : Check your system ( Help me )
Post by: theymos on October 13, 2010, 12:28:31 PM
Bitcoin should absolutely not be sending the computer's time to the network. Nor should it depend on the clock being set properly. Each node can keep track of when they see transactions come through. If they want to reject a block because it contains a transaction they saw too long ago, then they are free to reject it; no reason for the nodes to compare each other's clocks. If it's too old they will all reject it, which is what we want.

If someone rejects a block that most of the network accepts, then all of the blocks that they produce will be invalid and transactions won't gain confirmations from their perspective.

This is about times of blocks, not transactions. Block timestamps are used for the difficulty calculation, so they can't be too far off from reality.


Title: Re: Warning : Check your system ( Help me )
Post by: MoonShadow on October 13, 2010, 06:13:41 PM
I don't understand, are you under the impression that the program sets the system clock?  It doesn't.

We already have ways to synchronize (approximately) the clients, so why not make use of that?
We use an internal offset based on the median of other nodes' times, but for security reasons we don't let them offset us by more than an hour.  If they indicate we're off by more than an hour, then we resort to alerting the user to fix their clock.

It was proposed that the program set the clock, and several of us said, "no, don't do that."

Another proposal, which Cdecker was confirming, was for the program to use the "network time" when the local computer time was broken.  This would be an enhancement to the 3.10 behavior of not working.


Could just have the program check an Internet timeserver upon startup, and keep an offset for itself.



Title: Re: Warning : Check your system ( Help me )
Post by: joe on October 13, 2010, 09:57:45 PM
Bitcoin should absolutely not be sending the computer's time to the network. Nor should it depend on the clock being set properly. Each node can keep track of when they see transactions come through. If they want to reject a block because it contains a transaction they saw too long ago, then they are free to reject it; no reason for the nodes to compare each other's clocks. If it's too old they will all reject it, which is what we want.

If someone rejects a block that most of the network accepts, then all of the blocks that they produce will be invalid and transactions won't gain confirmations from their perspective.

This is about times of blocks, not transactions. Block timestamps are used for the difficulty calculation, so they can't be too far off from reality.

If someone rejects a block that most of the network accepts, won't the rejecting nodes eventually give up on the rejecting branch and move to the longer branch that accepted it? The same problem would happen if someone double spends a coin, and nodes disagree on which one came in first. The majority will make a longer chain and the minority nodes will have no choice but to jump over.

The same argument goes for difficulty. I don't understand why difficulty is centralized. Again, each node should independently determine what the difficulty is, and reject blocks that don't meet the mark for that difficulty. As long as most nodes reach the same conclusion for difficulty, all nodes will eventually jump over the the chain of the majority.


Title: Re: Warning : Check your system ( Help me )
Post by: theymos on October 13, 2010, 10:38:14 PM
If someone rejects a block that most of the network accepts, won't the rejecting nodes eventually give up on the rejecting branch and move to the longer branch that accepted it?

If you reject a block, then all blocks after it are also invalid from your point of view, no matter how many other people accept them. If this was not the case, then an attacker could create bitcoins out of thin air by getting more than 50% of the network's CPU power. This effect was demonstrated when the overflow bug was fixed: even though 0.3.10 nodes were in the minority, they rejected all blocks produced by old clients (which contained a fraudulent and impossible transaction for 184 billion bitcoins).

This is not quite the case for timestamp issues, but there is a similar effect. If your clock is off, you won't accept any new blocks, as they'll all be too far in the future. You'll eventually get the blocks when they are no longer too far in the future, but you'll still be unable to generate because your view of the "latest valid block" is wrong.

Quote
The same problem would happen if someone double spends a coin, and nodes disagree on which one came in first. The majority will make a longer chain and the minority nodes will have no choice but to jump over.

You don't reject blocks for transaction timing/ordering issues.


Title: Re: Warning : Check your system ( Help me )
Post by: joe on October 14, 2010, 07:55:12 AM
If someone rejects a block that most of the network accepts, won't the rejecting nodes eventually give up on the rejecting branch and move to the longer branch that accepted it?

If you reject a block, then all blocks after it are also invalid from your point of view, no matter how many other people accept them. If this was not the case, then an attacker could create bitcoins out of thin air by getting more than 50% of the network's CPU power. This effect was demonstrated when the overflow bug was fixed: even though 0.3.10 nodes were in the minority, they rejected all blocks produced by old clients (which contained a fraudulent and impossible transaction for 184 billion bitcoins).

This is not quite the case for timestamp issues, but there is a similar effect. If your clock is off, you won't accept any new blocks, as they'll all be too far in the future. You'll eventually get the blocks when they are no longer too far in the future, but you'll still be unable to generate because your view of the "latest valid block" is wrong.

Quote
The same problem would happen if someone double spends a coin, and nodes disagree on which one came in first. The majority will make a longer chain and the minority nodes will have no choice but to jump over.

You don't reject blocks for transaction timing/ordering issues.

There must be a way to do away with real world time. It is an anonymity risk to give up your computer clock's time, and it shouldn't be necessary to get a transaction or block confirmed on the bitcoin network. If nodes want to compute some time deltas against their own clocks, that's fine, but again, no one should have to fess up to their computer's absolute clock time in order for the system to work right.


Title: Re: Warning : Check your system ( Help me )
Post by: agaumoney on October 14, 2010, 11:17:13 PM
There must be a way to do away with real world time. It is an anonymity risk to give up your computer clock's time,

In what way is that a risk?

Is your perception of the risk related to how many bits of precision the time is "given up" ?  For example, any computer synced with a network time server should be accurate to the second.  What about if the time stamp is only given up to the minute?  Or 5 minutes?

It sounds like you believe there is some uniquely identifiable data contained in the time.  If so, then less precision (seconds or minutes instead of nanoseconds) removes that risk.

In addition, since nobody else on the network knows how long it takes you to "give up your computer clock's time" then they have no way to correlate the value they receive to the value in your computer clock with any degree of precision.

And finally, your computer clock's time is not treated as privileged data by anything else.  Why should bitcoin treat it specially?


Title: Re: Warning : Check your system ( Help me )
Post by: ByteCoin on October 14, 2010, 11:55:21 PM
Just remind me why Bitcoin cares about the time? Is it just to change the difficulty to target a certain average block rate or something more fundamental?

It seems to be quite a bit of hassle for not very much benefit.

Can't the client manage just by measuring time intervals with the actual absolute time value being unused? I imagine that the effects of any systematic drift would be unimportant compared to currently accepted hash-rate related variability.

ByteCoin


Title: Re: Warning : Check your system clock (help me)
Post by: MessyCoin on March 12, 2011, 12:12:47 AM
Hi, I am getting this message every time Bitcoin opens: "Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly." My clock is correct, but I have just installed Win 7 and I am using the Bitcoin data files from the previous Vista install. I tried deleting wallet.dat but it still complains. Any suggestions?


Title: Re: Warning : Check your system clock (help me)
Post by: error on March 12, 2011, 12:21:43 AM
Hi, I am getting this message every time Bitcoin opens: "Please check that your computer's date and time are correct. If your clock is wrong Bitcoin will not work properly." My clock is correct, but I have just installed Win 7 and I am using the Bitcoin data files from the previous Vista install. I tried deleting wallet.dat but it still complains. Any suggestions?

Fix your date, time AND time zone.


Title: Re: Warning : Check your system clock (help me)
Post by: MessyCoin on March 12, 2011, 12:34:26 AM
Fix your date, time AND time zone.

You're absolutely correct about timezone, thanks. (I guess the brain goes numb installing windows - again)


Title: Re: Warning : Check your system ( Help me )
Post by: Jim Hyslop on March 12, 2011, 02:12:55 AM
Just remind me why Bitcoin cares about the time? Is it just to change the difficulty to target a certain average block rate or something more fundamental?

It seems to be quite a bit of hassle for not very much benefit.

Can't the client manage just by measuring time intervals with the actual absolute time value being unused? I imagine that the effects of any systematic drift would be unimportant compared to currently accepted hash-rate related variability.

ByteCoin

I'm late to the party, I know, but I'll answer this anyway.

It's quite important for controlling the rate of coin generation. Every 2016 blocks, the computer calculates the difference in time between the most recent block, and the block 2015 before it. The target is exactly two weeks; if the actual time was longer, then the difficulty is reduced. If the actual time was less than two weeks (as just happened a couple of days ago) then the difficulty is increased.


Title: Re: Warning : Check your system clock (help me)
Post by: error on March 12, 2011, 02:23:19 AM
I suspect most of the nodes on the network right now are NTP synchronized, though I expect chaos will ensue once we have large numbers of unsynchronized nodes joining the network.


Title: Re: Warning : Check your system clock (help me)
Post by: Jim Hyslop on March 12, 2011, 03:29:52 AM
I suspect most of the nodes on the network right now are NTP synchronized, though I expect chaos will ensue once we have large numbers of unsynchronized nodes joining the network.
Well, the mainstream OSes (OSX, Windoze and increasingly Linux) all incorporate some kind of time synchronization, so that shouldn't be an issue. I wouldn't put money on it, though (especially not Bitcoins, since I ain't got none yet :-)


Title: Re: Warning : Check your system clock (help me)
Post by: error on March 12, 2011, 03:59:00 AM
I suspect most of the nodes on the network right now are NTP synchronized, though I expect chaos will ensue once we have large numbers of unsynchronized nodes joining the network.
Well, the mainstream OSes (OSX, Windoze and increasingly Linux) all incorporate some kind of time synchronization, so that shouldn't be an issue. I wouldn't put money on it, though (especially not Bitcoins, since I ain't got none yet :-)

Windows by default only synchronizes once a week, and that's only IF the feature is enabled. There's no documented way to make it synchronize more than once a week, and a computer clock can drift quite a bit in that time, especially if the onboard battery is low or dead.

And that's not taking into account the number of people who intentionally desynchronize their clocks in order to play mind games with themselves.


Title: Re: Warning : Check your system clock (help me)
Post by: theymos on March 12, 2011, 04:55:14 AM
There's no documented way to make it synchronize more than once a week

It is documented:
http://technet.microsoft.com/en-us/library/cc773263%28WS.10%29.aspx

You need to change this registry value:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters\NtpServer
Change the server flag from 0x9 to 0x0. Then you'll update using "smart adjustments" like normal NTP clients. You could also instead change W32Time\TimeProviders\NtpClient\SpecialPollInterval to update more frequently.