package merkle
- Alphabetic
- Public
- All
Type Members
-
case class
EmptyNode[D <: Digest]()(implicit hf: CryptographicHash[D]) extends Node[D] with Product with Serializable
Empty Merkle tree node.
Empty Merkle tree node. Either Leaf (if number of non-empty leafs is not a power of 2, remaining leafs are EmptyNode) or InternalNode (if both childs of an InternalNode are empty, it is EmptyNode)
- D
- hash function application type
- hf
- hash function
-
case class
EmptyRootNode[D <: Digest]()(implicit hf: CryptographicHash[D]) extends Node[D] with Product with Serializable
Empty root node.
Empty root node. If the tree contains no elements, it's root hash is array of 0 bits of a hash function digest length
- D
- hash function application type
- hf
- hash function
-
case class
InternalNode[D <: Digest](left: Node[D], right: Node[D])(implicit hf: CryptographicHash[D]) extends Node[D] with Product with Serializable
Internal node in Merkle tree
Internal node in Merkle tree
- D
- hash function application type
- left
- left child. always non-empty
- right
- right child. can be emptyNode
- hf
- hash function
-
case class
Leaf[D <: Digest](data: LeafData)(implicit hf: CryptographicHash[D]) extends Node[D] with Product with Serializable
Merkle tree leaf
Merkle tree leaf
- D
- hash function application type
- data
- leaf data.
- hf
- hash function
-
case class
MerkleProof[D <: Digest](leafData: LeafData, levels: Seq[(Digest, Side)])(implicit hf: CryptographicHash[D]) extends ScorexEncoding with Product with Serializable
Proof is given leaf data, leaf hash sibling and also siblings for parent nodes.
Proof is given leaf data, leaf hash sibling and also siblings for parent nodes. Using this data, it is possible to compute nodes on the path to root hash, and the hash itself. The picture of a proof given below. In the picture, "^^" is leaf data(to compute leaf hash from), "=" values are to be computed, "*" values are to be stored.
........= Root ..... / \ .... * = ....... / \ ...... * = ......... /.\ .........* = ............ ^^
- leafData
- leaf data bytes
- levels
- levels in proof, bottom up, each level is about stored value and position of computed element (whether it is left or right to stored value)
- case class MerkleTree[D <: Digest](topNode: Node[D], elementsHashIndex: Map[ofByte, Int]) extends Product with Serializable
- trait Node[D <: Digest] extends ScorexEncoding
Value Members
- object MerkleProof extends Serializable
- object MerkleTree extends Serializable