• Stars
    star
    356
  • Rank 119,432 (Top 3 %)
  • Language
    Rust
  • License
    Other
  • Created over 6 years ago
  • Updated 10 months ago

Reviews

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

Repository Details

An implementation of the paper "Honey Badger of BFT Protocols" in Rust. This is a modular library of consensus.

Honey Badger Byzantine Fault Tolerant (BFT) consensus algorithm

crates.io Documentation Build Status Gitter

Welcome to a Rust library of the Honey Badger Byzantine Fault Tolerant (BFT) consensus algorithm. The research and protocols for this algorithm are explained in detail in "The Honey Badger of BFT Protocols" by Miller et al., 2016.

An official security audit has been completed on hbbft by Jean-Philippe Aumasson.

Following is an overview of HoneyBadger BFT and basic instructions for getting started.

Note: This library is a work in progress and parts of the algorithm are still in development.

What is Honey Badger?

The Honey Badger consensus algorithm allows nodes in a distributed, potentially asynchronous environment to achieve agreement on transactions. The agreement process does not require a leader node, tolerates corrupted nodes, and makes progress in adverse network conditions. Example use cases are decentralized databases and blockchains.

Honey Badger is Byzantine Fault Tolerant. The protocol can reach consensus with a number of failed nodes f (including complete takeover by an attacker), as long as the total number N of nodes is greater than 3 * f.

Honey Badger is asynchronous. It does not make timing assumptions about message delivery. An adversary can control network scheduling and delay messages without impacting consensus.

How does it work?

Honey Badger is a modular library composed of several independent algorithms. To reach consensus, Honey Badger proceeds in epochs. In each epoch, participating nodes broadcast a set of encrypted data transactions to one another and agree on the contents of those transactions.

In an optimal networking environment, output includes data sent from each node. In an adverse environment, the output is an agreed upon subset of data. Either way, the resulting output contains a batch of transactions which is guaranteed to be consistent across all nodes.

In addition to validators, the algorithms support observers: These don't actively participate, and don't need to be trusted, but they receive the output as well, and are able to verify it under the assumption that more than two thirds of the validators are correct.

Please see the following posts for more details:

Algorithms

  • Honey Badger: Each node inputs transactions. The protocol outputs a sequence of batches of transactions.

  • Dynamic Honey Badger: A modified Honey Badger where nodes can dynamically add and remove other nodes to/from the network.

  • Queueing Honey Badger: Works exactly like Dynamic Honey Badger, but includes a built in transaction queue.

  • Subset: Each node inputs data. The nodes agree on a subset of suggested data.

  • Broadcast: A proposer node inputs data and every node receives this output.

  • Binary Agreement: Each node inputs a binary value. The nodes agree on a value that was input by at least one correct node.

  • Threshold Sign: Each node inputs the same data to be signed, and outputs the unique valid signature matching the public master key. It is used as a pseudorandom value in the Binary Agreement protocol.

  • Threshold Decryption: Each node inputs the same ciphertext, encrypted to the public master key, and outputs the decrypted data.

  • Synchronous Key Generation A dealerless algorithm that generates keys for threshold encryption and signing. Unlike the other algorithms, this one is completely synchronous and should run on top of Honey Badger (or another consensus algorithm)

External crates developed for this library

  • Threshold Crypto: A threshold cryptosystem for collaborative message decryption and signature creation.

Getting Started

This library requires a distributed network environment to function. Details on network requirements TBD.

Note: Additional examples are currently in progress.

Build

Requires Rust 1.36 or higher and cargo: installation instructions. The library is tested against the stable release channel.

$ cargo build [--release]

Testing

$ cargo test --release

See the tests README for more information on our testing toolkit.

Example Network Simulation

A basic example is included to run a network simulation.

$ cargo run --example simulation --release

Screenshot

Heading Definition
Epoch Epoch number. In each epoch, transactions are processed in a batch by simulated nodes (default is 10 nodes) on a network. The batch is always output in one piece, with all transactions at once.
Min Time Time in simulated milliseconds until the first correct (i.e. not faulty) node outputs the batch.
Max Time Time in simulated milliseconds until the last correct node outputs the batch.
Txs Number of transactions processed in the epoch.
Msgs/Node Average number of messages handled by a node. The counter is cumulative and includes the number of messages handled in the current epoch and all previous epochs.
Size/Node Average message size (in converted bytes) handled by a node. This is cumulative and includes message size for the current epoch and all previous epochs.

Options

Set different parameters to simulate different transaction and network conditions.

Flag Description
-h, --help Show help options
--version Show the version of hbbft
-n <n>, --nodes <n> The total number of nodes [default: 10]
-f <f>, --faulty <f> The number of faulty nodes [default: 0]
-t <txs>, --txs <txs> The number of transactions to process [default: 1000]
-b <b>, --batch <b> The batch size, i.e. txs per epoch [default: 100]
-l <lag>, --lag <lag> The network lag between sending and receiving [default: 100]
--bw <bw> The bandwidth, in kbit/s [default: 2000]
--cpu <cpu> The CPU speed, in percent of this machine's [default: 100]
--tx-size <size> The size of a transaction, in bytes [default: 10]

Examples:

# view options
$ cargo run --example simulation --release -- -h

# simulate a network with 12 nodes, 2 of which are faulty
$ cargo run --example simulation --release -- -n 12 -f 2

# increase batch size to 500 transactions per epoch
$ cargo run --example simulation --release -- -b 500

Protocol Modifications

Our implementation modifies the protocols described in "The Honey Badger of BFT Protocols" in several ways:

  • We use a pairing elliptic curve library to implement pairing-based cryptography using a Barrento-Lynn-Scott (BLS12-381) curve.
  • We add a Terminate message to the Binary Agreement algorithm. Termination occurs following output, preventing the algorithm from running (or staying in memory) indefinitely. (#53)
  • We add a Conf message to the Binary Agreement algorithm. An additional message phase prevents an attack if an adversary controls a network scheduler and a node. (#37)
  • We return additional information from the Subset and Honey Badger algorithms that specifies which node input which data. This allows for identification of potentially malicious nodes.
  • We include a Distributed Key Generation (DKG) protocol which does not require a trusted dealer; nodes collectively generate a secret key. This addresses the problem of single point of failure. See Distributed Key Generation in the Wild.

Algorithm naming conventions

We have simplified algorithm naming conventions from the original paper.

Algorithm Name Original Name
Honey Badger HoneyBadgerBFT
Subset Asynchronous Common Subset (ACS)
Broadcast Reliable Broadcast (RBC)
Binary Agreement Asynchronous Binary Byzantine Agreement (ABA)

References

Honey Badger Visualization

Screenshot

Contributing

See the CONTRIBUTING document for contribution, testing and pull request protocol.

License

Licensed under either of:

at your option.

More Repositories

1

token-wizard

(Discontinued) TokenWizard is an DApp to create and manage crowdsale and token contracts using a simple UI
JavaScript
384
star
2

solidity-flattener

Utility to combine Solidity project to a flat file
JavaScript
326
star
3

threshold_crypto

A pairing-based threshold cryptosystem for collaborative decryption and signatures used in HoneybadgerBFT implementation
Rust
185
star
4

vdf

An implementation of Verifiable Delay Functions in Rust
Rust
170
star
5

posdao-contracts

Smart contracts for POSDAO (Proof of Stake Decentralized Autonomous Organization consensus), a DPOS consensus implemented in Solidity and running within EVM with swappable BFT consensus
JavaScript
105
star
6

wiki

POA Library: wiki, how-to, FAQ. Includes instructions how to set-up a new network, to run a full node, connect wallets,
81
star
7

poa-network-consensus-contracts

Main repository for POADAO consensus. Includes contracts for Initial Ceremony, Governance, Management of Validators
JavaScript
67
star
8

ex_abi

The Ethereum ABI Interface
Elixir
60
star
9

poa-faucet

POA Network faucet
SCSS
57
star
10

proofofphone

KYC oracle to link your phone number and Ethereum wallet in Oracles network
JavaScript
48
star
11

blockscout-terraform

An automation framework for spinning up cloud infrastructure to run BlockScout
HCL
46
star
12

poa-chain-spec

Spec files, bootnodes, governance contracts addresses for POA Network instances: Core (live), Sokol (test), xDai
33
star
13

poa-dapps-voting

POA Network Governance Dapp
JavaScript
26
star
14

deployment-playbooks

Ansible playbooks for deployment POA Network nodes on EC2 or any Linux (Ubuntu 16.04) hosting. Includes master of ceremony, validator, bootnode, explorer, netstat roles
Shell
25
star
15

poa-popa

DApp for proof of physical address (PoPA) attestation for validators of POA Network
JavaScript
24
star
16

hydrabadger

A simple, experimental, peer-to-peer network node using the hbbft consensus algorithm which can be run as a standalone client or used as a library
Rust
22
star
17

poa-dapps-validators

DApp for a list of validators with metadata for POA Network (Core/Sokol). Validators can update metadata using DApp.
JavaScript
13
star
18

chain-explorer

Blockchain explorer
JavaScript
13
star
19

poa-netstats-agent

Netstat agent for EVM based networks
Elixir
11
star
20

poa-devops

POA Network DevOps scripts
Shell
11
star
21

website

website and documentation home of poanetwork.com
11
star
22

parity-bridge-research

Reasarch of https://github.com/paritytech/parity-bridge/
Solidity
9
star
23

poa-test-setup

Deployment of POA network in one click and e2e tests of Ceremony/Governance DApps
JavaScript
9
star
24

deployment-terraform

Ansible and Terraform deployment automation of POA clones
JavaScript
9
star
25

poa-dapps-keys-generation

POA Network keys generation Dapp
JavaScript
9
star
26

hex_fmt

Formatting and shortening byte slices as hexadecimal strings
Rust
8
star
27

poa-ballot-stats

Read POA voting records and rank voters by how many ballots they missed.
Rust
7
star
28

deployment-azure

Azure Templates for deploying POA Network to on Azure Cloud
7
star
29

cross-chain-deploy

JavaScript
6
star
30

eth-netstats

Netstats dashboard
JavaScript
6
star
31

howey-test-wizard

Howey test for blockchain tokens and crypto assets
JavaScript
5
star
32

hydrabadger-android

Mobile messenger based on hbbft consensus
JavaScript
4
star
33

poa-netstats-warehouse

Storage and data-processing companion for the poa-netstats-agent
Elixir
4
star
34

poamania-contracts

Smart contracts for POA Mania
JavaScript
4
star
35

poa-poba

DApp for proof of bank account (PoBA) attestation
JavaScript
3
star
36

poa-scripts-moc

Scripts for Master of Ceremony (MoC) to generate initial keys, distribute tokens, and misc.
JavaScript
3
star
37

eth-net-props

Get properties of EVM compatible networks
JavaScript
3
star
38

RFC

Technical write-ups that describe modifications to the Protocol, DApps, or any significant topic.
3
star
39

tokensale-right

Treasury and token contracts (right side of the bridge)
2
star
40

poa-scripts-validator

Script for validator
JavaScript
2
star
41

auto-updater-setup

How to setup parity auto-updater
2
star
42

ethgasstation-gasPrice-estimate

Python
2
star
43

poa-network-monitor

Scripts for POA network monitoring
JavaScript
2
star
44

poa-governance-notifications

A CLI tool for monitoring a blockchain for POA Network governance ballots.
Rust
2
star
45

e2e-test-token-wizard

A tool for end-to-end test the Token wizard. Based Selenium Webdriver.
JavaScript
2
star
46

e2e-blockscout

End to end tests for BlockScout https://github.com/poanetwork/blockscout
JavaScript
1
star
47

validator-node-dockerized

How to launch validator node with Docker Compose
Shell
1
star
48

poa-contract-metadata

A mapping of POA contract addresses to broadly accepted icons for those addresses.
JavaScript
1
star
49

poamania-subgraph

TypeScript
1
star
50

eth-net-intelligence-api

Netstats service
JavaScript
1
star
51

wallet

MyEtherWallet with POA Network support
JavaScript
1
star