Documentation ¶
Index ¶
- Constants
- Variables
- func Verify(proof []Hash, root Hash, leaf Leaf) bool
- type Hash
- type Leaf
- type MerkleTree
- func (t *MerkleTree) AddLeaf(leaf Leaf) error
- func (t *MerkleTree) GetExpectedHashFromPair(h1, h2 Hash) Hash
- func (t *MerkleTree) GetIndexForLeaf(leaf Leaf) (int, error)
- func (t *MerkleTree) GetLeafCount() uint64
- func (t *MerkleTree) GetLeafHash(leaf Leaf) Hash
- func (t *MerkleTree) GetProofForLeafAtIndex(forLeaf, untilLeaf uint64) ([]Hash, error)
- func (t *MerkleTree) GetRoot() Hash
- func (t *MerkleTree) GetZeroValues() []Hash
- func (t *MerkleTree) String() string
- type Seed
Constants ¶
View Source
const (
// todo: 64 levels causes an overflow issue
MaxLevels = 63
)
Variables ¶
Functions ¶
Types ¶
type MerkleTree ¶
type MerkleTree struct {
// contains filtered or unexported fields
}
Reference in-memory implementation only. It's not terribly performant, but can be used to validate other more optimized implementations.
func (*MerkleTree) AddLeaf ¶
func (t *MerkleTree) AddLeaf(leaf Leaf) error
func (*MerkleTree) GetExpectedHashFromPair ¶
func (t *MerkleTree) GetExpectedHashFromPair(h1, h2 Hash) Hash
func (*MerkleTree) GetIndexForLeaf ¶
func (t *MerkleTree) GetIndexForLeaf(leaf Leaf) (int, error)
func (*MerkleTree) GetLeafCount ¶
func (t *MerkleTree) GetLeafCount() uint64
func (*MerkleTree) GetLeafHash ¶
func (t *MerkleTree) GetLeafHash(leaf Leaf) Hash
func (*MerkleTree) GetProofForLeafAtIndex ¶
func (t *MerkleTree) GetProofForLeafAtIndex(forLeaf, untilLeaf uint64) ([]Hash, error)
todo: We'll need a more efficient version of this method in production
func (*MerkleTree) GetRoot ¶
func (t *MerkleTree) GetRoot() Hash
func (*MerkleTree) GetZeroValues ¶
func (t *MerkleTree) GetZeroValues() []Hash
func (*MerkleTree) String ¶
func (t *MerkleTree) String() string
Click to show internal directories.
Click to hide internal directories.