Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 579 Bytes

README.md

File metadata and controls

33 lines (24 loc) · 579 Bytes

node-merk

Node.js bindings for Merk

Usage

npm install merk

let merk = require('merk')

// create or load store
let db = merk('./state.db')

// get value
let value = db.getSync(Buffer.from('mykey'))

// get Merkle root
let hash = db.rootHash()

// create merkle proof
let proof = db.proveSync([
  Buffer.from('key1'),
  Buffer.from('key2')
])

// modify values
db.batch()
  .put(Buffer.from('key1'), Buffer.from('value1'))
  .put(Buffer.from('key2'), Buffer.from('value2'))
  .delete(Buffer.from('key3'))
  .commitSync()