libbft: a cross-language library for Byzantine Fault Tolerance

Igor Machado
NeoResearch
Published in
2 min readJul 26, 2019

Implementing a secure and attack-resistant consensus mechanism is a fundamental task for decentralized systems such as a blockchain. Neo Blockchain was born with a novel and efficient consensus mechanism, named dBFT (for Delegated Byzantine Fault Tolerance), and it is first of the kind to guarantee block finality in a very short time (average 15 seconds). The dBFT runs over a fully decentralized peer-to-peer network, where delegated consensus nodes (through voting using Neo assets) must decide over which transactions are to be put on a block, with an agreement of at least 2/3 (this guarantees that faulty/byzantine nodes cannot take over the network). This was inspired by PBFT algorithm (Practical BFT) by Miguel Castro and Barbara Liskov.

Creating such a strategy (that actually work on a real global p2p network) is an amazing achievement. This was authored by Erik Zhang, from Neo Foundation, and it is freely available at the github project of neo-project (see https://github.com/neo-project/neo, at “Consensus” folder). Understanding it is still challenging, so as testing and replicating it. On 2018, NeoResearch proposed tools for easily visualizing consensus messages (see https://github.com/neoresearch/consensus-draw) and the latest advance now is towards a lightweight and cross-language implementation for BFT state machines: the libbft.

The libbft is intended to work as simple and integrated set of state machines, which is easy to test and validate (also easier to prove correctness). On July 2019, the advances made it possible for NeoResearch to pre-release a first development version (see https://github.com/neoresearch/libbft). This is both an academic task and also aligned to NeoResearch plan for 2019 partnership with Neo Foundation, with focus on Advanced Consensus Strategies. By using libbft, it’s possible to simulate dBFT and possibly many other strategies, that could be demonstrated to be more efficient than current Neo Blockchain consensus.

One interesting way of visualizing libbft, is the capability to model such systems in a very natural form: as a timed state machine. On a pre-release of the Community Yellow Paper dBFT chapter (now under development on Neo3 Specification repository), it can be seen what libbft model for dBFT will look like.

Fluxogram for dBFT on pre-released chapter of Community Yellow Paper (now under development on Neo3 Specification repository)

It is expected that libbft can also integrate with drawing systems (such as graphviz) to automatically generate such amazing graphs! Another interesting possibility is to port it to other languages, starting from C++ (perhaps Go, Python, and even C#). This way, other implementations of Neo Blockchain can benefit of easy-to-use consensus mechanisms, that may not be as efficient as current core implementation (which is very well tested and fine-tuned on practice over years of MainNet/TestNet), but it’s still a good start for new projects.

This is just a start (and a gentle introduction) for this nice project, and we hope to keep up such promising (and productive) directions.

--

--