Reputation: 30165
Assuming:
...how do I request a particular data node (i.e. leaf node) from the tree, such as the first, the last, or perhaps the nth data node without traversing the entire tree? I want to find any such data node in O(log2n) time.
In principle I know how to achieve this, finding the nth node in O(log2n) time on a complete binary tree starting from the root, using a solution like this or this. However, as stated in assumption #4, I don't start with knowing how many nodes are in the Merkle tree and...I'm simply hoping that IPLD (or similar mechanism) simply has a way to do this for me.
If indeed IPLD can do this, can someone provide pertinent sample code (or pseudo code)? Ultimately I'm hoping that IPFS provides some means to assist with this.
Also, if there is something wrong with any of my assumptions - please clarify. For example, if Merkle trees on IPFS don't always store data nodes in the leaves, that would be good to know.
Upvotes: 0
Views: 32