Blockchain-Technology-Lab / consensus-decentralization

Tool that analyzes blockchain decentralization on the consensus layer by looking at the block production distributions of various blockchain systems.
https://blockchain-technology-lab.github.io/consensus-decentralization
MIT License
25 stars 6 forks source link
block-producers blockchain blockchain-technology consensus-layer decentralization

Consensus Blockchain Decentralization

This repository provides a CLI tool for analyzing the block production of various blockchains and measuring their subsequent levels of decentralization. Please refer to the project's documentation pages for details on its architecture, required input, produced output, and more.

Currently, the supported blockchains are:

We intend to add more ledgers to this list in the future.

Installation

To install the tool, simply clone this project:

git clone https://github.com/Blockchain-Technology-Lab/consensus-decentralization.git

The requirements file lists the dependencies of the project. Make sure you have all of them installed (preferably within a virtualenv) before running the scripts. To install all of them in one go, run the following command from the root directory of the project:

python -m pip install -r requirements.txt

Run the tool

Place all raw data (which could be collected from BigQuery for example) in the raw_block_data directory, each file named as <project_name>_raw_data.json (e.g. bitcoin_raw_data.json). By default, there is a (very small) sample input file for some supported projects. To use the samples, remove the prefix sample_. For more extended raw data and instructions on how to retrieve it, see here.

Run python run.py --ledgers <ledger_1> ... <ledger_n> --timeframe <timeframe> to produce a csv of the mapped data. Note that both arguments are optional, so it's possible to omit one or both of them (in which case the default values will be used). Specifically:

run.py prints the output of each implemented metric for the specified ledgers and timeframe.

To mass produce and analyze data, omit one or both arguments. If only the ledgers is given, all data since January 2018 for the given ledgers will be analyzed. If only the timeframe is specified, all ledgers will be analyzed for the given timeframe. If no arguments are given, all ledgers will be analyzed for all months since January 2018.

Three files nc.csv, gini.csv, entropy.csv are also created in the output directory, containing the data from the last execution of run.py.

Contributing

Everyone is welcome to contribute ideas, report bugs, and make the code more efficient. We especially welcome contributions to the following areas:

For detailed information on how to contribute see the relevant documentation page.

Maintainers

The tool is actively maintained by the following people:

License

The code of this repository is released under the MIT License. The documentation pages are released under CC BY-SA 4.0.