noureddinel / core-bitcoin-net-simulator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Core-Bitcoin Network Simulator for Performance Evaluation using Lightweight Virtualization

Core-Bitcoin simulator is built on Docker technology to generate local Bitcoin network. The simulator is designed to test and assess the impact of any modifications to the original Bitcoin reference implementation. Moreover, it allows evaluating Bitcoin network performance under different realistic network conditions. The simulator can be also used by people who are new to the area of Bitcoin network to understand its key components (nodes, wallet, mining, forks, balance ... etc.), by interacting with the network through the command line interface of each Bitcoin node.

Although Bitcoin reference implementation provides by default two testing environements namely, Testnet and Regtest, none of them support constructing an efficient local Bitcoin network. Testnet blockchain is a public test network on the Internet that does not give sufficient flexibilty to test the influence of various network parameters on the Bitcoin performance. The only local (private) test environement is offered by Regtest, however, in Regtest developpers can almost instantly generate blocks on demand for testing events and nodes cannot mimic the actual Bitcoin mining process.

To overcome all of the mentioned limitations, We have designed our simulator to seamlessly construct a local Bitcoin network that can be parametrized to fulfil the user's goals. It manly provides the following configuration parameters:

  • Network size (number of nodes).
  • Hashing-power of each individual node (mining capabilities).
  • Delay on the egress traffic of each node.
  • Delay jitter with Normal/Pareto distribution on each node.
  • Simulation time.

The following reports are generated by the simulator during and at the end of the simulation:

  • Number of generated blocks per node.
  • Number of blocks committed to the main chain per node.
  • Number of valid forks each node witnessed during the simulation.
  • Nodes with the highest and lowest number of mined blocks.
  • Amount of spendable balance of each node.
  • Total network hashrate.
  • Plots of the calculated values.

Getting Started

Steps to make your first local Bitcoin testing network up and running on your local machine.

Clone the repository to your host machine:

$ git clone https://github.com/noureddinel/core-bitcoin-net-simulator

$ cd core-bitcoin-net-simulator/

Prerequisites

The following tools and packages will be installed:

Manually install the following:

  • Docker * Docker - To install Docker sucessfuly follow this link
  • Docker-compose * Docker-compose- To install Docker-compose sucessfuly follow this link

Use the script below to automatically install the following:

  • pumba
  • matplotlib
  • statstics
  • python-tk
$ python Prerequists.py 

Tutorial for setting up a multi-nodes local bitcion network

Step 1: open ports 10345,12342,12343,12344,12345,12346 on your host machine using the following command

sudo ufw allow 10345,12342,12343,12344,12345,12346/tcp

Step 2: generating a local Bitcoin test network

$ python localtestnet.py

Note:

  • If you are generating the network for the first time, it will require few minutes in order to build and setup the docker image.

Step 3: checking the docker continers' state

$ docker ps

Step 4: generating and view a performance report during the simualtion

$ python getperformance.py

Step 4: stopping network's miners

$ python stopminers.py

Step 5: teardown the setup

$ python teardown.py

Authors

Conference paper

https://arxiv.org/pdf/2002.01243.pdf

About


Languages

Language:C++ 39.0%Language:Shell 18.1%Language:Roff 17.2%Language:Makefile 17.1%Language:C 3.8%Language:Python 1.8%Language:M4 1.6%Language:Objective-C 0.6%Language:HTML 0.6%Language:Assembly 0.1%Language:Objective-C++ 0.1%Language:NSIS 0.1%Language:CSS 0.0%Language:Dockerfile 0.0%