Skip to content

olegfomenko/go-treap-merkle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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/go-treap-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

About

Proof of concept for dynamic Merkle tree

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages