Skip to content

Latest commit

 

History

History

dynamic-merkle

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Treap-based dynamic Merkle tree

License: MIT

Proof of concept for dynamic Merkle tree. Treap as primary data structure used to achieve logarithmic inserting/removing.

Usage

package main

import (
	"math/rand"
	
	merkle "github.com/olegfomenko/crypto/dynamic-merkle"
)

func main() {
	tree := merkle.New()
	
	// Insert
	tree.Insert([]byte("hash"), rand.Uint64())
	
	// Merkle path
	path := tree.MerklePath([]byte("hash"))
	
	// Merkle Root
	root := tree.MerkleRoot()

	// Remove
	tree.Remove([]byte("hash"))
}

Related docs

Treap description: "https://en.wikipedia.org/wiki/Treap"

Merkle tree description: "https://en.wikipedia.org/wiki/Merkle_tree"

Signing scheme