GoMerkle: A merkle-tree implementation in Go

GoMerkle

A merkle-tree implementation in Go.

Motivation:

  • Learning Go
  • Merkle trees are great

Usage

package main

import (
	"fmt"
	"github.com/anishsujanani/gomerkle"
)

func main() {
	root := gomerkle.MerkleTree("abcdefghijklmnopqrstuvwxyz", 4); // content, leaf size
	fmt.Println(root)
	fmt.Println(root.GetLeftChild())
	fmt.Println(root.GetRightChild())
}

Output:

RawText:		abcdefghijklmnopqrstuvwxyz  
Hash:			71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73  
LeftChild.RawText:	abcdefghijklmnop  
RightChild.RawText	qrstuvwxyz  
  
RawText:		abcdefghijklmnop  
Hash:			f39dac6cbaba535e2c207cd0cd8f154974223c848f727f98b3564cea569b41cf  
LeftChild.RawText:	abcdefgh  
RightChild.RawText	ijklmnop  

RawText:		qrstuvwxyz  
Hash:			f20641c45ff3e440f7bbbf2a2fb1538808fb8e80f929c24096ddbcd280bc1e8d  
LeftChild.RawText:	qrstuvwx  
RightChild.RawText	yz  

API

// docs pending
Similar Resources

An implementation of standard generics APIs in Go.

generics This package shows an implementation outlook of proposed generics APIs import "changkun.de/x/generics" Related issues: golang/go#45458 golang

Dec 5, 2022

a quick golang implementation of google pubsub subscriber for testing with the emulator.

gosub a quick golang implementation of google pubsub subscriber for testing with the emulator. it does one thing which is subscribing to a topic and r

Oct 23, 2021

Go implementation Welford’s method for one-pass variance computation

Variance and standard deviation caluculation using variance's algorithm Table of Contents Introduction Installation Usage Contributing License Introdu

Jun 5, 2022

Go implementation of Donald Knuth's Algorithm 7.2.2.1C for exact cover with colors.

go-dlx Go implementation of Donald Knuth's Algorithm 7.2.2.1C for exact cover with colors. This code is based on the Algorithm C described in http://w

Dec 14, 2022

A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

SOMMIP Lab 1 Isac Arthur Table of Contents About The Project Getting Started Prerequisites Installation Supported commands About The Project This very

Nov 10, 2021

Implementation of the test task, chat in the goland language

Implementation of the test task, chat in the goland language

Implementation of the test task, chat in the goland language

Dec 5, 2021

Rule engine implementation in Golang

Rule engine implementation in Golang

Rule engine implementation in Golang

Dec 30, 2022

Refrence implementation of the globaldce protocol

globaldce-toolbox This is the reference implementation of globaldce protocole coded in the go programming language. This project is still experimental

Dec 14, 2022

The official golang implementation for Project Anatha.

Project Anatha The official golang implementation for Project Anatha. For instructions on setting up a validator on the Anatha network, view the guide

Nov 25, 2021
Shows your recent browser history in tree style. 树状展示浏览器历史 (For Edge / Chromium / Chrome)
Shows your recent browser history in tree style. 树状展示浏览器历史  (For Edge / Chromium / Chrome)

Tree Style Histyle This extension shows your recent browser history in tree style. When you browser pages from internet, you always jump from one page

Jan 3, 2023
Provides the radix package that implements a radix tree.

go-radix Provides the radix package that implements a radix tree. The package only provides a single Tree implementation, optimized for sparse nodes.

Oct 26, 2021
Tool for printing a directory tree and indicating the space it occupies.

Tool for printing a directory tree and indicating the space it occupies.

Nov 6, 2021
A versioned, snapshottable (immutable) AVL+ tree for persistent data.

IAVL+ Tree Note: Requires Go 1.13+ A versioned, snapshottable (immutable) AVL+ tree for persistent data. The purpose of this data structure is to prov

Nov 26, 2021
Swagger 2.0 implementation for go

Swagger 2.0 This package contains a golang implementation of Swagger 2.0 (aka OpenAPI 2.0): it knows how to serialize and deserialize swagger specific

Dec 30, 2022
Go implementation of the Rust `dbg` macro

godbg ?? godbg is an implementation of the Rust2018 builtin debugging macro dbg. The purpose of this package is to provide a better and more effective

Dec 14, 2022
Functional programming library for Go including a lazy list implementation and some of the most usual functions.

functional A functional programming library including a lazy list implementation and some of the most usual functions. import FP "github.com/tcard/fun

May 21, 2022
Go implementation of the XDG Base Directory Specification and XDG user directories

xdg Provides an implementation of the XDG Base Directory Specification. The specification defines a set of standard paths for storing application file

Dec 23, 2022
Simple Client Implementation of WebFinger

Go-Webfinger Go client for the Webfinger protocol Go-Webfinger is a Go client for the Webfinger protocol. *It is a work in progress, the API is not fr

Nov 18, 2022
An example client implementation written in GO to access the CyberVox platform API

About This is an example client implementation written in GO to access the CyberVox platform API.

Nov 7, 2022