Git Product home page Git Product logo

merkle-proof-tool's Introduction

Merkle tree and leaf verifier

Summary

This is a terminal/bash tool written in TypeScript that verifies that a merkle tree is intact and that it contains a specified leaf.

Prerequsites

You must have nodeJS and npm installed on your computer for this tool to work.

https://nodejs.org/en/download/

https://docs.npmjs.com/downloading-and-installing-node-js-and-npm

How to install

git clone https://github.com/cakedefi/merkle-proof-tool.git
cd merkle-proof-tool
npm install
npm run build

How to run

Using npm

npm run verify -- --tree=<path/treeFileName.json> --hash=<yourHash> --verbose

Example:

npm run verify -- --tree=merkleTree.json --hash=09e052471f2e9e7f4cda07975bbd4b41d8bdcf6c --verbose

Using the nodeJS runtime directly

node build/verify.js --tree=<path/treeFileName.json> --hash=<yourHashID> --verbose

(please note that you must add the -- parameter only if using npm but not when using nodeJS)

parameters

--tree=<path/treeFileName.json> (mandatory) - is used for specifying the path and filename to the merkle tree JSON file.

--hash=<yourHashID> (mandatory) - This is the hash ID for the assets/leaf that you want to verify in the tree.

--verbose (optional) - This parameter will make the verifier output the merkle tree root and the leaf as JSON objects in the console.

How to develop

Feel free to put up a PR to contribute and make improvements to this tool.

npm run build Will transpile all the .ts files into .js and put the result in the ./build folder.

npm test Will run all the tests and output a code coverage report in the console and in the ./coverage folder.

merkle-proof-tool's People

Contributors

roger-cake avatar uzyn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.