mamamerkle

package module
v0.0.0-...-bd379c1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2018 License: BSD-3-Clause Imports: 8 Imported by: 1

README

mamamerkle

Sparse Merkle Trees implementation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SparseMerkleTree

type SparseMerkleTree struct {
	// contains filtered or unexported fields
}

func NewSparseMerkleTree

func NewSparseMerkleTree(depth int64, leaves map[uint64][]byte) (*SparseMerkleTree, error)

func (*SparseMerkleTree) CreateDefaultNodes

func (smt *SparseMerkleTree) CreateDefaultNodes(depth int64) [][]byte

func (*SparseMerkleTree) CreateMerkleProof

func (smt *SparseMerkleTree) CreateMerkleProof(leafId uint64) []byte

CreateMerkleProof generates a merkle proof for a leaf.

func (*SparseMerkleTree) CreateTree

func (smt *SparseMerkleTree) CreateTree(orderedLeaves *ordered_map.OrderedMap, depth int64, defaultNodes [][]byte) []*ordered_map.OrderedMap

func (*SparseMerkleTree) Depth

func (smt *SparseMerkleTree) Depth() int64

func (*SparseMerkleTree) Leaves

func (smt *SparseMerkleTree) Leaves() *ordered_map.OrderedMap

func (*SparseMerkleTree) Root

func (smt *SparseMerkleTree) Root() []byte

func (*SparseMerkleTree) Verify

func (smt *SparseMerkleTree) Verify(leafId uint64, proof []byte) (bool, error)

Verify checks if the proof for the given leaf is valid.

Jump to

Keyboard shortcuts

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