Code Monkey home page Code Monkey logo

fixed-merkle-tree's Introduction

Merkle Tree GitHub Workflow Status npm

This is a fixed depth merkle tree implementation with sequential inserts

Usage

const MerkleTree = require('MerkleTree')
const tree = new MerkleTree(10, [1, 2, 3, 4, 5])
tree.insert(6)
tree.update(3, 42)
const path = tree.path(tree.indexOf(2))
console.log(path)

// output:
{
  pathIndex: [0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
  pathElements: [
    '42',
    '19814528709687996974327303300007262407299502847885145507292406548098437687919',
    '11545490348087423460235196042660837039811055736960842865648632633825765931887',
    '14506027710748750947258687001455876266559341618222612722926156490737302846427',
    '4766583705360062980279572762279781527342845808161105063909171241304075622345',
    '16640205414190175414380077665118269450294358858897019640557533278896634808665',
    '13024477302430254842915163302704885770955784224100349847438808884122720088412',
    '11345696205391376769769683860277269518617256738724086786512014734609753488820',
    '17235543131546745471991808272245772046758360534180976603221801364506032471936',
    '155962837046691114236524362966874066300454611955781275944230309195800494087'
  ]
}

fixed-merkle-tree's People

Contributors

meold avatar

Watchers

 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.