merkle

package
v0.0.0-...-180b776 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyProof

func VerifyProof(hash []byte, target *MerkleLeafNode, proof []*MerkleBranchNode) bool

Types

type AlreadyExistsError

type AlreadyExistsError struct {
	Key  []byte
	Node MerkleNode
}

func (*AlreadyExistsError) Error

func (e *AlreadyExistsError) Error() string

type HashCache

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

type Hasher

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

func NewHasher

func NewHasher() *Hasher

type MerkleBranchNode

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

Node in patricia hash trie

func BuildProof

func BuildProof(t *MerkleTrie, target *MerkleLeafNode) ([]*MerkleBranchNode, error)

Returns proof that a key exists within the trie

func (*MerkleBranchNode) Len

func (n *MerkleBranchNode) Len() int

func (*MerkleBranchNode) Repr

func (n *MerkleBranchNode) Repr() []byte

type MerkleHashNode

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

func (*MerkleHashNode) Len

func (n *MerkleHashNode) Len() int

func (*MerkleHashNode) Repr

func (n *MerkleHashNode) Repr() []byte

type MerkleLeafData

type MerkleLeafData struct {
	Key []byte
	Val interface{}
}

type MerkleLeafNode

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

func (*MerkleLeafNode) Equals

func (l *MerkleLeafNode) Equals(r *MerkleLeafNode) bool

func (*MerkleLeafNode) Len

func (n *MerkleLeafNode) Len() int

func (*MerkleLeafNode) Repr

func (n *MerkleLeafNode) Repr() []byte

type MerkleNode

type MerkleNode interface {
	Repr() []byte
	Len() int
}

type MerkleTrie

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

Patricia hash trie

func (*MerkleTrie) Add

func (t *MerkleTrie) Add(key []byte, val interface{}) error

Returns whether addition was successful It will be unsuccessful if the key already exists in the trie

func (*MerkleTrie) Contains

func (t *MerkleTrie) Contains(key []byte) bool

Returns whether the trie contains given key

func (*MerkleTrie) Get

func (t *MerkleTrie) Get(key []byte) interface{}

Returns the value stored at key, nil if the key is not in the trie

type NotFoundError

type NotFoundError struct {
	Key []byte
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

Jump to

Keyboard shortcuts

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