Proving the passage of time with blockchain
On Feb 21st 2022, a video of the Russia Security Council meeting was broadcasted at 5pm Moscow time. There were no indications if the meeting was live or recorded until a watch in the video showed that it was 12:47pm instead. It then occurred to me there are currently no tools that prove that a video is live.
An idea came to my head - we could show an image that changes while live-streaming to prove that the video is happening in real-time. This series of images would need to be impossible to predict and publically verifiable to prevent spoofing or editing tricks.
I realized this was already a solved problem in the form of proof of work. Thanks to the cryptographic properties of blockchain, the latest block of a blockchain is effectively impossible to predict. All we have to do now is choose a blockchain and transform its head of the chain into an image.
Finding a solution
To make sure the video is live, the time to generate a new block needs to be just right.
- It needs to be short enough to prevent manipulation attempts such as editing and delayed playbacks.
- It also needs to be long enough for humans to perform an action (e.g. committing the image to memory).
The most well-known blockchain, Bitcoin, would not be a good fit here as the average confirmation time is almost 15 minutes. On the other hand, Ethereum, the runner-up, has an average confirmation time of 13-15 seconds. That is the sweet spot that we want.
The next bit would be picking what kind of images to show. Ethereum uses the SHA-256 cryptographic hash function, which means the block hashes are 256 bits in length. 256 bits is quite a bit of information to squeeze into an image.
At first, I planned on showing a grid of colors since that would be the easiest to represent.
|Bits||Palette Size||Grid Size|
However, none of the above configurations make for an image that would be easy to memorize in 13 seconds. Too many colors would also make it hard to differentiate images for people who are color blind.
So I'm back to the drawing board. 256 bits is a lot of information for any human to process. What if we offloaded this to a computer instead? My first thought went to a QR code.
Making it work
Let's try to represent a 256 bit hash in a QR code.
That's great and all, but scanning it with your phone only shows the hash, which is not very user-friendly. A website where you can navigate to would be far more convenient. As a result, I built a mini-site on this blog.
Now let's connect to the Ethereum network to listen for the creation of new blocks. I'm using the ethers library here.
- Local Time
- UTC Time
- Block number
And we're done! This changing QR code now represents the passage of time, which is publically verifiable by anyone with internet access. Users are free to cross validate the information with sites such as etherscan.io.
I built a dedicated page for this proof of time concept. Live streamers are welcome to use it to prove that they are indeed live and the stream is happening real-time.
The best part about this project is that, due to the distributed nature of blockchain, anyone can replicate it and get the same results. I recommend giving it a try, as it is a quick, fun way to demonstrate the practical usage of distributed consensus.