Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

mpt source pure

Variables 1

var ErrEmptyProof, ErrInvalidRoot, ErrUnexpectedNode, ErrInvalidReference, ErrPathMismatch, ErrValueMismatch, ErrKeyPresent, ErrKeyAbsent, ErrUnusedProof

 1var (
 2	ErrEmptyProof       = errors.New("mpt: empty proof")
 3	ErrInvalidRoot      = errors.New("mpt: invalid root length")
 4	ErrUnexpectedNode   = errors.New("mpt: unexpected node shape")
 5	ErrInvalidReference = errors.New("mpt: invalid child reference")
 6	ErrPathMismatch     = errors.New("mpt: path mismatch")
 7	ErrValueMismatch    = errors.New("mpt: value mismatch")
 8	ErrKeyPresent       = errors.New("mpt: key present")
 9	ErrKeyAbsent        = errors.New("mpt: key absent")
10	ErrUnusedProof      = errors.New("mpt: unused proof nodes")
11)
source

Functions 3

func EmptyRoot

1func EmptyRoot() [32]byte
source

EmptyRoot is keccak256(rlp("")), the root of an empty Ethereum MPT.

func Verify

1func Verify(root []byte, key []byte, value []byte, proof [][]byte) error
source

Verify verifies an Ethereum Merkle Patricia Trie existence proof.

root is the 32-byte trie root. key is expanded to nibbles and matched against the proof path. proof contains raw RLP-encoded nodes, ordered from root to leaf. value is the RLP string payload stored at the leaf or branch value slot.

func VerifyAbsence

1func VerifyAbsence(root []byte, key []byte, proof [][]byte) error
source

VerifyAbsence verifies that key is absent from the trie under root.

Imports 4

Source Files 2