Skip to content

p-offtermatt/malachite

 
 

Repository files navigation

Malachite

Flexible BFT Consensus Engine in Rust
State-of-the-art implementation of Tendermint


Build Status Quint tests MBT tests Code coverage

Apache 2.0 Licensed Rust Stable Rust 1.82+ Quint 0.22

Telegram Chat

About

Malachite is a Byzantine-fault tolerant (BFT) consensus engine implemented in Rust.

Important

Malachite is pre-alpha software and still under heavy development. At this stage, it is not meant for use in production. The software is provided "as is" and has not been externally audited; use at your own risk.

Goals

The goal is for Malachite to enable developers to decentralize whatever the future may bring—sequencers, social networks, Layer 1s, etc. Therefore, Malachite addresses a particular void in the market: The lack of flexible, reliable, and high-performance distributed systems foundations, such as BFT consensus libraries.

Features

Tendermint as a Library

Bundled with Malachite comes a state-of-the-art implementation of the Tendermint BFT consensus algorithm. Tendermint is an optimistically responsive consensus algorithm, and therefore exhibits high-performance, and has found adoption in many decentralized systems through its implementation in Go as part of CometBFT.

Design

Key design decisions in Malachite are heavily inspired by lessons and experiences of maintaining CometBFT throughout the years. Malachite addresses numerous points of technical debt in the design of consensus engines, resulting in a lean, flexible, and reliable solution that performs at the highest level.

Reliability and Performance

Parts of Malachite were co-designed with their formal specification and model checking, notably for the Tendermint algorithm, which improved the confidence and reliability of this core library.

Early experiments with Malachite show an average finalization latency of 780 ms at a scale of 100 validators with 1MB blocks. Depending on the setup, Malachite can clear up to 2.5 blocks per second or finalize up to 13.5 MB/s (around 50,000 transactions per second).

Use-cases

Malachite originated as a consensus core for the Starknet L2 decentralized sequencer. It will serve as the core consensus library in the Madara and Pathfinder Starknet clients. Malachite is also being used for Farcaster’s newest backend layer called Snapchain. Thanks to its flexible design, Malachite is amenable to a broad range of environments, and a number of other teams are building and exploring in private. Please reach-out if interested, we would love to speak with more teams.

Overview

Repository

The repository is split in three areas, each covering one of the important areas of this project:

  1. code: Comprises the Rust implementation of the Tendermint consensus algorithm, split across multiple Rust crates.
  2. docs: Comprises Architectural Decision Records (ADRs) and other documentation, such as the 2018 paper describing the core consensus algorithm.
  3. specs: English and Quint specifications.

Crates and Status

Note

The actual name of each crate is prefixed with informalsystems-malachitebft-. For instance, the crate denoted by core-consensus below can be found on crates.io as informalsystems-malachite-core-consensus.

Core consensus algorithm

Crate name Crate Docs
core-consensus core-consensus core-consensus Docs
core-driver core-driver core-driver Docs
core-state-machine core-state-machine core-state-machine Docs
core-types core-types core-types Docs
core-votekeeper core-votekeeper core-votekeeper Docs

Consensus engine

Crate name Crate Docs
app-channel app-channel app-channel Docs
app app app Docs
codec codec codec Docs
config config config Docs
discovery discovery discovery Docs
engine engine engine Docs
metrics metrics metrics Docs
network network network Docs
peer peer peer Docs
proto proto proto Docs
sync sync sync Docs
wal wal wal Docs

Building with Malachite

As a guiding point to understand how to use Malachite, please read ARCHITECTURE.md.

You can also check out the examples for a more in-depth experience.

Contributing

If you would like to contribute to the Malachite open-source codebase, please see CONTRIBUTING.md. We invite all contributors.

Requirements

Join Us

Malachite is developed by Informal Systems.

If you'd like to work full-time on challenging problems of distributed systems and decentralization, we're always looking for talented people to join!

License

Copyright © 2024 Informal Systems Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use the files in this repository except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Flexible BFT consensus engine in Rust

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 77.9%
  • Bluespec 19.7%
  • HCL 1.3%
  • Other 1.1%