Warning : Check your system clock (help me)

18 messages BitcoinTalk icaro, Satoshi Nakamoto, MoonShadow, BioMike, Insti, Cdecker, ribuck, agaumoney, LZ, joe, Michael Marquardt August 31, 2010 — October 13, 2010
icaro August 31, 2010 03:55 UTC Source ·

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.

MoonShadow August 31, 2010 13:27 UTC Source ·

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.

Satoshi Nakamoto September 5, 2010 23:36 UTC Source ·

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.

BioMike September 6, 2010 05:19 UTC Source ·
Quote from: satoshi on September 05, 2010, 11:36:20 PM UTC

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.

Insti September 6, 2010 12:48 UTC Source ·

I dont think the bitcoin client should start bloating itsself with additional NTP client functionality.

Insti September 6, 2010 12:51 UTC Source ·
Quote from: satoshi on September 05, 2010, 2:36:20 PM UTC

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.”

Cdecker September 6, 2010 12:54 UTC Source ·

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.

BioMike September 6, 2010 17:25 UTC Source ·
Quote from: Insti on September 06, 2010, 3:48:08 AM UTC

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!

Satoshi Nakamoto September 6, 2010 21:41 UTC Source ·
Quote from: Insti on September 06, 2010, 3:51:37 AM UTC
Quote from: satoshi on September 05, 2010, 2:36:20 PM UTC

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.

ribuck September 7, 2010 11:14 UTC Source ·
Quote from: satoshi on September 06, 2010, 9:41:06 PM UTC

Thanks.

Thank you Satoshi for sneaking that possessive apostrophe into “computer’s date”!

agaumoney September 9, 2010 16:34 UTC Source ·
Quote from: Cdecker on September 06, 2010, 3:54:07 AM UTC

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:

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. 😊

Cdecker September 19, 2010 20:14 UTC Source ·

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?

LZ September 20, 2010 03:39 UTC Source ·

Agreed. There is no need to set the system time. We only need to use correct time in the program.

Satoshi Nakamoto September 23, 2010 16:28 UTC Source ·

I don’t understand, are you under the impression that the program sets the system clock?  It doesn’t.

Quote from: Cdecker on September 19, 2010, 11:14:08 AM UTC

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.

agaumoney October 12, 2010 18:33 UTC Source ·
Quote from: satoshi on September 23, 2010, 4:28:25 PM UTC

I don’t understand, are you under the impression that the program sets the system clock? It doesn’t.

Quote from: Cdecker on September 19, 2010, 8:14:08 PM UTC

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.

joe October 13, 2010 06:34 UTC Source ·

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.

theymos October 13, 2010 12:28 UTC Source ·
Quote from: joe on October 13, 2010, 6:34:15 AM UTC

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.

MoonShadow October 13, 2010 18:13 UTC Source ·
Quote from: agaumoney on October 12, 2010, 6:33:31 PM UTC
Quote from: satoshi on September 23, 2010, 4:28:25 PM UTC

I don’t understand, are you under the impression that the program sets the system clock? It doesn’t.

Quote from: Cdecker on September 19, 2010, 8:14:08 PM UTC

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.