Documentation ¶
Index ¶
- type Node
- type Proof
- type Subtree
- type Tree
- func (t *Tree) BuildNewWithData(data [][]byte)
- func (t *Tree) ExportSubtreesRoots() []byte
- func (t *Tree) GetIndexProofs(i int) []Proof
- func (t *Tree) ImportSubtreesRoots(subTreesRoots []byte)
- func (t *Tree) Push(data []byte)
- func (t *Tree) Reset()
- func (t *Tree) RootHash() []byte
- func (t *Tree) ValidateIndex(i int, data []byte) bool
- func (t *Tree) ValidateIndexByProofs(i int, data []byte, proofs []Proof) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) GetIndexProofs ¶
type Proof ¶
type Proof struct {
// contains filtered or unexported fields
}
todo: make proof recursive to not use array of Proof
type Subtree ¶
type Subtree struct {
// contains filtered or unexported fields
}
subtrees always should have power of 2 number of elements. tree could contain few of subtrees. root hash calculates from right to left by summing subtree roots hashes.
func (*Subtree) GetRootProofs ¶
get proofs for root of this subtree
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Merkle tree data structure based on RFC-6962 standard (https://tools.ietf.org/html/rfc6962#section-2.1) we separate whole tree to subtrees where nodes count equal power of 2 root hash calculates from right to left by summing subtree roots hashes.
func (*Tree) BuildNewWithData ¶
build completely new tree with data works the same (by time) as using Push method one by one
func (*Tree) ExportSubtreesRoots ¶
from right to left we need to export root hash and height of tree from those bytes we could restore it later
func (*Tree) GetIndexProofs ¶
going from right trees to left
func (*Tree) ImportSubtreesRoots ¶
from right to left after import we loosing indices (actually they don't need for pushing)