Skip to content
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Rename Estimate to Estimator, mk_estimate to estimate Jul 10, 2019
src Refactor Weights::{senders, weight} to surface lock error to user Jul 18, 2019
visualization @ 30bd856 updated viz Feb 21, 2019
.gitignore added .log ignore Jan 29, 2019
.gitlab-ci.yml Update Rust version in CI Jun 25, 2019
rust-toolchain Force Rust stable channel Jun 25, 2019

pipeline status License: AGPL v3

CBC Casper Abstract Message Library

DISCLAIMER: This library is experimental, under development, not reviewed, and might change dramatically.

The purpose of this library is to abstractly define the CBC Casper, as defined in Introducing the "minimal" CBC Casper Consensus Protocols, message stucture and define functions for the construction and proper execution of protocols of the casper family. We aimed at pushing as much functionality as possible directly to the abstract message layer, in such a way that a developer can create a protocol fairly easy using this library.

The design decision is to be as general as possible, and leave all specifics for the implementer of the protocol. For the time being, we aim at mathematical correctness and mostly purely functional protocol executions, rather than on performance. The idea is to have a mathematically correct and possibly inefficient implementations of functions that can be used as ground truth for comparing with efficient implementations.

Using the library

To benefit from the CBC Casper safety proofs this library builds upon, developers have to implement message::Trait. This trait in turn requires implementing other traits in this library, such as the sender::Trait trait for validators, and the Estimator trait for the estimate.

One generic type implements the message::Trait, namely message::Message<Estimator, sender::Trait>, and can be used to helps getting to a compliant message::Trait concrete type implementation easily.

We also present a basic blockchain implementation heavily under developement. You can also find another implementation of an integer consensus in tests/.

But in order to get started using the library, the best way is to study the examples folder (under development). It is also instructive to run the tests.


The library is not yet published on but you can use it in your dependencies with

casper = { git = "" }


We present an example of naive consensus protocol: a ternary consensus that uses the generic type message::Message<Estimator, sender::Trait> implementation to generate the protocol.

Known limitations


As mentioned earlier, our current focus is on the correctness of the implementation rather than on performance.


We use the crate proptest to generate properties tests. The library has a feature integration_test used by the proptest framework. To run specifically the proptest tests use:

cargo test --test generative_tests --features "integration_test"

To run the other tests simply use cargo test.


At this point the development of this library is only internal. If you want to contribute please contact one of the authors of the library (see Cargo.toml).

Code Format

We use rustfmt default configuration to ensure a coherent code format in the entire project. Install rustfmt with rustup component add rustfmt.

You can’t perform that action at this time.