https://github.com/alpacaaa/purescript-merkle-tree
Merkle Trees in Purescript.
https://github.com/alpacaaa/purescript-merkle-tree
merkle-tree purescript
Last synced: 4 months ago
JSON representation
Merkle Trees in Purescript.
- Host: GitHub
- URL: https://github.com/alpacaaa/purescript-merkle-tree
- Owner: alpacaaa
- License: mit
- Created: 2017-10-01T07:49:51.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-26T12:11:31.000Z (over 8 years ago)
- Last Synced: 2026-01-23T07:40:45.833Z (5 months ago)
- Topics: merkle-tree, purescript
- Language: PureScript
- Homepage:
- Size: 10.7 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# purescript-merkle-tree
Merkle Tree data structure.
This is mostly a direct port of the amazing Haskell library [adjoint-io/merkle-tree](https://github.com/adjoint-io/merkle-tree) to Purescript.
### Example
```haskell
import Data.List as List
import Crypto.Hash.MerkleTree as MT
main = do
-- Does the proof prove that `mleaf` exists in `mtree`?
log $ show $ MT.validateMerkleProof proof (MT.mtRoot mtree) mleaf
where
-- Build a merkle tree from a list of data
mtree = MT.mkMerkleTree $ List.fromFoldable ["tx1", "tx2", "tx3"]
-- Construct merkle proof that a leaf exists in `merkleTree`
mleaf = MT.mkLeafRootHash "tx2"
proof = MT.merkleProof mtree mleaf
```
### Documentation
Module documentation is [published on Pursuit](http://pursuit.purescript.org/packages/purescript-merkle-tree).