go-merkle icon indicating copy to clipboard operation
go-merkle copied to clipboard

Generate a proof

Open AdamSLevy opened this issue 5 years ago • 3 comments

Currently there is no convenient method for extracting only the branch required to prove a given node. It would be nice to be able to specify a height and a node index and be provided a Tree containing only the branch containing that node up to the root.

AdamSLevy avatar Jul 25 '19 09:07 AdamSLevy

Hi @AdamSLevy,

If Input of height and index is given, then we can return an []Node from root to that indexed node.

We could verify and find the parent of the indexed node recursively and add it to slice height index. In that way we can return a []Node to user.

branchNodes[0] would be root node and branchNodes[h] would be the indexed node. branchNodes[1] would be either left/right child of branchNodes[0] depending on where indexed node is present.

We should be able to create a method for it.

haseth avatar Dec 01 '19 09:12 haseth

Hey @haseth did you ever get around to creating a convenience method for this? I'm looking to use this library in a project!

Thanks

pocockn avatar Jun 19 '20 10:06 pocockn

Hey @haseth did you ever get around to creating a convenience method for this? I'm looking to use this library in a project!

Thanks

Hey @pocockn, I haven't worked on it as I didn't get an approval on it, I think.

haseth avatar Jun 21 '20 08:06 haseth