Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIndexOutOfBounds = errors.New("merkle tree data index out of bounds")
Functions ¶
func EvalMerklePath ¶
EvalMerklePath returns root hash calculated from the given leaf and path items
Types ¶
type MerkleTree ¶
type MerkleTree struct {
// contains filtered or unexported fields
}
func New ¶
func New[T Data](hashAlgorithm crypto.Hash, data []T) (*MerkleTree, error)
New creates a new canonical Merkle Tree.
func (*MerkleTree) GetMerklePath ¶
func (s *MerkleTree) GetMerklePath(leafIdx int) ([]*PathItem, error)
GetMerklePath extracts the merkle path from the given leaf to root.
func (*MerkleTree) GetRootHash ¶
func (s *MerkleTree) GetRootHash() []byte
GetRootHash returns the root Hash of the Merkle Tree.
func (*MerkleTree) PrettyPrint ¶
func (s *MerkleTree) PrettyPrint() string
PrettyPrint returns human readable string representation of the Merkle Tree.
Click to show internal directories.
Click to hide internal directories.