merkle

package module
v0.0.0-...-bfc91e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2017 License: MPL-2.0 Imports: 3 Imported by: 0

README

Codeship Status for RichardKnop/merkle

GoDoc Travis Status for RichardKnop/merkle Donate Bitcoin

merkle

A Golang implementation of a Merkle tree.

Run tests:

go test ./...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Parent, Left, Right *Node
	// contains filtered or unexported fields
}

Node is a basic unit of a tree

func BuildTree

func BuildTree(theNodes ...*Node) *Node

BuildTree builds a tree from leaf nodes and returns a root node

func NewLeafNode

func NewLeafNode(b []byte) (*Node, error)

NewLeafNode returns a new node from a data block using the provided crypto.Hash, and calculates the block's checksum

func (Node) Checksum

func (n Node) Checksum() ([]byte, error)

Checksum returns the checksum of a data block if it is a leaf node, or the concatenated checksum of this node's children

func (Node) IsLeaf

func (n Node) IsLeaf() bool

IsLeaf returns true if this is a leaf node (has no children)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL