Documentation
¶
Overview ¶
Package rmt implements regular merkle tree following LIP-0031.
Index ¶
- func CalculateRoot(data [][]byte) []byte
- func CalculateRootFromRightWitness(nodeIndex uint64, appendPath [][]byte, rightWitness [][]byte) []byte
- func CalculateRootFromUpdateData(updateData [][]byte, proof *Proof) ([]byte, error)
- func VerifyProof(queryHashes [][]byte, proof *Proof, rootHash []byte) bool
- func VerifyRightWitness(nodeIndex uint64, appendPath [][]byte, rightWitness [][]byte, root []byte) bool
- type Database
- type Proof
- type RegularMerkleTree
- func (d *RegularMerkleTree) Append(value []byte) error
- func (d *RegularMerkleTree) AppendPath() [][]byte
- func (d *RegularMerkleTree) GenerateProof(queryHashes [][]byte) (*Proof, error)
- func (d *RegularMerkleTree) GenerateRightWitness(nodeIndex uint64) ([][]byte, error)
- func (d *RegularMerkleTree) Root() []byte
- func (d *RegularMerkleTree) Size() uint64
- func (d *RegularMerkleTree) Update(idxs []uint64, updateData [][]byte) error
- type RootWithAppendPath
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateRoot ¶
CalculateRoot returns a root hash with given data set.
Types ¶
type Proof ¶
type Proof struct { Size uint64 `fieldNumber:"1"` Idxs []uint64 `fieldNumber:"2"` SiblingHashes [][]byte `fieldNumber:"3"` }
Proof holds the proof for lisk tree.
func (*Proof) DecodeStrict ¶
func (*Proof) DecodeStrictFromReader ¶
func (*Proof) MustDecode ¶
type RegularMerkleTree ¶
type RegularMerkleTree struct {
// contains filtered or unexported fields
}
RegularMerkleTree holds lisk markle tree.
func NewRegularMerkleTree ¶
func NewRegularMerkleTree(db Database) *RegularMerkleTree
NewRegularMerkleTree returns new tree with initial value.
func NewRegularMerkleTreeWithPastData ¶
func NewRegularMerkleTreeWithPastData(db Database) (*RegularMerkleTree, error)
NewRegularMerkleTreeWithPastData returns new tree with existing root and append path.
func (*RegularMerkleTree) Append ¶
func (d *RegularMerkleTree) Append(value []byte) error
Append adds value to the tree.
func (*RegularMerkleTree) AppendPath ¶
func (d *RegularMerkleTree) AppendPath() [][]byte
AppendPath returns current append path of the tree.
func (*RegularMerkleTree) GenerateProof ¶
func (d *RegularMerkleTree) GenerateProof(queryHashes [][]byte) (*Proof, error)
func (*RegularMerkleTree) GenerateRightWitness ¶
func (d *RegularMerkleTree) GenerateRightWitness(nodeIndex uint64) ([][]byte, error)
func (*RegularMerkleTree) Root ¶
func (d *RegularMerkleTree) Root() []byte
Root returns current root of the tree.
func (*RegularMerkleTree) Size ¶
func (d *RegularMerkleTree) Size() uint64
Size returns current data length of the tree.
type RootWithAppendPath ¶
func CalculateRootFromAppendPath ¶
func CalculateRootFromAppendPath(value []byte, appendPath [][]byte, size uint64) *RootWithAppendPath
Click to show internal directories.
Click to hide internal directories.