{"id":20008314,"url":"https://github.com/bethanyuo/merkle-tree","last_synced_at":"2026-06-05T22:31:20.548Z","repository":{"id":116556582,"uuid":"277878667","full_name":"bethanyuo/merkle-tree","owner":"bethanyuo","description":"Create a Merkle Tree using Python","archived":false,"fork":false,"pushed_at":"2020-07-07T18:11:56.000Z","size":887,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T14:25:10.372Z","etag":null,"topics":["blockchain","blockchain-technology","merkle-patricia-trie","merkle-tree","python-3","testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bethanyuo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-07T17:17:52.000Z","updated_at":"2020-11-21T01:16:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"135d1578-cc65-46f9-a46b-71a19e808a02","html_url":"https://github.com/bethanyuo/merkle-tree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bethanyuo%2Fmerkle-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bethanyuo%2Fmerkle-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bethanyuo%2Fmerkle-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bethanyuo%2Fmerkle-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bethanyuo","download_url":"https://codeload.github.com/bethanyuo/merkle-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241446730,"owners_count":19964216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","blockchain-technology","merkle-patricia-trie","merkle-tree","python-3","testing"],"created_at":"2024-11-13T07:09:20.846Z","updated_at":"2026-06-05T22:31:20.501Z","avatar_url":"https://github.com/bethanyuo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Merkle Tree\nThe implementation of a Merkle Tree using Python. Provided with a merkletree.py (Python Class) and two test files, you can test the newly implemented functionality of the tree. Steps to implement the build_root method and the request_proof method are provided below.  \n\n## Merkle Tree Specification\n\n### 1.\tBuilding a Merkle Tree\nEven number of elements (Hash can be any cryptographically secure hash function)\n\n![image1](./images/im1.png)\n\n### 2.\tOdd number of elements\n\n![image2](./images/im2.png)\n\n### 3.\tBuilding a Merkle Proof \n\na.\tVerify that L3 was indeed inside the tree and took part in the construction of the Root Hash \n\nb.\tThe nodes that are colored in green are required for the proof \n\n![image3](./images/im3.png)\n\n## Request Proof Solution (build_root should be implemented)\n\nWe are going to use a modified version of the Depth-First-Search Algorithm\n\n*\tWrite the pre-conditions of the algorithm \n    *\tHash the passed in value using self.digest delegate since the values in the leaves are not kept in plaintext \n    *\tIf the hash of the value that was passed in is not contained in the tree, raise an Exception. \n    *\tCreate the __build_valid_proof method that we will use to implement the algorithm for the proof \n    *\tPass the root, the hashed value and an empty list to the __build_valid_proof method \n    *\tAdd the value itself as a part of the proof \n\n## Testing the solution \nNow test the solutions with the provided python test files. \n\n* merkleproof-test\n```bash\npython3 merkleproof-test.py\n```\nThe following output signalizes that all the tests passed.\n\n```bash\ntest_merkle_should_contain_items (__main__.MerkleProofTest) ... ok\ntest_merkle_should_return_correct_proof_on_edge_case (__main__.MerkleProofTest) ... ok\ntest_merkle_should_return_correct_proof_when_leaf_is_left_child (__main__.MerkleProofTest) ... ok\ntest_merkle_should_return_correct_proof_when_leaf_is_right_child (__main__.MerkleProofTest) ... ok\ntest_merkle_should_throw_on_requesting_proof_for_non_existing_element (__main__.MerkleProofTest) ... expected failure\n```\n* merkletree-test\n```bash\npython3 merkletree-test.py\n```\nThe following output signalizes that all the tests passed.\n```bash\ntest_merkle_no_digest (__main__.MerkleTest) ... ok\ntest_merkle_with_cryptographic_digest (__main__.MerkleTest) ... ok\ntest_unable_to_build_from_empty_collection (__main__.MerkleTest) ... expected failure\n```\n### Module\nMI1: Module 3: E1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbethanyuo%2Fmerkle-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbethanyuo%2Fmerkle-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbethanyuo%2Fmerkle-tree/lists"}