Bitcoin

Timestamp – Get the current time using the Bitcoin network

I’m looking for a way for a computer program to be able to get a rough estimate of the current date and time with a very high level of confidence in order to check for contract expiration.

NTP is a widely used protocol for synchronizing computer clocks across a network. Despite providing highly accurate time measurements, NTP does not sign timestamps. In the context of my project, this lacks reliability in the sense that the nodes are vulnerable to DNS spoofing or man-in-the-middle attacks.#This can manipulate the victim’s perception of the current time by making them think they are communicating with someone other than the person they are actually talking to.

After some reflection, I realized that blockchain could be considered a trustworthy log of past timestamps. The latest timestamp provides a rough estimate of the current time. So I thought I could write a program that would start a Bitcoin node, ask its peers for the latest block, and get the timestamp from the header. Done! I am now confident that this method is robust against the attacks described previously. #, but I don’t know how to formalize the method. Here are my thoughts:

To make this method work equally well for existing and new users, let’s say I start a new node every time my computer wants to check the current time. Each time, after doing a DNS lookup of some node IP, we request the latest block, check its validity, and if positive, read its timestamp. This raises questions such as:

  • What is the fastest way for my node to know that the blocks it received from its peers have been verified by the network? Is it possible to do so without downloading the entire 400GB+ blockchain and compromising robustness against DNS spoofing and MITM attacks?

I think I can check all the transactions, Merkle roots and headers on the blockchain provided by my colleagues. But how can I ensure that the branch I’m looking at has the support of the network?


Despite the general feel of the question being asked, my only goal is not to run a Bitcoin node, but to turn the blockchain into a reliable timekeeping log (“clockchain”). by itself. It would be ideal to find a specific solution to the problem, but the only approach I’ve come up with is as general as the question above.

Related Articles

Back to top button