Documentation ¶
Overview ¶
package smt implements sparse merkle tree following LIP-0039.
Index ¶
- Constants
- func CalculateRoot(siblingHashes []codec.Hex, queries QueryProofs) ([]byte, error)
- func NewTrie(root []byte, keyLength int) *trie
- func UniqueAndSort(keys, values [][]byte) ([][]byte, [][]byte)
- func Verify(queryKeys [][]byte, proof *Proof, root []byte, keyLength int) (bool, error)
- type DBReadWriter
- type DBReader
- type DBWriter
- type Proof
- func (p *Proof) Copy() *Proof
- func (e *Proof) Decode(data []byte) error
- func (e *Proof) DecodeFromReader(reader *codec.Reader) error
- func (e *Proof) DecodeStrict(data []byte) error
- func (e *Proof) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *Proof) Encode() []byte
- func (e *Proof) MustDecode(data []byte)
- type QueryProof
- func (e *QueryProof) Decode(data []byte) error
- func (e *QueryProof) DecodeFromReader(reader *codec.Reader) error
- func (e *QueryProof) DecodeStrict(data []byte) error
- func (e *QueryProof) DecodeStrictFromReader(reader *codec.Reader) error
- func (e *QueryProof) Encode() []byte
- func (e *QueryProof) MustDecode(data []byte)
- type QueryProofs
Constants ¶
View Source
const ( DefaultKeyLength = 32 DefaultSubtreeHeight = 8 )
Variables ¶
This section is empty.
Functions ¶
func CalculateRoot ¶
func CalculateRoot(siblingHashes []codec.Hex, queries QueryProofs) ([]byte, error)
func UniqueAndSort ¶
Types ¶
type DBReadWriter ¶
type Proof ¶
type Proof struct { SiblingHashes []codec.Hex `json:"siblingHashes" fieldNumber:"1"` Queries []*QueryProof `json:"queries" fieldNumber:"2"` }
Proof holds a data for inclusion / exclusion proof.
func (*Proof) DecodeStrict ¶
func (*Proof) DecodeStrictFromReader ¶
func (*Proof) MustDecode ¶
type QueryProof ¶
type QueryProof struct { Key codec.Hex `json:"key" fieldNumber:"1"` Value codec.Hex `json:"value" fieldNumber:"2"` Bitmap codec.Hex `json:"bitmap" fieldNumber:"3"` // contains filtered or unexported fields }
QueryProof holds a query for the proof.
func (*QueryProof) Decode ¶
func (e *QueryProof) Decode(data []byte) error
func (*QueryProof) DecodeFromReader ¶
func (e *QueryProof) DecodeFromReader(reader *codec.Reader) error
func (*QueryProof) DecodeStrict ¶
func (e *QueryProof) DecodeStrict(data []byte) error
func (*QueryProof) DecodeStrictFromReader ¶
func (e *QueryProof) DecodeStrictFromReader(reader *codec.Reader) error
func (*QueryProof) Encode ¶
func (e *QueryProof) Encode() []byte
func (*QueryProof) MustDecode ¶
func (e *QueryProof) MustDecode(data []byte)
type QueryProofs ¶
type QueryProofs []*QueryProof
Click to show internal directories.
Click to hide internal directories.