Skip to content

NeoResearch/libbft

Repository files navigation

libbft

Current TravisCI build status. Current neo version. Coverage Status Current total lines. License.

A lightweight and multi-language library collection for byzantine fault tolerance

Byzantine Fault Tolerance (BFT) is the core mechanism for building attack-resistant and self-adaptive systems. It is a widespread concept since the proposal of a Practical BFT (by Miguel Castro and Barbara Liskov), with multiple implementations nowadays (such as dBFT on Neo Blockchain). This project intends to allow easy implementation of BFT protocols on C++ and multiple languages (portability for cross-language is fundamental!).

It is intended to be also used as the official dBFT for neopt, a C++ implementation of Neo Blockchain components, focused on portability. It may also help the development of other ecosystem tools, protocols, and even develop other blockchain and fail-safe storage technologies.

Build Instructions

Currently, C++ spec is the reference one. After that, focus will be on Go, Python and C# ports.

For stability, try with VSCode and DevContainers Extension (see .devcontainers and Dockerfile).

Bazel is the first try (for C++)

If using DevContainers, you already have Bazel (otherwise, it's quite simple to install it). Just type make.

CMake is the second official one (for C++)

Currently, CMake is likely broken, due to advances in grpc/protobuf projects. We will try to fix it as soon as possible.

If using DevContainers, some working grpc version is already available (just need to fix CMakeLists.txt). Remember to: ln -s /opt/bin/grpc_cpp_plugin /usr/local/bin/grpc_cpp_plugin

Old instructions

cmake is your friend! Please install latest version (you can use Snappy to ensure that!):

sudo snap install cmake --classic

Image on DevContainer already manually a supported cmake version (installed on /opt together with grpc)

Builds for C++

Existing frameworks use high-level languages that may not be suitable for very lightweight architectures, such as microcontrollers with very limited computing capabilities.

C/C++ is interoperable with nearly all existing languages, so the idea is to provide modules that can be reused on other projects (on other languages too).

On debian-based systems (or ubuntu), just type:

make cpp && ./spec/cpp/build/app_test

Getting submodules: git submodule update --init --recursive and git pull --recurse-submodules.

Installing graphviz: sudo apt install graphviz

tests for C++

It will also configure test library (as long as you cloned this project with --submodules too). To test, just run make test.

Note: tests are still under development.

C++ Standard

Currently, C++11 is adopted, in order to keep the best compatibility between conversors and compilers. However, it is recommended to migrate to C++17 as soon as possible, if this does not break compatibility with any existing modules and tools.

Let's please follow the CppCoreGuidelines.

vscode IDE

If using vscode IDE, it is recommended to install the following extensions:

  • C/C++ (currently 0.23.0-insiders2)
  • C++ Intellisense (currently 0.2.2)
  • GoogleTest Adapter (currently 1.8.3)

C++ Format Style

The currently adopted style for C++ is Mozilla, with indentation level set to 3. Recommended configuration for vscode:

{
    "[cpp]": {
        "editor.tabSize" : 3,
        "editor.detectIndentation": false
    },
    "C_Cpp.clang_format_fallbackStyle": "{ BasedOnStyle : Mozilla , ColumnLimit : 0, IndentWidth: 3, AccessModifierOffset: -3}"
}

Variable Naming Style

Let's please follow the CppCoreGuidelines, and as usual, classic CamelCase C++ naming is welcome :)

Builds for Go

Still under development.

Builds for C#

Still under development.

Builds for Python

Still under development.

Citation

Cite this in your paper as:

@article{libbft2019,
    author = {Rodolfo Pereira Araujo and Igor Coelho and Luiz Satoru Ochi and Vitor Nazario Coelho},
    year = {2019},
    month = {10},
    title = "LibBFT: A High-Performace Timed Automata Library Collection for Byzantine Fault Tolerance",
    doi = "10.1109/SBAC-PAD.2019.00045",
    isbn = "978-1-7281-4194-7",
    issn = "2643-3001",
    publisher = "IEEE",
    series = "2019 31st International Symposium on Computer Architecture and High Performance Computing (SBAC-PAD)"
}

License

Code follows MIT License.