Documentation
¶
Index ¶
- type MerkleProof
- type Node
- type Proofnode
- type Tree
- func (tree *Tree) AddData(data ...[]byte)
- func (tree *Tree) AddHash(data ...[]byte)
- func (tree *Tree) Generate() error
- func (tree *Tree) GetLeaf(index int) []byte
- func (tree *Tree) GetNodesAtHeight(h uint64) []Node
- func (tree *Tree) GetProof(index int) MerkleProof
- func (tree *Tree) Height() uint64
- func (tree *Tree) Root() []byte
- func (tree *Tree) VerifyProof(proof MerkleProof, root, value []byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree struct {
// All nodes, linear
Nodes []Node
// Points to each level in the node. The first level contains the root node
Levels [][]Node
// contains filtered or unexported fields
}
Tree presents merkle tree
func (*Tree) GetNodesAtHeight ¶
GetNodesAtHeight returns all nodes at a given height, where height 1 returns a 1-element slice containing the root node, and a height of tree.Height() returns the leaves
func (*Tree) VerifyProof ¶
func (tree *Tree) VerifyProof(proof MerkleProof, root, value []byte) bool
VerifyProof verify proof for value
Click to show internal directories.
Click to hide internal directories.