/mirbft

MirBFT is a consensus library implementing the Mir consensus protocol.

Primary LanguageGoApache License 2.0Apache-2.0

MirBFT Library

This open-source project is part of Hyperledger Labs. It aims at developing a production-quality implementation of the Mir Byzantine fault tolerant consensus protocol and integrating it with Hyperledger Fabric. Being framed as a library, however, MirBFT's goal is also to serve as a general-purpose high-performance BFT component of other projects as well.

The research branch contains code developed independently as a research prototype and was used to produce experimental results for the research paper.

Current status

This library is in development and not usable yet. This document describes what the library should become rather than what it currently is. This document itself is more than likely to still change. You are more than welcome to contribute to accelerating the development of the MirBFT library. Have a look at the Contributions section if you want to help out!

Build Status GoDoc

Overview

MirBFT is a library implementing the Mir byzantine fault tolerant consensus protocol in a network transport, storage, and cryptographic algorithm agnostic way. MirBFT hopes to be a building block of a next generation of distributed systems, providing an implementation of atomic broadcast which can be utilized by any distributed system.

MirBFT improves on traditional atomic broadcast protocols like PBFT and Raft which always have a single active leader by allowing concurrent leaders and reconciling total order in a deterministic way.

The multi-leader nature of Mir should lead to exceptional performance especially on wide area networks, but should be suitable for LAN deployments as well.

MirBFT, decouples request payload dissemination from ordering, outputting totally ordered request digests rather than all request data. This allows for novel methods of request dissemination. The provided request dissemination method, however, does guarantee the availability of all request payload data.

Design

The high level structure of the MirBFT library is inspired by etcdraft. The protocol logic is implemented as a state machine that is mutated by short-lived, non-blocking operations. Operations which might block or which have any degree of computational complexity (like hashing, I/O, etc.) are delegated to the caller.

TODO: Link the "state machine" to the documentation of the state machine interface when it exists.

Additional components required to use the library are:

  1. A write-ahead-log (WAL) that the protocol uses for persisting its state. This is crucial for crash-recovery - a recovering node will use the entries in this log when re-initializing. External actions (like sending messages or interacting with the application) are always reflected in the WAL before they occur. This way a crash of a node and a subsequent recovery are completely transparent to the rest of the system, except a potential delay incurred by the recovery. The users of this library can use their own WAL implementation or use the library-provided one
  2. A request store for persisting application requests. This is a simple persistent key-value store where requests are indexed by their hashes. The users of this library can use their own request store implementation or use the library-provided one.
  3. A hashing implementation. Any hash implementation can be provided that satisfies Go's standard library interface, e.g., sha256.
  4. An application that will consume the agreed-upon requests and provide state snapshots on library request. Looking at MirBFT as a state machine replication (SMR) library, this application is the "state machine" in terms of SMR. It is not to be confused with the library-internal state machine that implements the protocol.
  5. A networking component that implements sending and receiving messages over the network. It is the networking component's task to establish physical connections to other nodes and abstract away addresses, ports, authentication, etc. The library relies on nodes being addressable by their numerical IDs and the messages received being authenticated. TODO: Provide a simple implementation and link it here.

TODO: Link the component names to the documentation of the respective interfaces when this documentation is ready.

For basic applications, the library-provided components should be sufficient. To increase performance, the user of the library may provide their own optimized implementations.

Using Mir

TODO: Refer to the sample application when it is integrated in this repository.

Contributing

Contributions are more than welcome!

If you want to contribute, have a look at our Contributor's guide and at the open issues. If you have any questions (specific or general), do not hesitate to post them on MirBFT's Rocket.Chat channel. You can also drop an email to the active maintainer(s).

Summary of References

Active maintainer(s)

Initial Committers

Sponsor

Angelo de Caro (adc@zurich.ibm.com).

License

The MirBFT library source code is made available under the Apache License, version 2.0 (Apache-2.0), located in the LICENSE file.