Versions in this module Expand all Collapse all v0 v0.0.2 Dec 7, 2022 Changes in this version + var EmptyNodeHash = hex.DecodeString("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421") + var EmptyNodeRaw = []byte + func Hash(node Node) []byte + func IsEmptyNode(node Node) bool + func IsNibble(nibble byte) bool + func Keccak256(data ...[]byte) []byte + func PrefixMatchedLen(node1 []Nibble, node2 []Nibble) int + func Serialize(node Node) []byte + func ToBytes(ns []Nibble) []byte + func VerifyProof(rootHash []byte, key []byte, proof Proof) (value []byte, err error) + type BranchNode struct + Branches [16]Node + Value []byte + func NewBranchNode() *BranchNode + func (b *BranchNode) RemoveBranch(nibble Nibble) + func (b *BranchNode) RemoveValue() + func (b *BranchNode) SetBranch(nibble Nibble, node Node) + func (b *BranchNode) SetValue(value []byte) + func (b BranchNode) HasValue() bool + func (b BranchNode) Hash() []byte + func (b BranchNode) Raw() []interface{} + func (b BranchNode) Serialize() []byte + type ExtensionNode struct + Next Node + Path []Nibble + func NewExtensionNode(nibbles []Nibble, next Node) *ExtensionNode + func (e ExtensionNode) Hash() []byte + func (e ExtensionNode) Raw() []interface{} + func (e ExtensionNode) Serialize() []byte + type LeafNode struct + Path []Nibble + Value []byte + func NewLeafNodeFromBytes(key, value []byte) *LeafNode + func NewLeafNodeFromKeyValue(key, value string) *LeafNode + func NewLeafNodeFromNibbleBytes(nibbles []byte, value []byte) (*LeafNode, error) + func NewLeafNodeFromNibbles(nibbles []Nibble, value []byte) *LeafNode + func (l LeafNode) Hash() []byte + func (l LeafNode) Raw() []interface{} + func (l LeafNode) Serialize() []byte + type Nibble byte + func FromByte(b byte) []Nibble + func FromBytes(bs []byte) []Nibble + func FromNibbleByte(n byte) (Nibble, error) + func FromNibbleBytes(nibbles []byte) ([]Nibble, error) + func FromString(s string) []Nibble + func ToPrefixed(ns []Nibble, isLeafNode bool) []Nibble + type Node interface + Hash func() []byte + Raw func() []interface{} + type Proof interface + Delete func(key []byte) error + Get func(key []byte) ([]byte, error) + Has func(key []byte) (bool, error) + Put func(key []byte, value []byte) error + Serialize func() [][]byte + type ProofDB struct + func NewProofDB() *ProofDB + func (w *ProofDB) Delete(key []byte) error + func (w *ProofDB) Get(key []byte) ([]byte, error) + func (w *ProofDB) Has(key []byte) (bool, error) + func (w *ProofDB) Put(key []byte, value []byte) error + func (w *ProofDB) Serialize() [][]byte + type Trie struct + func NewTrie() *Trie + func (t *Trie) FindPath(key []byte) ([]byte, []Node, bool) + func (t *Trie) Get(key []byte) ([]byte, bool) + func (t *Trie) Hash() []byte + func (t *Trie) Prove(key []byte) (Proof, bool) + func (t *Trie) Put(key []byte, value []byte)