merkle

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMountainRange

type IMountainRange[TIndex index.Value, THash types.HashType] interface {
	Add(ctx context.Context, values ...THash) error
	Get(ctx context.Context, index TIndex) (THash, error)
	ProofByIndex(ctx context.Context, index TIndex) (*Proof[TIndex, THash], error)
	Proof(ctx context.Context, item THash) (*Proof[TIndex, THash], error)
	Root(ctx context.Context) (IRoot[TIndex, THash], error)
	Size() TIndex
}

func NewMountainRange

func NewMountainRange[TIndex index.Value, THash types.HashType](hf types.Hasher[THash], indexes store.IIndexSource[TIndex, THash]) IMountainRange[TIndex, THash]

NewMountainRange creates a new Merkle Mountain Range.

type INode added in v0.1.3

type INode[THash types.HashType] interface {
	encoding.BinaryMarshaler
	Children() []THash
	SetLeft(h THash)
	SetRight(h THash)
}

func Node added in v0.1.3

func Node[THash types.HashType](children ...THash) INode[THash]

func NodeFromBinary added in v0.1.3

func NodeFromBinary[THash types.HashType](data []byte) (INode[THash], error)

type IRoot

type IRoot[TI index.Value, TH types.HashType] interface {
	Hash() TH
	ValidateProof(proof *Proof[TI, TH]) bool
}

type Proof added in v0.1.3

type Proof[TIndex index.Value, THash types.HashType] struct {
	Target     TIndex
	Hashes     []THash
	LeftPeaks  []THash
	RightPeaks []THash
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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