Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateProof ¶
ValidateProof validates the merkle proof. If this is an exclusion proof the data should be nil.
Types ¶
type MerkleDB ¶
type MerkleDB struct {
// contains filtered or unexported fields
}
MerkleDB is a key value database which, in addition to storing key/value pairs, maintains a binary merkle tree of the data stored in the database. This allows us to create a root hash for the database as well as create compact inclusion and exclusion proofs for that data.
func NewMerkleDB ¶
NewMerkleDB returns a new database
func (*MerkleDB) Delete ¶
Delete removes a key/value pair from the database. In the tree structure the value will be set to the nil hash.
func (*MerkleDB) Exists ¶
Exists returns whether the key exists in the database along with a merkle inclusion or exclusion proof which links either the value, or nil, to the database's merkle root.
func (*MerkleDB) Get ¶
Get returns a value from the database for a given key along with a merkle proof linking the value to the database's root hash. This method with not return an exclusion proof if the value does not exist just an error.
type MerkleProof ¶
type MerkleProof []HashVal
MerkleProof represents a merkle inclusion or exclusion proof that links the data to a root hash.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents a branch in the merkle tree. The left and right values can either be: - A zero byte array (represents a nil value) - A hash of data - A hash of a child node