Proofs
Here you can find examples on how you can prove the existence of your data at a certain point in time. We assume that a transaction with a Merkle tree root is appended on a blockchain block and that the Merkle tree has a leaf with the hash output of your data. In all the examples we will use the SHA-256 hash function.
First Example
Alice wants to prove that she finalized her thesis before the deadline.
She can request the timestamp details from our API. A part of the response will include something like the following.
"rootHash": "7305db9b2abccd706c256db3d97e5ff48d677cfe4d3a5904afb7da0e3950e1e2",
"proof": [],
Since the proof
is empty it means that there were no other hashes in the Merkle tree and the root hash is the same as her document's hash.
Alice can ask her professor to hash her document and compare the hash with the root hash that is appended on the blockchain. If the hashes are the same, the professor will be convinced that the document existed before the block was created.
Second Example
Bob wants to prove that he recorded his predictions about an event before the event.
Bob can request the timestamp details from our API. A part of the response will include something like the following.
"rootHash": "37f6a60ad1e57f49cf2184e5062caac561befaffdf37649a8ce336266631506f",
"proof": [
{
"position": "left",
"hash": "52a0412dfafead865bc77b315c88b5de35edfc2d1b7142db1d589dcd687eee87"
},
{
"position": "right",
"hash": "80a9e67a10e90a82c14ef391b784f3e941cb42a7cff7a98e10256b5c3240a816"
}
],
Similar to the first example, but this time the proof
array has two elements. This means that the root hash isn't not the same with the hash of his predictions because the Merkle tree has more than one leaf.
Bob's audio recording has a hash value: 34f1b141903c0935b3b29884cb421bb1f8e202e32866572dd03a28d2c2a93ce6
. To calculate the root hash he needs use the proof
elements. Each proof element contains a position (left or right) and a hash. Bob needs to concatenate his document's hash with the first proof element. The first proof element has a position with value left
so it will be on the left side and his document's hash on the right side.
sha256(predictions.mp3) = 34f1b141903c0935b3b29884cb421bb1f8e202e32866572dd03a28d2c2a93ce6
// Bob puts 52a0412dfafead865bc77b315c88b5de35edfc2d1b7142db1d589dcd687eee87 on the left and his hash on the right side and calculates the hash.
sha256(52a0412dfafead865bc77b315c88b5de35edfc2d1b7142db1d589dcd687eee8734f1b141903c0935b3b29884cb421bb1f8e202e32866572dd03a28d2c2a93ce6) = cd1dc61a232405cf2af01ae6a87f90e24e82bda17224f0576435e3249012d115
The second proof element has a position with value right
so it will be on the right side and the result of the previous step on the left side.
// Result from previous step
sha256(52a0412dfafead865bc77b315c88b5de35edfc2d1b7142db1d589dcd687eee8734f1b141903c0935b3b29884cb421bb1f8e202e32866572dd03a28d2c2a93ce6) = cd1dc61a232405cf2af01ae6a87f90e24e82bda17224f0576435e3249012d115
// Bob puts the result from the previous step on the left and 80a9e67a10e90a82c14ef391b784f3e941cb42a7cff7a98e10256b5c3240a816 on the right side and calculates the hash.
sha256(cd1dc61a232405cf2af01ae6a87f90e24e82bda17224f0576435e3249012d11580a9e67a10e90a82c14ef391b784f3e941cb42a7cff7a98e10256b5c3240a816) = 37f6a60ad1e57f49cf2184e5062caac561befaffdf37649a8ce336266631506f
If we had more proof elements we would repeat the same process until we use all the proof
elements.
The result of the last step is the same with the root hash of the Merkle tree. Bob can ask his friends to hash his file and use the proof
elements to calculate the root hash. Then, compare the root hash with the root hash that is appended on the blockchain. If the hashes are the same, his friends will be convinced that Bob's file existed before the block was created.