mpt

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2024 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveProof

func ResolveProof(proofBytes []byte) (scriptHash helper.UInt160, key []byte, proof [][]byte, err error)

ResolveProof get key and proofs from proofdata

func VerifyProof

func VerifyProof(root []byte, scriptHash helper.UInt160, key []byte, proof [][]byte) ([]byte, error)

VerifyProof directly verify proof

Types

type IKVReadOnlyDb

type IKVReadOnlyDb interface {
	Get(key []byte) ([]byte, error)
}

IKVReadOnlyDb to store data

type ProofDb

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

ProofDb a db to use for verify

func NewProofDb

func NewProofDb(proof [][]byte) *ProofDb

NewProofDb new instance of ProofDb from a string list

func (*ProofDb) Get

func (pd *ProofDb) Get(key []byte) ([]byte, error)

Get for TrieDb

type StateRoot

type StateRoot struct {
	Version   byte   `json:"version"`
	Index     uint32 `json:"index"`
	PreHash   string `json:"prehash"`
	StateRoot string `json:"stateroot"`
	Witness   struct {
		InvocationScript   string `json:"invocation"`
		VerificationScript string `json:"verification"`
	} `json:"witness"`
}

StateRoot truct of StateRoot message

func (*StateRoot) Deserialize

func (sr *StateRoot) Deserialize(br *io.BinaryReader)

func (*StateRoot) DeserializeUnsigned

func (sr *StateRoot) DeserializeUnsigned(br *io.BinaryReader)

func (*StateRoot) Serialize

func (sr *StateRoot) Serialize(bw *io.BinaryWriter)

func (*StateRoot) SerializeUnsigned

func (sr *StateRoot) SerializeUnsigned(bw *io.BinaryWriter)

type Trie

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

Trie mpt tree

func NewTrie

func NewTrie(root []byte, db IKVReadOnlyDb) (*Trie, error)

NewTrie new a trie instance

func (*Trie) Get

func (t *Trie) Get(path []byte) ([]byte, error)

Get try get value

Jump to

Keyboard shortcuts

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