MSBS is an open source sharded blockchain simulator based on the BlockSim simulator. MSBS aims to provide simulation constructs that are intuitive, hide unnecessary detail and can be easily manipulated to be applied to a large set of blockchains design and deployment questions (related to performance, reliability, security or other properties of interest). At the core of BlockSim is a Base Model, which contains a number of functional blocks (e.g., blocks, transactions and nodes) common across blockchains, that can be extended and configured as suited for the system and study of interest. MSBS is implemented in Python.
For more details about BlockSim, we refer to our journal paper that can be freely accessed online https://www.frontiersin.org/articles/10.3389/fbloc.2020.00028/full
Before you can use BlockSim simulator, you need to have Python version 3 or above installed in your machine as well as have the following packages installed:
- pandas
pip install pandas
- numpy
pip install numpy
- sklearn
pip install sklearn
- xlsxwriter
pip install xlsxwriter
Before you run the simulator, you can access the configuration file InputsConfig.py to choose the model of interest (Base Model 0, Bitcoin Model 1 and Ethereum Model 2) and to set up the related parameters. The parameters include the number of nodes (and their fraction of hash power), the block interval time, the block propagation delays, the block and transaction sizes, the block rewards, the tranaction fees etc. Each model has a slightly different (or additional) parameters to capture it.
To run the simulator, one needs to trigger the main class Main.py either from the command line
python Main.py
or using any Python editor such as Spyder.
The results of the simulator is printed in an excel file at the end of the simulation. The results include the blockchain ledger, number of blocks mined, number of stale (uncles) blocks and the rewards gained by each miner etc.
For any query about how to use or even extend the simulator, feel free to contact me [email protected]