Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import warnings
- warnings.simplefilter("ignore", UserWarning)
- import merkletools
- mt = merkletools.MerkleTools(hash_type="sha256")
- #TBD Add 6 transaction "leaves" to the tree: ["transaction1","transaction2","transaction3"], ["transaction4", "transaction5","transaction6"]
- mt.add_leaf(["transaction1","transaction2","transaction3"], True)
- mt.add_leaf(["transaction4", "transaction5","transaction6"], True)
- #TBD Make the tree
- mt.make_tree()
- #TBD Print Merkle Root
- print("root:", mt.get_merkle_root() )
- #TBD Get the proof for transaction2
- print(mt.get_proof(1))
- #TBD Validate the proof. How many transactions were required to validate proof?
- print(mt.validate_proof(mt.get_proof(1), mt.get_leaf(1), mt.get_merkle_root()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement