Skip to content

Golang merkle tree implementation based on RFC-6962 standard

License

Notifications You must be signed in to change notification settings

arturalbov/gomerkle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gomerkle

version Coverage Status Go Report Card LoC license contributors contribute telegram

Golang merkle tree implementation based on RFC-6962 standard.

import "github.com/arturalbov/gomerkle"

Usage

package main

import (
	"crypto/sha256"
	"fmt"
	"github.com/arturalbov/gomerkle/merkle"
)

func main() {
	tree := merkle.NewTree(sha256.New())

	data := [][]byte{
		[]byte("Audrey Garza"),
		[]byte("Jan Neal"),
		[]byte("Kelly Taylor"),
		[]byte("Henrietta Oliver"),
		[]byte("Rebecca Stewart"),
		[]byte("Johnny Ross"),
		[]byte("Mark Reese"),
		[]byte("Holly Robertson"),
		[]byte("Jaime Davidson"),
		[]byte("Leo Montgomery"),
	}

	tree.BuildNewWithData(data)

	tree.Push([]byte("Karen Rice"))
	tree.Push([]byte("Van Briggs"))
	tree.Push([]byte("Eunice Greene"))

	proofs := tree.GetIndexProofs(2)

	fmt.Println(tree.ValidateIndexByProofs(2, data[2], proofs))
}

Issues

If you have any problems with or questions about this package, please contact us through a GitHub issue.

Contributing

You are invited to contribute new features, fixes, or updates, large or small; I am always thrilled to receive pull requests, and do my best to process them as fast as I can.

About

Golang merkle tree implementation based on RFC-6962 standard

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages