OriginStampTimestamping / originstamp-verification

Check & verify the timestamps
MIT License
6 stars 0 forks source link

Images #1

Open thhepp opened 6 years ago

thhepp commented 6 years ago

grafik

NormanScholfield commented 5 years ago

Hello Thomas I am puzzled about linking the schema yo have drawn and Merkle trees which are nearly always a rows of 8 file hashes which is easy to understand. However, here we have 26 file hashes. I am unclear about how to start using the hashes from the xml file. Does the hash twinning begin at the first line (line 3 below) or the right-most level (line 21 - hilighted). If the latter, how does one work leftwards Then after identifying the lowest tree row file hash pairs we then we 13 hashes (6.5 pairs). How is the odd number of hashes delt with? While left or right positions are clear, what is the meaning of left/right designations Without being able to rehash the tree containing my file hash, my file timestamp cannot be validated Thanks for your help with this issue all the best Norman

image

vstange commented 5 years ago

Hello @NormanScholfield, the number of hashes i.e. rows in the Merkle tree file depends on the amount of hashes we received during the submission period. They can vary each day.

The original hash is marked with the annotation attribute "hash" and is indeed at the bottom of the tree - in your image at line 21 (I suspect it is line 21, since I can't see the "type"-attribute value of this row).

From the bottom up to the top you can then calculate the next ascending hash by combining and hashing the left and right child. An example explanation for this can also be found in this guide: https://docs.originstamp.com/howto/verification_without_OriginStamp.html#verification

NormanScholfield commented 5 years ago

Hello Vincent Thanks for your reply. My confusion is fundamental. I have read lots about Merkle trees, and it is easy to understand how they key is found. But the xml proof file looks very different. Is the xml file supposed to represent the original Merkle tree or is it a file that contains all the intermediate hashes derived from combinations of the raw hashed in the first row of the Merkle tree. If the xml file is just hashes from intermediate rows, then surely it only takes about 5 hashes to establish validity on my hash. In the images below: Are these 2 values combined and hashed? image And then these combined and hashed? image Then the upper "left" value combined with the lower "right2 value and hashed? image This is the all the data Capture After that, are they all added together and rehashed or what? I have searched extensively not found answers to any of these issues. Thanks for you patience and tolerance all the best Norman

vstange commented 5 years ago

Hello @NormanScholfield, your conclusion on how to calculate the hashes is correct. The file you receive is a branch of the full merkle tree. It contains all necessary intermediate hashes that only you need. With them you can recalculate the path and verify each hash along the way, from the bottom up until you reach the root hash (marked with "type"-attribute value "key").

In your example this would result in 13 calculations (not 5 like you mentioned). For your first calculation you would take:

sha256(
    "970b85f50632a0cfa5dc27012c6eacfc7c09222b1e58a451a527d3ae433751db"
    + (concat)
    "971001b36c0ef6192fd3be5cc9096643e71546adc50f8a5cd1e3b2daa1dd5bd2"
)

This should be "c7aefd58a6936f2b602a121aef408c4bf4749e835712d94cdebc8d8f39b5f430". You then take this hash together with its "left"-node and calculate the next parent.

After the successful verification of the root hash, i.e. private key, you finally can take the last steps to lookup the root hash in the blockchain.

For some parts the documentation is not explicit or clear enough so far, we will work on its improvement.

Best,