func CompactTrees() [][][]byte
CompactTrees returns a slice of compact.Tree internal hashes for all subsequent trees built from LeafInputs() using the RFC 6962 hashing strategy.
func EmptyRootHash() []byte
EmptyRootHash returns the root hash for an empty Merkle tree that uses SHA256-based strategy from RFC 6962.
func LeafInputs() [][]byte
LeafInputs returns a slice of leaf inputs for testing Merkle trees.
func NodeHashes() [][][]byte
NodeHashes returns a structured slice of node hashes for all complete subtrees of a Merkle tree built from LeafInputs() using the RFC 6962 hashing strategy. The first index in the slice is the tree level (zero being the leaves level), the second is the horizontal index within a level.
func RootHashes() [][]byte
RootHashes returns a slice of Merkle tree root hashes for all subsequent trees built from LeafInputs() using the RFC 6962 hashing strategy. Hashes are indexed by tree size starting from an empty tree.
Tree implements an append-only Merkle tree. For testing.
type Tree struct {
// contains filtered or unexported fields
}
func New(hasher merkle.LogHasher) *Tree
New returns a new empty Merkle tree.
func (t *Tree) Append(hashes ...[]byte)
Append adds the given leaf hashes to the end of the tree.
func (t *Tree) AppendData(entries ...[]byte)
AppendData adds the leaf hashes of the given entries to the end of the tree.
func (t *Tree) ConsistencyProof(size1, size2 uint64) ([][]byte, error)
ConsistencyProof returns the consistency proof between the two given tree sizes. Requires 0 <= size1 <= size2 <= Size(), otherwise may panic.
func (t *Tree) Hash() []byte
Hash returns the current root hash of the tree.
func (t *Tree) HashAt(size uint64) []byte
HashAt returns the root hash at the given size. Requires 0 <= size <= Size(), otherwise panics.
func (t *Tree) InclusionProof(index, size uint64) ([][]byte, error)
InclusionProof returns the inclusion proof for the given leaf index in the tree of the given size. Requires 0 <= index < size <= Size(), otherwise may panic.
func (t *Tree) LeafHash(index uint64) []byte
LeafHash returns the leaf hash at the given index. Requires 0 <= index < Size(), otherwise panics.
func (t *Tree) Size() uint64
Size returns the current number of leaves in the tree.