Code Monkey home page Code Monkey logo

merkletreejs-cli's Introduction

merkletreejs-cli

CLI for merkletreejs

License NPM version

Install

npm install -g merkletreejs-cli

Usage

$ merkletreejs --help
  CLI for merkletreejs library

    Usage
  $ merkletreejs [options]

    Options
      -h, --hash Hash function to use. Options are "sha256" (default), "keccak256".
      -l, --leaves JSON file containing array of leaves. Use "-" to read from stdin.
      --hash-leaves Hash leaves
      --sort Sort leaves and pairs
      --sort-leaves Sort leaves
      --sort-pairs Sort pairs when hashing nodes
      --duplicate-odd Duplicate odd nodes
      --fill-default-hash Fill default hash value
      -o --output Result to output. Options are "root", "leaves", "layers", "layers-flat", "tree" (default)

    Examples
      $ cat leaves.json | merkletreejs --leaves=- --hash=keccak256 --output=root

Getting started

$ echo '["a", "b", "c"]' > leaves.json
$ merkletreejs --leaves=leaves.json --hash=sha256 --hash-leaves --output=root
0x7075152d03a5cd92104887b476862778ec0c87be5c2fa1c0a90f87c49fad6eff

$ cat leaves.json | merkletreejs --leaves=- --hash=sha256 --hash-leaves --output=layers
[
  [
    "0xca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb",
    "0x3e23e8160039594a33894f6564e1b1348bbd7a0088d42c4acb73eeaed59c009d",
    "0x2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6"
  ],
  [
    "0xe5a01fee14e0ed5c48714f22180f25ad8365b53f9779f79dc4a3d7e93963f94a",
    "0x2e7d2c03a9507ae265ecf5b5356885a53393a2029d241394997265a1a25aefc6"
  ],
  [
    "0x7075152d03a5cd92104887b476862778ec0c87be5c2fa1c0a90f87c49fad6eff"
  ]
]

License

MIT

merkletreejs-cli's People

Contributors

miguelmota avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.