Documentation
¶
Overview ¶
Package merkle is a fixed merkle tree implementation
Example (Complete) ¶
items := [][]byte{[]byte("alpha"), []byte("beta"), []byte("gamma"), []byte("delta"), []byte("epsilon")} tree := NewTree(md5.New()) err := tree.generate(items) if err != nil { fmt.Println(err) return } fmt.Printf("Height: %d\n", tree.height()) fmt.Printf("Root: %v\n", tree.root()) fmt.Printf("N Leaves: %v\n", len(tree.leaves())) fmt.Printf("Height 2: %v\n", tree.getNodesAtHeight(2))
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MerkleTree ¶
type SMT ¶
type SMT struct {
// contains filtered or unexported fields
}
A Sparse Merkle Tree which support all empty leaves lies in right
func (*SMT) GetMerkleProof ¶
Leaf mumber begins with 0
Click to show internal directories.
Click to hide internal directories.