Documentation ¶
Overview ¶
Package merkle provides functionality for creating and manipulating Merkle trees, with a focus on efficient and secure verification of data integrity.
The package offers tools for constructing Merkle trees, managing tree nodes, and generating and verifying Merkle proofs. It includes constants for default tree depth and empty leaf values. Key features include the ability to create new empty trees, set leaf values, retrieve proofs, and calculate the root hash of the tree.
Additionally, the package provides a hash function for big integers and utility functions for navigating the Merkle tree structure, such as obtaining parent and sibling indices and determining whether a node is a right child.
Note: The package assumes the use of 256-bit integers for node values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectToMerkleProofService ¶ added in v1.4.0
func ConnectToMerkleProofService(merkleProofServiceHost string, useTLS bool) (merkle.QueryClient, error)
Types ¶
type EmptyLeafProver ¶ added in v1.8.0
type EmptyLeafProver interface { GetEmptyLeafProof( ctx context.Context, in *merkle.GetEmptyLeafProofRequest, opts ...grpc.CallOption, ) (*merkle.GetEmptyLeafProofResponse, error) }
type Proof ¶
type Proof struct { Leaf TreeNode `json:"leaf"` // The Merkle tree node, which authenticity is proved by the Path. LeafIndex int `json:"leafIndex"` // Index of the Leaf in the Merkle tree. Path []TreeNode `json:"path"` }
func GetEmptyLeafProof ¶ added in v1.4.0
type Prover ¶ added in v1.8.0
type Prover interface { Proof( ctx context.Context, in *merkle.QueryProofRequest, opts ...grpc.CallOption, ) (*merkle.QueryProofResponse, error) }