<blockquote>
<p><strong>the blockchain can be taken as a trustworthy log of past timestamps, the latest of which give a rough estimate of the current time.</strong></p>
</blockquote>
<p>Very very rough. Instead of tens of milliseconds with NTP you are talking about errors of the magnitude of hours with Bitcoin block timestamps. It can be <em>five or six orders of magnitude</em> worse!</p>
<p>If you are considering Bitcoin network adjusted time from Bitcoin Version messages, I don't think that has any guarantees about accuracy or even <a href="https://bitcoin.stackexchange.com/q/915/13866">monotonicity</a>?  It certainly doesn't take into account latency and jitter. I don't think it does much to counteract timestamp spoofing either. Apart from averaging a handful of sources.</p>
<blockquote>
<p><strong>What is the quickest way for my node to know that the blocks received from its peers have been validated by the network?</strong></p>
</blockquote>
<p>There is no way to know.</p>
<p>Bitcoin nodes all perform their own validation. They never assume anyone else has performed validation for them. No Bitcoin nodes ever trust any other nodes. Bitcoin nodes effectively assume all other nodes are possible liars and proceed accordingly.</p>
<blockquote>
<p><strong>NTP doesn't sign timestamps</strong></p>
</blockquote>
<p>NTP isn't a notary but it does have provision for securing reliable time.</p>
<p><a href="https://en.wikipedia.org/wiki/Network_Time_Protocol#Secure_extensions" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Network_Time_Protocol#Secure_extensions</a></p>
<blockquote>
<p><strong>[NTP?] nodes are susceptible to DNS spoofing or man-in-the-middle attacks</strong></p>
</blockquote>
<p>On the other hand, Bitcoin nodes have to counteract possible <a href="https://bitcoin.stackexchange.com/search?q=eclipse+attack">Eclipse attacks</a> etc.</p>

CC BY-SA 4.0
2023-12-12T13:09:54.713Z
2023-12-12T14:21:29.297Z
2023-12-12T14:21:29.297Z
RedGrittyBrick
<p>I'm looking for a way that a computer could get a rough estimate of the current date and time with a very high confidence level, for example in order to verify the expiry of a contract by means of a computer program.</p>
<p><a href="https://datatracker.ietf.org/doc/html/rfc5905" rel="nofollow noreferrer">NTP</a> is a popular protocol for synchronising computer clocks across a network. Despite providing highly accurate time measurements, NTP doesn't sign timestamps, which, in the context of my project, is a lack of reliability in that the nodes are susceptible to <a href="https://www.imperva.com/learn/application-security/dns-spoofing/" rel="nofollow noreferrer">DNS spoofing</a> or <a href="https://en.wikipedia.org/wiki/Man-in-the-middle_attack" rel="nofollow noreferrer">man-in-the-middle</a> attacks<sup>#</sup>, which are able to make the victim think it's communicating with someone else than who it's actually talking to, and thereby manipulate the victim's perception of current time.</p>
<p>After some deliberation I realized that the blockchain can be taken as a trustworthy log of past timestamps, the latest of which give a rough estimate of the current time. Thus –I thought– I could write a program that starts a Bitcoin node, requests from its peers the latest blocks and fetches the timestamps from their headers... done! Now, I'm pretty confident this method is robust against the attacks discussed in <sup>#</sup>, but I don't know how to formalise the method. Here's my idea.</p>
<p>In order for the method to equally apply to old and new users, let's assume that my computer starts a brand new node each time it wants to check the current time. Each time, it will DNS-lookup some node IPs and subsequently request the latest blocks from them, check their validity and, if positive, read the timestamps. This gives raise to the following question.</p>
<ul>
<li>What is the quickest way for my node to know that the blocks received from its peers have been validated by the network? Can it do so without downloading the full 400+GB blockchain nor compromising the robustness against DNS spoofing and MITM attacks?</li>
</ul>
<p>My guess is that I could verify all the transactions, Merkle roots and headers of the blockchain provided by my peers; but still what would guarantee me that the branch that I'm looking at is backed by the network?</p>
<hr />
<p>Despite the generic feeling of the question-marked questions, my sole goal is to turn the blockchain into a trustworthy timekeeping log (a &quot;clockchain&quot;, if you would), not running a Bitcoin node <em>per se</em>. It would be ideal to find a specific solution to the problem but the only approaches I have come up with are as generic as the questions up there.</p>

CC BY-SA 4.0
2023-12-12T13:11:03.080Z
Possibly related: https://github.com/opentimestamps/restamp.
Antoine Poinsot
<timestamp><block-validity><dns>
Using Bitcoin as a trusted clock?
aleph2
# Using Bitcoin as a trusted clock?

(Asked by: username_0 on 2023-12-12)

I'm looking for a way that a computer could get a rough estimate of the current date and time with a very high confidence level, for example in order to verify the expiry of a contract by means of a computer program.

[NTP](https://datatracker.ietf.org/doc/html/rfc5905) is a popular protocol for synchronising computer clocks across a network. Despite providing highly accurate time measurements, NTP doesn't sign timestamps, which, in the context of my project, is a lack of reliability in that the nodes are susceptible to [DNS spoofing](https://www.imperva.com/learn/application-security/dns-spoofing/) or [man-in-the-middle](https://en.wikipedia.org/wiki/Man-in-the-middle_attack) attacks#, which are able to make the victim think it's communicating with someone else than who it's actually talking to, and thereby manipulate the victim's perception of current time.

After some deliberation I realized that the blockchain can be taken as a trustworthy log of past timestamps, the latest of which give a rough estimate of the current time. Thus –I thought– I could write a program that starts a Bitcoin node, requests from its peers the latest blocks and fetches the timestamps from their headers... done! Now, I'm pretty confident this method is robust against the attacks discussed in #, but I don't know how to formalise the method. Here's my idea.

In order for the method to equally apply to old and new users, let's assume that my computer starts a brand new node each time it wants to check the current time. Each time, it will DNS-lookup some node IPs and subsequently request the latest blocks from them, check their validity and, if positive, read the timestamps. This gives raise to the following question.

* What is the quickest way for my node to know that the blocks received from its peers have been validated by the network? Can it do so without downloading the full 400+GB blockchain nor compromising the robustness against DNS spoofing and MITM attacks?

My guess is that I could verify all the transactions, Merkle roots and headers of the blockchain provided by my peers; but still what would guarantee me that the branch that I'm looking at is backed by the network?

---

Despite the generic feeling of the question-marked questions, my sole goal is to turn the blockchain into a trustworthy timekeeping log (a "clockchain", if you would), not running a Bitcoin node *per se*. It would be ideal to find a specific solution to the problem but the only approaches I have come up with are as generic as the questions up there.

**Tags:** timestamp, block-validity, dns

> **Comments:**
> **username_1**: Possibly related: https://github.com/opentimestamps/restamp.  

---

## 1 answers

### Answer by username_2 on 2023-12-12. Score: 1

> **the blockchain can be taken as a trustworthy log of past timestamps, the latest of which give a rough estimate of the current time.**

Very very rough. Instead of tens of milliseconds with NTP you are talking about errors of the magnitude of hours with Bitcoin block timestamps. It can be *five or six orders of magnitude* worse!

If you are considering Bitcoin network adjusted time from Bitcoin Version messages, I don't think that has any guarantees about accuracy or even [monotonicity](https://bitcoin.stackexchange.com/q/915/13866)? It certainly doesn't take into account latency and jitter. I don't think it does much to counteract timestamp spoofing either. Apart from averaging a handful of sources.

> **What is the quickest way for my node to know that the blocks received from its peers have been validated by the network?**

There is no way to know.

Bitcoin nodes all perform their own validation. They never assume anyone else has performed validation for them. No Bitcoin nodes ever trust any other nodes. Bitcoin nodes effectively assume all other nodes are possible liars and proceed accordingly.

> **NTP doesn't sign timestamps**

NTP isn't a notary but it does have provision for securing reliable time.

<https://en.wikipedia.org/wiki/Network_Time_Protocol#Secure_extensions>

> **[NTP?] nodes are susceptible to DNS spoofing or man-in-the-middle attacks**

On the other hand, Bitcoin nodes have to counteract possible [Eclipse attacks](https://bitcoin.stackexchange.com/search?q=eclipse+attack) etc.


---

