Re:Bao: A verified streaming tool based on BLAKE3
by rakoo on Friday January 17, 2020 @04:37AM
(#22073252)
Understood. My question was more about what is the exact content of a slice, apart from the chunk: is it the sibling's hash and the uncles hash ? Something else ?
Re:Bao: A verified streaming tool based on BLAKE3
by oconnor663 on Friday January 17, 2020 @10:21AM
(#22075313)
It's the set of parent nodes on the path from the root to the chunk(s), plus the chunks themselves. Parent nodes contain the hashes / chaining values of their two children, so you could also think of this as including sibling hashes. For example, consider this tree representing a 4 KiB file:
root
/ \
parent1 parent2
/ \ / \
chunk1 chunk2 chunk3 chunk4
Say we build a slice containing only chunk2. The contents of that slice will be: [4096][root][parent1][chunk2]
The parent node parent1 is [hash of chunk1][hash of chunk2], and the root node is [hash of parent1][hash of parent2]. The 8-byte total length on the front (4096) is the same as in the full encoding; it defines the structure of the tree, so the decoder knows how many parent nodes to expect.For more details: https://github.com/oconnor663/bao/blob/master/docs/spec.md
This is my first time looking at the Dat protocol. Thanks for pointing that out.
Yes, BLAKE3 is a Merkle tree, and what Bao is doing is conceptually similar to BitTorrent. (BEP 30 is even cited in the BLAKE3 spec.) Bao's goal is to be a general-purpose wire format and implementation library, for any application that needs verified streaming. Applications that use BLAKE3 for generic file hashing today can also start doing verified streaming at any point in the future, without needing any other trusted metadata.