ethereum/cbc-casper

Name: cbc-casper

Owner: ethereum

Description: null

Created: 2017-02-22 17:20:11.0

Updated: 2018-05-18 18:13:13.0

Pushed: 2018-04-30 13:55:55.0

Homepage: null

Size: 771

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Casper CBC

Join the chat at https://gitter.im/cbc-casper/Lobby

Branch | Tests ———-|—— master | CircleCI develop | CircleCI

A python implementation of a class of “correct-by-construction” consensus protocols. Currently, this includes Casper the Friendly Ghost (a blockchain consensus protocol) and Casper the Friendly Binary Consensus Protocol.

Specifications for these protocols can be found here here, but the implementation and the spec may deviate from the spec, as they are still moving targets.

Warning – Codebase subject to substantial changes

This pre v1.0 implementation is under active development and experimentation and might experience significant organizational and substantive changes. If you use components of this codebase, expect breaking changes to be introduced.

That said, we will try to detail any breaking changes in subsequent releases.

Requirements
Developer Setup

If you would like to hack on cbc-casper or run the simulations yourself, setup your dev environment with:

 install

NOTE: If you prefer to manage venv explicitly, run a standard venv setup and pip install using requirements.txt

Run Simulations
Standard

Standard simulations are marked up for use as follows:

 run-[binary | blockchain | concurrent | integer | order | sharding]

Each protocol represents consensus on a different data structure.

Optionally, you can add a message passing mode to each protocol. For example,

 run-binary MODE=rrob

There are currently three message passing modes:

rand: each round, some randomly selected validators propagate their most recent message to other randomly selected validators, who then create new messages.

rrob: each round, the creator of the last round's block sends it to the next receiver, who then creates a block.

full: each round, all validators receive all other validators previous messages, and then all create messages.

By default, a gif and associated images of the simulation will be saved in graphs/graph_num_0/. These settings can be modified, along with the number of validators, the number of messages that propagate per round, and the report interval in the config.ini.

Advanced

Advanced simulations can be run with a little command line wizardy.

run a simulation with 100 validators and random message propagation

python casper.py –protocol blockchain –msg-mode rand –validators 100

run a simulation without displaying the viewgraphs, but instead save them and create a GIF

python casper.py –protocol blockchain –msg-mode rand –display false –save true

run a simulation with 20 validators and 1000 rounds of round robin message propagation,

reporting every 100 rounds

python casper.py –protocol blockchain –msg-mode rrob –validators 6 –rounds 300 –report-interval 100

rite Simulations

NG SOON...

un Tests
un all tests:

make test

un a specific test, use (or the equivalent for whatever test you wish to run)

make test TEST=tests/test_safety_oracle.py

un tests with visualizations:

make test-with-reports

: each view graph must be closed for the tests to continue running.

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.