Go to file
2022-03-14 18:01:12 +10:00
.github/workflows build failure notification 2020-08-19 11:35:14 +03:00
src code duplication reduced 2022-03-13 15:28:37 +10:00
test implementing getTreeSlices types 2022-03-13 14:45:13 +10:00
.editorconfig initial 2020-07-31 06:15:29 +03:00
.eslintrc initial typescript edit 2022-02-22 18:45:31 +10:00
.gitignore add proof leaf method 2022-03-02 13:22:54 +10:00
.nvmrc add test coverage. more tests 2022-03-01 11:16:52 +10:00
.prettierrc fix trailingComma 2021-07-06 13:51:06 +03:00
package-lock.json update tsconfig.json 2022-03-14 18:01:12 +10:00
package.json update package.json 2022-03-14 17:21:38 +10:00
README.md build failure notification 2020-08-19 11:35:14 +03:00
tsconfig.json update tsconfig.json 2022-03-14 18:01:12 +10:00

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'
  ]
}