This package offers a Merkle tree implementation which is meant to work with the Semaphore zero-knowledge signalling system.
npm i semaphore-merkle-tree
import { storage, hashers, tree } from 'semaphore-merkle-tree'
const storage = new storage.MemStorage()
const hasher = new hashers.MimcSpongeHasher();
const prefix = 'semaphore';
const default_value = '0';
const depth = 2
const tree = new tree.MerkleTree(
prefix,
storage,
hasher,
depth,
default_value,
)
Adds value
to the leaf at index
Returns the Merkle path to the leaf at the specified index
Rolls back the tree by the specified number of updates
git clone https://github.com/weijiekoh/semaphore-merkle-tree.git && \
cd semaphore-merkle-tree && \
npm i && \
npm run build
npm run test