• Stars
    star
    146
  • Rank 252,769 (Top 5 %)
  • Language
    Go
  • License
    MIT License
  • Created over 6 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Practical implementation of the Honey Badger Byzantine Fault Tolerance consensus algorithm written in Go.

hbbft Releases Build Status Report Card

Practical implementation of the Honey Badger Byzantine Fault Tolerance consensus algorithm written in Go.

Summary

This package includes the building blocks for implementing a practical version of the hbbft protocol. The exposed engine can be plugged easily into existing applications. Users can choose to use the transport layer or roll their own. For implementation details take a look at the simulations which implements hbbft into a realistic scenario. The building blocks of hbbft exist out of the following sub-protocols:

Reliable broadcast (RBC)

Uses reedsolomon erasure encoding to disseminate an ecrypted set of transactions.

Binary Byzantine Agreement (BBA)

Uses a common coin to agree that a majority of the participants have a consensus that RBC has completed.

Asynchronous Common Subset (ACS)

Combines RBC and BBA to agree on a set of encrypted transactions.

HoneyBadger

Top level HoneyBadger protocol that implements all the above sub(protocols) into a complete --production grade-- practical consensus engine.

Usage

Install dependencies

make deps

Run tests

make test

How to plug hbbft in to your existing setup

Create a new instance of HoneyBadger.

// Create a Config struct with your prefered settings.
cfg := hbbft.Config{
    // The number of nodes in the network.
    N: 4,
    // Identifier of this node.
    ID: 101,
    // Identifiers of the participating nodes.
    Nodes: uint64{67, 1, 99, 101},
    // The prefered batch size. If BatchSize is empty, an ideal batch size will
    // be choosen for you.
    BatchSize: 100,
}

// Create a new instance of the HoneyBadger engine and pass in the config.
hb := hbbft.NewHoneyBadger(cfg)

Filling the engine with transactions. Hbbft uses an interface to make it compatible with all types of transactions, the only contract a transaction have to fullfill is the Hash() []byte method.

// Transaction is an interface that abstract the underlying data of the actual
// transaction. This allows package hbbft to be easily adopted by other
// applications.
type Transaction interface {
  Hash() []byte
}

Adding new transactions can be done be calling the following method on the hb instance.
hb.AddTransaction(tx) // can be called in routines without any problem.

Starting the engine.

hb.Start() // will start proposing batches of transactions in the network.

Applications build on top of hbbft can decide when they access commited transactions. Once consumed the output will be reset.

hb.Outputs() // returns a map of commited transactions per epoch.

for epoch, tx := range hb.Outputs() {
  fmt.Printf("batch for epoch %d: %v\n", epoch, tx)
}

A working implementation can be found in the bench folder, where hbbft is implemented over local transport.

Current project state

  • Reliable Broadcast Algorithm
  • Binary Byzantine Agreement
  • Asynchronous Common Subset
  • HoneyBadger top level protocol

TODO

  • Threshold encryption
  • Configurable serialization for transactions

References

Other language implementations

More Repositories

1

hollywood

Blazingly fast and light-weight Actor engine written in Golang
Go
1,174
star
2

superkit

Go
925
star
3

raptor

Create, Deploy, and Run your applications on the edge
Go
219
star
4

ml-email-clustering

Email clustering with machine learning
Python
169
star
5

distributedfilesystemgo

distributedfilesystemgo
Go
149
star
6

gothstarter

Golang, Templ, HTMX, and Tailwind started pack
CSS
134
star
7

gobank

A complete JSON API project in Golang where we are building a bank API
Go
121
star
8

slick

Go
121
star
9

projectx

A community driven modular blockchain created from scratch
Go
86
star
10

.nvim

My Neovim configuration in one single file
Lua
82
star
11

ggpoker

A decentralized poker game engine written in Golang and Solidity
Go
68
star
12

crypto-exchange

Build a crypto-exchange from scratch series
Go
63
star
13

vscode-config

My vscode configuration
55
star
14

boredstack

A programming for the no-bullshit builder
CSS
48
star
15

golangmicro

A microservice written in Golang with gRPC and JSON transport
Go
40
star
16

ggcommerce

ECommerce platform backend in Golang
Go
37
star
17

gameserver

A multiplayer game server written with Golang actors thanks to the Hollywood framework
Go
35
star
18

avalanche

A educational / research implementation of the Avalanche consensus algorithm written in Rust
Rust
34
star
19

ggcache

FAST AF F
Go
34
star
20

rust-trading-engine

A trading (matching) engine implementation in Rust.
Rust
28
star
21

goredisclone

Go
27
star
22

hopper

The real time database for modern applications
Go
26
star
23

gstream

A message queue for everything
Go
20
star
24

godistricas

A content addressable storage, but decentralized.
Go
18
star
25

tasker

A package that handles the boilerplate involving running functions in goroutines idiomatically
Go
15
star
26

go-price-fetcher

A micro service witten in Golang that fetches the price of crypto coins
Go
15
star
27

consenter

A pluggable blockchain consensus simulation framework written in Go.
Go
14
star
28

catfacter

A simple JSON API that can fetch cat facts 🀷
Go
14
star
29

go-webkit

Go
14
star
30

termdicator

A custom made crypto orderbook indicator displaying in your terminal
Go
13
star
31

disruptor

Go
12
star
32

ssltrackeroe

CSS
11
star
33

tcpc

Golang channels over TCP
Go
8
star
34

distriscrappy

Go
8
star
35

dreampicai

CSS
7
star
36

neo-go

Node and SDK for the NEO blockchain written in Go
Go
6
star
37

.vim

My Vim setup and configuration under version control.
Vim Script
6
star
38

jscollect

A tool that collects all Javascript files from a certain domain
Go
6
star
39

flow

etcd backed service discovery with build in loadbalancer for scalable service oriented applications
Go
5
star
40

gothkit-auth-plugin

Full decked out authentication for Gothkit
CSS
5
star
41

tlchallence

Go
4
star
42

reinforcement-curve-fever

Using reinforcement learning to play curve fever through a DQN with Tensorflow
Python
4
star
43

jinx-proxy

Multi reverse proxy written in Go
Go
3
star
44

anthdm.github.io

The NDA club podcast website
HTML
3
star
45

fullstack-web3-dex

A complete DEX written in Solidity with a Nextjs + tailwind frontend
JavaScript
3
star
46

nvim

Lua
3
star
47

DEX

A Decentralized exchange written in Solidity
JavaScript
2
star
48

biny

A highly-available distributed lexicografical key-value store build for scale
Go
2
star
49

nginx-php

Run php environment in a docker container with nginx as webserver
Shell
1
star
50

dontgetscammed

The official dontgetscammed application
TypeScript
1
star
51

weavebox-docker-example

Example application running a weavebox app in a docker container, ready for deployment on a CoreOS machine
Go
1
star
52

neo-rs

NEO 3.0 implementation in the Rust language
Rust
1
star
53

docker-silex

docker container for running silex apps backed by nginx and php-fpm
Shell
1
star
54

alien-invasion

A brutal alien invading simulator.
Go
1
star
55

gonzo

Dropon's API server
Go
1
star
56

es-proxy

Go
1
star
57

go-bpost

Package client to communicate with BPOST web services
Go
1
star
58

dynamic-dag-sharding

Let met think some more about a good description.
Go
1
star
59

testapp

yeah. I know....
Go
1
star