Aleph is an asynchronous and Byzantine fault tolerant DAG-based consensus protocol aimed at ordering messages (transactions). It has been designed to operate continuously under conditions where there are no bound on message-delivery delay and under the assumption that there is a significant probability of malicious behavior, making it an excellent fit for blockchain-related applications. For more information, check webpage.
This repository is a proof-of-concept implementation, it is not meant for production deployment. It is released as a reference for the main implementation in Go that will be published in the future. The initial version of the repository was based on an old paper, while the more recent one relies on a new paper.
The following results come from experiments performed on 128 nodes of Amazon Web Services distributed uniformly between 8 different regions on 5 continents. We tested the performance under various loads of the system:
load | txps | latency |
---|---|---|
small | 72.1 | 5.1s |
big | 9476.7 | 15.8s |
heavy | 93419.0 | 20.5s |
For more results, details of the setup, and discussions check our reports.
The documentation describes only the algorithmic and technical parts of the implementation. For the conceptual understanding of the protocol and the implementation please read the above papers.
This repository is only an exploratory playground and we are done with it now. No further developments will be made on our side. If you want to play with it, go ahead and fork it!
The implementation requires Python 3.7. The following script creates a virtual environment for Python 3.7 in home directory and installs Aleph and its dependencies there. The script was prepared for Ubuntu 18.04.
- run
bash experiments/aws/setup.sh
- enter py37 env
source $HOME/p37/bin/activate
- install aleph
pip install -e .
Remember to activate py37 env andexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
in every terminal you play with Aleph.
To run unit tests please use the following command: pytest-xdist -n $n_cores aleph
There are two types of experiments that can be performed:
- Local: run
python tests/linear_ordering_network.py
- Remote using AWS EC2:
- Create an account on AWS and set up credentials and a default region as described here.
- Then, go to
cd experiments/aws
and install additional packagesbash aws_deps.sh
. - Run
python shell.py
. This opens a shell with procedures orchestrating experiments. The main procedure isrun_protocol(n_processes, regions, restricted, instance_type)
that runsn_processes
in specifiedregions
, where some of the regions can berestricted
, and uses EC2 machines ofinstance_type
. - The most basic experiment can be run with
run_protocol(8, badger_regions(), {}, 't2.micro')
. It spawns 8 machines in 8 different regions on 5 continents. As of time of writing, AWS EC2 was providing users with a limited time of free usage of machines of typet2.micro
and some quota for free storage and data transfer, so such an experiment can be conducted free of charge. - The parameters of the protocol are defined in the file
const.py
. - To check whether an experiment has finished, use the procedure
reached_max_level
that returns the number of instances that finished their run. - After the experiment is finished, the logs containing useful data of the experiment can be downloaded with
get_logs
.
After collecting the logs, the performance can be analyzed as follows:
- A single log with data on instance labeled with pid
python aleph/log_analyzer/run_analyzer.py aleph.log pid
- All logs
python aleph/log_analyzer/run_analyzer.py ALL log-dir [report-dir]
Aleph Python implementation is released under an LGPL version 3 license. See the LICENSE.txt
for details.