Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

miguelmota/merkletree-viz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

merkletree-viz

Merke tree visualization library for browser, works with merkletreejs.

Example

https://lab.miguelmota.com/merkletree-viz

CDN

Available on jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/merkletree-viz@latest/merkletreeviz.js"></script>

Usage

Import js libs for hash function, merkletreejs, and merkletree-viz

<script src="https://cdn.jsdelivr.net/npm/keccak256@latest/keccak256.js"></script>
<script src="https://cdn.jsdelivr.net/npm/merkletreejs@latest/merkletree.js"></script>
<script src="https://cdn.jsdelivr.net/npm/merkletree-viz@latest/merkletreeviz.js"></script>

Generate merkle tree and render visualization

const leaves = ['a', 'b', 'c', 'd'].map(keccak256)
const tree = new MerkleTree(leaves, keccak256)
const viz = new MerkleTreeViz('#viz')
viz.renderTree(tree)
// viz.destroy()

viz

License

MIT