3 ms·
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 t
by oconnor663 7y ago
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 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.
- rakoo 7y agoOk so the intermediary nodes are the concatenation of the children, that's what I missed. Thanks a lot for the details, and even more for the rest of your work !