chainpoint

package
v0.0.0-...-fffdf24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BagHasher

type BagHasher struct {
	Root *Node
}

BagHasher represents an instance of Chainpoint merkle tree based hasher

func NewBagHasher

func NewBagHasher() *BagHasher

NewBagHasher returns a new Chainpoint merkle tree based hasher

func (*BagHasher) Create

func (c *BagHasher) Create(entries merkle.BagEntries) (
	hash []byte, leaves []*Node)

Create creates a Chainpoint merkle tree

func (*BagHasher) GetLatestProofs

func (c *BagHasher) GetLatestProofs(keys ...[]byte) (proofs []merkle.Proof)

GetLatestProofs is not implemented

func (*BagHasher) GetProofs

func (c *BagHasher) GetProofs(version int64, keys ...[]byte) (proofs []merkle.Proof)

GetProofs is not implemented

func (*BagHasher) Height

func (c *BagHasher) Height() (height int)

Height returns the height of the Chainpoint merkle tree

func (*BagHasher) NodeToProof

func (c *BagHasher) NodeToProof(node *Node) merkle.Proof

NodeToProof converts a merkle tree leaf node into a merkle proof

func (*BagHasher) Patch

func (c *BagHasher) Patch(entries merkle.BagEntries, proofKeys ...[]byte) (hash []byte, proofs []merkle.Proof)

Patch initializes or reconstructs a Chainpoint merkle tree

func (*BagHasher) SaveVersion

func (c *BagHasher) SaveVersion() (nextVersion int64)

SaveVersion is not implemented

func (*BagHasher) Size

func (c *BagHasher) Size() (size int)

Size returns the size of the Chainpoint merkle tree

func (*BagHasher) Version

func (c *BagHasher) Version() (version int64)

Version is not implemented

type Node

type Node struct {
	Key       []byte
	Value     []byte
	Height    int8
	Size      int64
	Hash      []byte
	LeftHash  []byte
	RightHash []byte
	Parent    *Node
}

Node represents a tree node in hasher

func PairwiseCombine

func PairwiseCombine(nodes []*Node) []*Node

PairwiseCombine combines a layer of merkle nodes and returns one layer above the bottom layer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL