{"id":20766999,"url":"https://github.com/binded/merkletree","last_synced_at":"2025-05-11T08:34:08.152Z","repository":{"id":57294888,"uuid":"57355557","full_name":"binded/merkletree","owner":"binded","description":"Merkle tree data structure in pure Javascript","archived":false,"fork":false,"pushed_at":"2016-06-16T04:43:34.000Z","size":200,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-02T18:49:41.390Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://blockai.github.io/merkletree/","language":"JavaScript","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/binded.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}},"created_at":"2016-04-29T04:54:22.000Z","updated_at":"2018-08-02T16:59:29.000Z","dependencies_parsed_at":"2022-08-29T09:50:42.472Z","dependency_job_id":null,"html_url":"https://github.com/binded/merkletree","commit_stats":null,"previous_names":["blockai/merkletree"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binded%2Fmerkletree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binded%2Fmerkletree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binded%2Fmerkletree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binded%2Fmerkletree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binded","download_url":"https://codeload.github.com/binded/merkletree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225030735,"owners_count":17409940,"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":[],"created_at":"2024-11-17T11:27:11.130Z","updated_at":"2024-11-17T11:27:12.695Z","avatar_url":"https://github.com/binded.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# merlketree\n\n[![Build Status](https://travis-ci.org/blockai/merkletree.svg?branch=master)](https://travis-ci.org/blockai/merkletree)\n\nMerkle tree data structure in pure Javascript. Always builds complete\nbinary trees.\n\nThe proofs are compatible with the\n[chainpoint proof format](https://github.com/chainpoint/whitepaper/raw/master/chainpoint_white_paper.pdf).\n\n\u003ca href=\"https://blockai.github.io/merkletree/\"\u003eBrowser demo\u003c/a\u003e\n\n## Install\n\n```\nnpm install --save merkletree\n```\n\n## Usage\n\n```javascript\nimport merkletree, { verifyProof } from 'merkletree'\n\n/* with require:\nconst mtree = require('merkletree')\nconst merkletree = mtree.default\nconst verifyProof = mtree.verifyProof\n*/\n\nconst leaves = [\n  'e1566f09e0deea437826514431be6e4bdb4fe10aa54d75aecf0b4cdc1bc4320c',\n  '2f7f9092b2d6c5c17cfe2bcf33fc38a41f2e4d4485b198c2b1074bba067e7168',\n  'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',\n  'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',\n]\nconst tree = merkletree(leaves)\nconsole.log(tree.root())\n/*\n6a9a3c86d47f1fe12648c86368ecd9723ff12e3fc34f6ae219d4d9d3e0d60667\n*/\nconst proof = tree.proof('2f7f9092b2d6c5c17cfe2bcf33fc38a41f2e4d4485b198c2b1074bba067e7168')\nconsole.log(proof)\n\n/*\n[\n  {\n    left: 'e1566f09e0deea437826514431be6e4bdb4fe10aa54d75aecf0b4cdc1bc4320c',\n    parent: '0fdd6b6895e15115c262f6acb9a6ae0c73248568b740454ab21591f8a533dd7f',\n    right: '2f7f9092b2d6c5c17cfe2bcf33fc38a41f2e4d4485b198c2b1074bba067e7168',\n  },\n  {\n    left: '0fdd6b6895e15115c262f6acb9a6ae0c73248568b740454ab21591f8a533dd7f',\n    parent: '6a9a3c86d47f1fe12648c86368ecd9723ff12e3fc34f6ae219d4d9d3e0d60667',\n    right: '3b7546ed79e3e5a7907381b093c5a182cbf364c5dd0443dfa956c8cca271cc33',\n  },\n])\n*/\nconst verified = verifyProof(\n  '2f7f9092b2d6c5c17cfe2bcf33fc38a41f2e4d4485b198c2b1074bba067e7168', // leaf\n  '6a9a3c86d47f1fe12648c86368ecd9723ff12e3fc34f6ae219d4d9d3e0d60667', // expected merkle root\n  proof\n)\nconsole.log(verified)\n/*\ntrue\n*/\n```\n\n## TOTO\n\n- memoize hash() calls in tree to speed up branch/root computation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinded%2Fmerkletree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinded%2Fmerkletree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinded%2Fmerkletree/lists"}