Package com.privatechain.crypto
Class MerkleTree.MerkleProof
java.lang.Object
com.privatechain.crypto.MerkleTree.MerkleProof
- Enclosing class:
MerkleTree
Immutable Merkle inclusion proof for a single transaction.
A proof consists of an ordered list of MerkleTree.MerkleProof.ProofNode elements, one per
tree level from the leaf up to (but not including) the root. Each node provides
the sibling hash and whether the sibling is the left child at that level
(FR-CRYPTO-07).
- Since:
- 1.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classImmutable value holding a sibling hash and its relative position at one level of the Merkle tree. -
Constructor Summary
ConstructorsConstructorDescriptionMerkleProof(String transactionId, List<MerkleTree.MerkleProof.ProofNode> path) Constructs a Merkle proof. -
Method Summary
-
Constructor Details
-
MerkleProof
Constructs a Merkle proof.- Parameters:
transactionId- the transaction this proof covers (non-null, non-blank)path- immutable list of proof nodes from leaf to root (non-null)- Throws:
NullPointerException- if transactionId or path is nullIllegalArgumentException- if transactionId is blank
-
-
Method Details
-
getTransactionId
Returns the transaction ID this proof covers.- Returns:
- non-null, non-blank transaction ID
-
getPath
Returns the ordered sibling path from leaf to root.- Returns:
- unmodifiable list of
MerkleTree.MerkleProof.ProofNode
-
getDepth
public int getDepth()Returns the depth of the tree from which this proof was generated, which equals the number of sibling hashes in the path.- Returns:
- tree depth (0 for a single-transaction block)
-
toString
-