Documentation ¶
Index ¶
- type AugData
- type AugTree
- type BranchNode
- type BranchTree
- type Counter
- type DagData
- type DagTree
- type ElementData
- type MerkleTree
- func (mt MerkleTree) Branches() map[uint32]BranchTree
- func (mt MerkleTree) ExportNodes() []NodeData
- func (mt *MerkleTree) Finalize()
- func (mt MerkleTree) Indices() []uint32
- func (mt *MerkleTree) Insert(data ElementData, index uint32)
- func (mt *MerkleTree) RegisterIndex(indexes ...uint32)
- func (mt *MerkleTree) RegisterStoredLevel(depth, level uint32)
- func (mt MerkleTree) Root() NodeData
- func (mt *MerkleTree) SetElementHashFunction(_h elementHashFunc)
- func (mt *MerkleTree) SetHashFunction(_h hashFunc)
- func (mt *MerkleTree) StoredLevel() uint32
- type NodeData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AugData ¶
func (AugData) CounterBytes ¶
type AugTree ¶
type AugTree struct {
MerkleTree
}
func NewAugTree ¶
func NewAugTree() *AugTree
func (AugTree) CounterBranchArray ¶
func (AugTree) HashBranchArray ¶
type BranchNode ¶
type BranchNode struct { Hash NodeData Left *BranchNode Right *BranchNode ElementOnTheLeft bool }
func AcceptLeftSibling ¶
func AcceptLeftSibling(b *BranchNode, h NodeData) *BranchNode
explain the operation
func AcceptRightSibling ¶
func AcceptRightSibling(b *BranchNode, h NodeData) *BranchNode
func (BranchNode) ToNodeArray ¶
func (b BranchNode) ToNodeArray() []NodeData
type BranchTree ¶
type BranchTree struct { RawData ElementData HashedData NodeData Root *BranchNode }
func (BranchTree) ToNodeArray ¶
func (t BranchTree) ToNodeArray() []NodeData
type DagTree ¶
type DagTree struct {
MerkleTree
}
func NewDagTree ¶
func NewDagTree() *DagTree
func (DagTree) AllBranchesArray ¶
func (dt DagTree) AllBranchesArray() []smartpool.BranchElement
return only one array with necessary hashes for each index in order. Element's hash and root are not included eg. registered indexes are 1, 2, each needs 2 hashes then the function return an array of 4 hashes [a1, a2, b1, b2] where a1, a2 are proof branch for element at index 1 b1, b2 are proof branch for element at index 2
func (DagTree) AllDAGElements ¶
func (dt DagTree) AllDAGElements() []smartpool.Word
func (DagTree) MerkleNodes ¶
type ElementData ¶
type ElementData interface{}
type MerkleTree ¶
type MerkleTree struct {
// contains filtered or unexported fields
}
func (MerkleTree) Branches ¶
func (mt MerkleTree) Branches() map[uint32]BranchTree
func (MerkleTree) ExportNodes ¶
func (mt MerkleTree) ExportNodes() []NodeData
func (*MerkleTree) Finalize ¶
func (mt *MerkleTree) Finalize()
func (MerkleTree) Indices ¶
func (mt MerkleTree) Indices() []uint32
func (*MerkleTree) Insert ¶
func (mt *MerkleTree) Insert(data ElementData, index uint32)
func (*MerkleTree) RegisterIndex ¶
func (mt *MerkleTree) RegisterIndex(indexes ...uint32)
register indexes to build branches
func (*MerkleTree) RegisterStoredLevel ¶
func (mt *MerkleTree) RegisterStoredLevel(depth, level uint32)
func (MerkleTree) Root ¶
func (mt MerkleTree) Root() NodeData
func (*MerkleTree) SetElementHashFunction ¶
func (mt *MerkleTree) SetElementHashFunction(_h elementHashFunc)
func (*MerkleTree) SetHashFunction ¶
func (mt *MerkleTree) SetHashFunction(_h hashFunc)
func (*MerkleTree) StoredLevel ¶
func (mt *MerkleTree) StoredLevel() uint32
Click to show internal directories.
Click to hide internal directories.