Code Monkey home page Code Monkey logo

blockcompass's Introduction

Manual for using Blockcompass

Overview

BlockCompass is a benchmarking performance tool for blockchain platforms. Currently Hyperledger Fabric, Hyperledger Sawtooth and Ethereum are supported. BlockCompass supports multiple performance indicators including resource consumption (CPU, Memory, Network Input and Network Output), latency, transmission rate, throughput and error rate. It also provides a real time chart and the possibility to export a detailed report.

Tutorials

Ethereum Clique: https://youtu.be/R91RybpXbVA

Hyperledger Fabric: https://youtu.be/Jgzrq-yXcj4

User manual: https://drive.google.com/file/d/1sVX8OzQ6ShL_ftaTozEth3tf3ZkX_oCs/view?usp=sharing

Minimum Requirement

OS => Ubuntu 18.04

CPU => 2 vCPUs

Memory => 8GB RAM

Disk Space => 25 GB (Might need more for Ethereum Proof Of Work)

Prerequisites

docker / docker compose
  1. install docker either from the officiel documentation https://docs.docker.com/engine/install/ubuntu/, or following the next steps

1.1 Manual installation

sudo apt update 
sudo apt install apt-transport-https ca-certificates 
curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
sudo apt install docker-ce  

1.2 Run docker without sudo

sudo usermod -aG docker ${USER}
su - ${USER}

  1. install docker compose either from the officiel documentation https://docs.docker.com/compose/install/, or following the next steps
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
nodeJS version 10.22.0
  1. Install nodeJS version 10.22.0

1.1 Manual installation

 cd ~
curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install nodejs
sudo apt install build-essential
Python / mongoDB Client
  1. Python is by default installed in ubuntu 18.04 distribution, to update python run the following commands:
sudo apt update
sudo apt -y upgrade
  1. Install Additional Tools
sudo apt install -y python3-pip
sudo apt install libssl-dev libffi-dev python3-dev 
sudo apt install -y python3-venv
  1. Install mongoDB Client
sudo apt install mongodb-clients

Virtual environment
  1. Clone repository
git clone https://github.com/polytechnique-ease/blockcompass
  1. Set virtual environment and install requirement
cd blockcompass
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
  1. Install mongoDB Client
sudo apt install mongodb-clients

Hyperledger Fabric
  1. Download binaries and pull docker images for Fabric v2.2

   curl -sSL https://bit.ly/2ysbOFE | bash -s -- 2.2.2 1.4.9

  1. Using bash_profile to add Hyperledger Fabric bin permanently to the PATH environment variable
sudo nano ~/.profile
  
## At the end of the file, add this line:
export PATH=<path to fabric-sample location>/bin:$PATH
  
source ~/.profile

  1. Install Golang 1.17
cd ~
curl -O https://dl.google.com/go/go1.17.linux-amd64.tar.gz
tar xvf go1.17.linux-amd64.tar.gz
sudo chown -R root:root ./go
sudo mv go /usr/local
sudo nano ~/.profile
  
## At the end of the file, add this line:
export PATH=$PATH:/usr/local/go/bin
  
source ~/.profile


  1. Set ABRIC_CFG_PATH variable:
sudo nano ~/.profile
  
## At the end of the file, add this line:
export FABRIC_CFG_PATH=<Absolute PATH to iot-docker-mongoDB folder>/networks/fabric-v2.2/config

source ~/.profile


Project Structure

Backend

  • Backend: Server implementation using Express.js in JavaScript.

Configuration

  • /configuration: Holds the main configuration file and the contractABI for Ethereum.

Ethereum Clients

  • /eth-client-js: Ethereum client adapter, an Express.js server implemented in JavaScript. Uses raw JSON RPC for Ethereum transactions. Requires unlocked accounts.
  • /eth-web3-client: Another Ethereum client adapter using Web3.js. This implementation is still under development but does not require an unlocked account.

Frontend

  • /front: Frontend client folder built with Angular 10.

Monitor

  • /monitor: Resource monitor that runs a Python script to call docker stats every 10 seconds.
    • /logs: Contains output and error logs.

Networks and Contracts

  • /networks: Sample networks folder.
  • /contracts: Contract implementations for Ethereum and Hyperledger Fabric.
    • /ethereum-clique: Sample for Ethereum Clique (PoA) network.
      • /bootnode: Dockerfile for bootnode.
      • /miner: Genesis and Dockerfile for miner.
      • /docker-compose.yml: Docker-compose file for a 5-node Ethereum clique network.

Hyperledger Fabric

  • /fabric-v2.2: Hyperledger Fabric Network sample.
    • /docker: Docker-compose files for each peer.
  • /services:
    • /enrollAdmin.js: Script to enroll admin.
    • /block-server.js: Script to register a user to org 1.
    • /txn-server.js: Hyperledger Fabric client adapter, an ExpressJS server.

Hyperledger Sawtooth

  • /sawtooth_v1_2: Hyperledger Sawtooth Network sample.
    • /kvstoreprocess: KVSTORE transaction family.
    • /rest_api: Hyperledger Sawtooth Fabric adapter.
    • /docker-compose-pbft.yaml: Docker-compose for 5-node network with PBFT consensus.
    • /docker-compose-poet.yaml: Docker-compose for 5-node network with PEoT consensus.
    • /docker-compose-raft.yaml: Docker-compose for 5-node network with Raft consensus.

Workload

  • /workload: Workload client implementation.
    • /dockers:
      • /IoT: Contains workload logic and user management.
      • /web: NGINX server for transactions.
    • /IoT: Configuration for workload clients.

Miscellaneous

  • Clean.sh: Bash script to clean up containers and services.
  • Docker-compose-mongo-replicaset.yml: Docker-compose file for MongoDB replica set with three members.
  • Launcher.py: Python script to start the experiment.
  • replicaset.sh: Bash script to initialize the MongoDB replica set.

Get Started

Step1 : Configuration
  1. ReplicaSet

1.1 In the configuration/blockchain.yaml file, change the IP address in replicaSet field by your local IP address.

replicaSet:
  • 'IP:27011'
  • 'IP:27012'
  • 'IP:27013'
chmod +x replicaset.sh

1.2 In the replicaset.sh file, change the IP address by your IP address.

  1. Network Configuration:

2.1 In the configuration/blockchain.yaml file set the target Blockchain in Blockchain.type field, allowed values are: ethereum-clique, ethereum-pow, sawtooth-pbft, sawtooth-raft, sawtooth-poet and fabric.

2.2 Ethereum Configuration


You can cite the following papers for this project:
1- Rasolroveicy, M., & Fokaefs, M. (2020, November). Dynamic reconfiguration of consensus protocol for IoT data registry on blockchain. In Proceedings of the 30th Annual International Conference on Computer Science and Software Engineering (pp. 227-236).

2- Rasolroveicy, Mohammadreza, Wejdene Haouari, and Marios Fokaefs. "Public or private? a techno-economic analysis of blockchain." Proceedings of the 31st Annual International Conference on Computer Science and Software Engineering. 2021


References:
Ramprasad, B., Fokaefs, M., Mukherjee, J., & Litoiu, M. (2019, June). EMU-IoT-A Virtual Internet of Things Lab. In 2019 IEEE International Conference on Autonomic Computing (ICAC) (pp. 73-83). IEEE.

blockcompass's People

Contributors

wejdenehaouari avatar roveicy avatar fokaefs avatar norcalaussie avatar rowaisi avatar

Stargazers

Irvin avatar  avatar  avatar

Watchers

James Cloos avatar

blockcompass's Issues

Add writing to file function in the abstract monitoring.py

Once you have rendered the writeToFile generic, by replacing metrics with JSON file, you should be able to pull up the functionality for writing in files (including the writeNamesToFile). This will make this option available for other monitors, other than Docker and it will provide additional support for the reporting functionality.

[ERROR]: Usage: /app/Simulator.py server_url workload_type

Hi,

I have got a problem when ran node container. The container up but in couple of minutes is down without error message.

hindenburgodesa@hindenburgodesa-VirtualBox:~/blockcompass/workload$ ./start.sh
sleep for 10 sec
ifconfig lo:0 172.16.123.1
start workload
Creating network "workload_default" with the default driver
Creating workload_web_1 ... done
Creating workload_cadvisor_1 ... done
Creating workload_haproxy_1 ... done
Creating workload_iot_1 ... done

Error:
[ERROR]: Usage: /app/Simulator.py server_url workload_type

Miners image are not loading

I'm trying to execute the Blockcompass to do some benchmarking, but I'm facing issues with the miners when using Ethereum-clique. The Docker containers for the miners are not running, so the eth-client-js_web_1 shows the following error:

====error==== Error: connect ECONNREFUSED 172.18.194.155:8546 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '172.18.194.155', port: 8546

Please, can anyone assist with this?

Regards,

Irvin

In dockerMonitoring.writeToFile(), replace list of metrics with JSON file.

In order to make the method more generic and independent of predefined lists of metrics, I recommend to replace the long parameter list with a JSON file (the same that is saved in the database). Writing to a file, like writing to a database should be independent of the monitor (Docker or otherwise).

  • [ Replace parameter list with JSON file]
  • [ Add checks for missing metrics or empty file]
  • [ Add warnings in a log for missing metrics or empty file. Do not interrupt the execution of the monitor. Do not use log4j for the logging part ]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.