Documentation ¶
Index ¶
- Variables
- func BuildMap(size int) map[string][]byte
- func CalcRoot(data map[string][]byte) []byte
- func ConvertExistenceProof(p *cmtprotocrypto.Proof, key, value []byte) (*ics23.ExistenceProof, error)
- func CreateMembershipProof(data map[string][]byte, key []byte) (*ics23.CommitmentProof, error)
- func CreateNonMembershipProof(data map[string][]byte, key []byte) (*ics23.CommitmentProof, error)
- func GetKey(allkeys []string, loc Where) string
- func GetNonKey(allkeys []string, loc Where) string
- func SortedKeys(data map[string][]byte) []string
- type SimpleResult
- type Where
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyKey = errors.New("key is empty") ErrEmptyKeyInData = errors.New("data contains empty key") )
Functions ¶
func BuildMap ¶
BuildMap creates random key/values and stores in a map, returns a list of all keys in sorted order
func ConvertExistenceProof ¶
func ConvertExistenceProof(p *cmtprotocrypto.Proof, key, value []byte) (*ics23.ExistenceProof, error)
ConvertExistenceProof will convert the given proof into a valid existence proof, if that's what it is.
This is the simplest case of the range proof and we will focus on demoing compatibility here
func CreateMembershipProof ¶
CreateMembershipProof will produce a CommitmentProof that the given key (and queries value) exists in the map. If the key doesn't exist in the tree, this will return an error.
func CreateNonMembershipProof ¶
CreateNonMembershipProof will produce a CommitmentProof that the given key doesn't exist in the map. If the key exists in the tree, this will return an error.
func SortedKeys ¶
Types ¶
type SimpleResult ¶
type SimpleResult struct { Key []byte Value []byte Proof *cmtprotocrypto.Proof RootHash []byte }
SimpleResult contains a merkle.SimpleProof along with all data needed to build the confio/proof
func GenerateRangeProof ¶
func GenerateRangeProof(size int, loc Where) *SimpleResult
GenerateRangeProof makes a tree of size and returns a range proof for one random element
returns a range proof and the root hash of the tree