Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data MerkleTree a
- = MerkleEmpty
- | MerkleTree Word32 (MerkleNode a)
- newtype MerkleRoot a = MerkleRoot {}
- data MerkleNode a
- = MerkleBranch {
- mRoot :: MerkleRoot a
- mLeft :: MerkleNode a
- mRight :: MerkleNode a
- | MerkleLeaf {
- mRoot :: MerkleRoot a
- mVal :: a
- = MerkleBranch {
- mkMerkleTree :: [ByteString] -> MerkleTree ByteString
- mkRootHash :: MerkleRoot a -> MerkleRoot a -> MerkleRoot a
- mkLeafRootHash :: ByteArrayAccess a => a -> MerkleRoot a
- emptyHash :: MerkleRoot a
- newtype MerkleProof a = MerkleProof {
- getMerkleProof :: [ProofElem a]
- merkleProof :: forall a. MerkleTree a -> MerkleRoot a -> MerkleProof a
- validateMerkleProof :: forall a. MerkleProof a -> MerkleRoot a -> MerkleRoot a -> Bool
- mtRoot :: MerkleTree a -> MerkleRoot a
- mtSize :: MerkleTree a -> Word32
- mtHash :: MerkleTree a -> ByteString
- mtHeight :: Int -> Int
- testMerkleProofN :: Int -> IO Bool
Documentation
data MerkleTree a Source #
A merkle tree.
Instances
newtype MerkleRoot a Source #
A merkle tree root.
Instances
data MerkleNode a Source #
MerkleBranch | |
| |
MerkleLeaf | |
|
Instances
Constructors
mkMerkleTree :: [ByteString] -> MerkleTree ByteString Source #
Smart constructor for MerkleTree
.
mkRootHash :: MerkleRoot a -> MerkleRoot a -> MerkleRoot a Source #
mkLeafRootHash :: ByteArrayAccess a => a -> MerkleRoot a Source #
emptyHash :: MerkleRoot a Source #
Merkle Proof
newtype MerkleProof a Source #
MerkleProof | |
|
Instances
merkleProof :: forall a. MerkleTree a -> MerkleRoot a -> MerkleProof a Source #
Construct a merkle tree proof of inclusion Walks the entire tree recursively, building a list of "proof elements" that are comprised of the current node's root and it's sibling's root, and whether it is the left or right sibling (this is necessary to determine the order in which to hash each proof element root and it's sibling root). The list is ordered such that the for each element, the next element in the list is the proof element corresponding to the node's parent node.
validateMerkleProof :: forall a. MerkleProof a -> MerkleRoot a -> MerkleRoot a -> Bool Source #
Validate a merkle tree proof of inclusion
Size
mtRoot :: MerkleTree a -> MerkleRoot a Source #
Returns root of merkle tree.
mtSize :: MerkleTree a -> Word32 Source #
mtHash :: MerkleTree a -> ByteString Source #
Returns root of merkle tree root hashed.