txaty / go-merkletree

Go Merkle Tree. High performance, Supporting parallel run, OpenZeppelin sorting pairs.
https://pkg.go.dev/github.com/txaty/go-merkletree
MIT License
110 stars 17 forks source link

Add more calculation options: tree building and proof generation #4

Closed txaty closed 1 year ago

txaty commented 1 year ago

The previous code's buildTree functions actually perform proof generations only, the whole Merkle Tree is not built and stored. However, it is necessary to keep the whole tree sometimes. For example, when you only needs the proofs of several data blocks, it is very costly to use the poof generation method to calculate the proofs for the whole set. So I implement the new tree building method, and defined three modes for Merkle Tree configuration: