Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First try of implementation of the slush protocol in jabs #9

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0d9092a
[FIX] Removed javadoc
hyajam Jun 24, 2022
85ccc5d
[FIX] Compressed pings data in pings-2020-07-19-2020-07-20.7z
hyajam Jun 24, 2022
7fa6636
[FIX] Fixing some bugs
hyajam Jun 24, 2022
bd5a631
[FIX] fix
hyajam Jun 29, 2022
b8d2269
[FIX] fix
hyajam Jun 29, 2022
334bf9c
[FEAT] Add some features and fix few bugs:
hyajam Jul 2, 2022
6cc5390
[ADD] Added docker compose and fixed root owned outputs issue in docker
seyyedarashazimi Jul 3, 2022
ebe0c5d
[ADD] Added docker compose and fixed root owned outputs issue in docker.
seyyedarashazimi Jul 3, 2022
de711a7
Revert "[FIX] fix"
hyajam Jul 4, 2022
1d423d9
Merge pull request #3 from seyyedarashazimi/docker
hyajam Jul 4, 2022
94476e9
[ADD] add new weight property to all blocks.
hyajam Jul 4, 2022
48227f0
Merge remote-tracking branch 'origin/main'
hyajam Jul 4, 2022
eb2433f
[FIX] gitignore updated to support docker compose
hyajam Jul 4, 2022
1c61333
Merge branch 'BlockWeight'
hyajam Jul 4, 2022
834a66a
[FIX] renamed output folder to have better consistency with other dir…
hyajam Jul 4, 2022
d188170
[ADD] Updates about docker compose in the README.md file.
hyajam Jul 4, 2022
638d1c5
[ADD] More updates in README.md file.
hyajam Jul 13, 2022
9672bc0
[ADD] better AbstractCSVLogger
hyajam Aug 21, 2022
e5b622b
[ADD] added new RoundRobinConsensus algorithm
hyajam Aug 27, 2022
a3299fa
[FIX] some name changes
hyajam Sep 8, 2022
9391090
Fixed the function "csvOutputConditionAfterEvent" in the class "PBFTC…
hyajam Sep 8, 2022
16d36bf
[FIX] Add research paper citation
hyajam Jun 8, 2023
8d1dda6
[FIX] Github workflow fix for Java 17
hyajam Jun 8, 2023
28273fc
Merge remote-tracking branch 'origin/main'
hyajam Jun 8, 2023
6661675
Merge pull request #7 from abdi-siamak/feature/AmazingFeature
hyajam Jun 8, 2023
1b44377
Merge changes from upstream/main
abdi-siamak Jun 16, 2023
5c47362
To optimize the simulation's performance, I've adjusted the LAN's lat…
abdi-siamak Aug 22, 2023
5860d39
Merge pull request #8 from abdi-siamak/AmazingFeature
hyajam Sep 1, 2023
797ffec
add slush protocol
RMLoureiro Oct 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Binary file added .DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 14
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '14'
java-version: '17'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

javadoc
javadoc/
/javadoc/
# Created by https://www.toptal.com/developers/gitignore/api/java,intellij,maven
# Edit at https://www.toptal.com/developers/gitignore?templates=java,intellij,maven

Expand Down Expand Up @@ -143,6 +145,4 @@ buildNumber.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar

_output/

# End of https://www.toptal.com/developers/gitignore/api/java,intellij,maven
# End of https://www.toptal.com/developers/gitignore/api/java,intellij,maven
5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Yajam"
given-names: "Habib"
orcid: "https://orcid.org/0000-0003-4344-7446"
- family-names: "Ebadi"
given-names: "Elnaz"
- family-names: "Akhaee"
given-names: "Mohammad Ali"
title: "JABS: Just Another Blockchain Simulator"
version: 0.2.0
date-released: 2023-06-08
url: "https://github.com/hyajam/jabs"
preferred-citation:
type: article
authors:
- family-names: "Yajam"
given-names: "Habib"
orcid: "https://orcid.org/0000-0003-4344-7446"
- family-names: "Ebadi"
given-names: "Elnaz"
- family-names: "Akhaee"
given-names: "Mohammad Ali"
doi: "10.1109/TNSE.2023.3282916"
journal: "IEEE Transactions on Network Science and Engineering"
month: 6
start: 1 # First page number
end: 12 # Last page number
title: "Yajam, Habib and Ebadi, Elnaz and Akhaee, Mohammad Ali"
year: 2023
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM maven:3-openjdk-17

WORKDIR /app
ARG user=appuser
ARG group=appuser
ARG uid=1000
ARG gid=1000

COPY pom.xml ./
RUN mvn verify --fail-never
RUN groupadd -g ${gid} ${group} && useradd -u ${uid} -g ${gid} ${user}

COPY src ./src
RUN mvn package
WORKDIR /app

CMD java -jar target/jabs.jar
COPY pom.xml ./
RUN mvn verify --fail-never
126 changes: 99 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Just Another Blockchain Simulator
# Just Another Blockchain Simulator #

![GitHub](https://img.shields.io/github/license/hyajam/jabs)
![Build Status](https://travis-ci.com/hyajam/jabs.svg?branch=objectifiedNetworkAndSimulator)
Expand All @@ -9,70 +9,142 @@
JABS - Just Another Blockchain Simulator.

JABS is a blockchain network simulator aimed at researching consensus
algorithms for performance and security. it is designed to easily handel
algorithms for performance and security. It is designed to easily handel
simulation of networks as large as normal public blockchain networks
(~10000 nodes) in reasonable time.


## Installation
First, you should have ```git```, ```openjdk-17-jdk``` and ```maven```
installed.
## Installation ##
There are two suggested installation methods Introduced here.
Installation on a Debian-based linux like Ubuntu and
installation using Dockerfile.

### Installation on Ubuntu 20.04 and 22.04 ###

First, you should install `git`, `openjdk-17-jdk`, and `maven`.

```shell script
$ sudo apt install git openjdk-17-jdk maven
$ sudo apt install git openjdk-17-jdk
$ sudo apt install maven
```

After that, clone the git repository.
```shell script
$ git clone https://github.com/hyajam/jabs.git
```
Use ```maven``` to make a jar file.

Use maven `mvn` to make a jar file.
```shell script
$ cd jabs
$ mvn clean install
```
You might need to set ```JAVA_HOME``` to java home directory (this

You might need to set `JAVA_HOME` to java home directory (this
might vary depending on your linux distribution and jdk version):

```shell
$ JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64/; mvn clean install
```

Then to run the compiled jar file.

```shell script
$ java -jar target/jabs.jar
```


### Installation using Dockerfile
Clone the repository using git:
### Installation using Docker-Compose ###
The easiest method for running jabs is using ```docker-compose```. You need
to have ```git``` and ```docker-compose``` installed on your system. Clone
the repository using git.
```shell script
$ git clone https://github.com/hyajam/jabs.git
```
Build the docker image:
```shell script
$ docker build -t jabs .
```
Run the docker container:

Then, use docker compose to build an image and run the container. The output
of simulation will be automatically sent to ```output/``` folder.
```shell script
$ docker run -t jabs
$ cd jabs
$ docker-compose up
```
The ```Dockerfile``` is designed to support caching dependencies
therefore by editing the source code you do not need to download
new dependencies unless your changes include changes to ```pom.xml``` file

If your user id and group id are not 1000 you might need to change the
values in `Dockerfile` and `compose.yaml` accordingly. You might be able to
find your user id and group id using commands `id -u` and `id -g` in linux.

## Usage
## Quick Start ##



## Usage ##
Currently, you can use JABS by editing Main.java file and creating new scenarios for your tests.


### Supported Consensus algorithms
Currently, JABS support the following consensus algorithms:
## Supported Consensus algorithms ##
Currently, the following consensus algorithms are implemented in JABS:
1. Nakamoto Consensus
2. Ghost protocol
3. PBFT
4. Casper FFG
6. DAGsper
5. IOTA Tangle
6. Nakamoto Heaviest-Chain
7. Robust Round Robin

## Roadmap ##

- [x] Add new block mining process that can support adjustable difficulty.
- [x] Add multiple loggers and scenarios in main class.
- [ ] Add detailed comparison with other simulators in README.md.
- [x] Add new network latency stats that has countries instead of continents.
- [ ] Add events for network churn.
- [ ] Exploring possible multithreading options.
- [ ] Add new consensus algorithms:
- [x] IOTA
- [ ] Honey Badger BFT
- [ ] DPoS

## Other Blockchain Simulators ##
1. Bitcoin Simulator: developed in C++ and based on NS3. Can simulate Bitcoin, Litecoin, Dogecoin and probably other blockchain networks based on Nakamoto Consensus. Although it is probably the most accurate of the blockchain simulators it is fairly slow. Does not simulate transactions. (https://github.com/arthurgervais/Bitcoin-Simulator)
2. BlockSim: developed in Python. Supports simulating both Bitcoin and Ethereum. Accurate but slow. Simulates transactions and connection handshakes. (https://github.com/carlosfaria94/blocksim)
3. SimBlock: developed in Java. In current version supports only Nakamoto Consensus. Plans on adding GHOST protocol. Fast. Does not simulate transactions. SimBlock partially inspired this project. (https://github.com/dsg-titech/simblock)
1. **Bitcoin Simulator**: developed in C++ and based on NS3. Can simulate Bitcoin, Litecoin, Dogecoin and probably other blockchain networks based on Nakamoto Consensus. Although it is probably the most accurate of the blockchain simulators it is fairly slow. Does not simulate transactions. (https://github.com/arthurgervais/Bitcoin-Simulator)
2. **BlockSim**: developed in Python. Supports simulating both Bitcoin and Ethereum. Accurate but slow. Simulates transactions and connection handshakes. (https://github.com/carlosfaria94/blocksim)
3. **SimBlock**: developed in Java. In current version supports only Nakamoto Consensus. Plans on adding GHOST protocol. Fast. Does not simulate transactions. SimBlock partially inspired this project. (https://github.com/dsg-titech/simblock)


## Contributing

Any contributions you make to JABS project are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star. Thanks.

Steps for code contribution to the project:

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request


## License ##

Distributed under the MIT License. See `LICENSE` for more information.

## Publications ##

Please use the following bibtex reference to cite our paper:

```
@ARTICLE{10144349,
author={Yajam, Habib and Ebadi, Elnaz and Akhaee, Mohammad Ali},
journal={IEEE Transactions on Network Science and Engineering},
title={JABS: A Blockchain Simulator for Researching Consensus Algorithms},
year={2023},
volume={},
number={},
pages={1-12},
doi={10.1109/TNSE.2023.3282916}
}
```

## Contact ##

Habib Yajam - [@habibyajam](https://twitter.com/HabibYajam) - [email protected]
22 changes: 22 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3.9"
services:
jabs:
build:
context: .
args:
user: appuser
group: appuser
uid: 1000
gid: 1000
volumes:
- type: bind
source: ./src/
target: /app/src/
read_only: true
- type: bind
source: ./output/
target: /app/output/
command: /bin/sh -c "
mvn package &&
su appuser -c 'cd /app/ && java -jar ./target/jabs.jar'
"
1 change: 1 addition & 0 deletions data/86-regions/.~lock.bandwidth_mbps.csv#
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
,habib,habib-Z590-UD-AC,16.06.2022 18:42,file:///home/habib/.config/libreoffice/4;
4 changes: 4 additions & 0 deletions data/86-regions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This directory contains information that are compiled from
other sources in other directories of this set in a unified form
that enables a global network model with 85 countries and an
average case for the rest of the world.
3 changes: 3 additions & 0 deletions data/86-regions/bandwidth_mbps.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/86-regions/bitcoin-mining_dist.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/86-regions/bitcoin-nodes_dist.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/86-regions/country_names.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/86-regions/ehereum-nodes_dist.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/86-regions/latency_ms.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/bitcoin/Bitcoinnodes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Source: https://bitnodes.io/

Timestamp: 12 Jun 2022
3 changes: 3 additions & 0 deletions data/bitcoin/Bitcoinnodes/node-by-country.csv
Git LFS file not shown
2 changes: 2 additions & 0 deletions data/bitcoin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This folder contains data gathered from various sources related
to bitcoin network alongside the source address.
6 changes: 6 additions & 0 deletions data/bitcoin/cbeci-mining_map-bitcoin-mining/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Source: https://ccaf.io/cbeci/mining_map

Timestamp: 12 Jun 2022

This is a project for mapping Bitcoin mining in the world.
Data timestamp is 2021-03-01.
Git LFS file not shown
Empty file added data/ethereum/README.md
Empty file.
3 changes: 3 additions & 0 deletions data/ethereum/ethernodes.org_nodes_distribution.csv
Git LFS file not shown
2 changes: 2 additions & 0 deletions data/network-stats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This folder contains data gathered from around the web related to
network statistics such as latency and bandwidth of nodes around the world.
7 changes: 7 additions & 0 deletions data/network-stats/speedtest-bandwidth-data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Source: https://www.speedtest.net/global-index/

Timestamp: June 12 2022

The bash script ```crawl-speedtest.sh``` crawls the speedtest.net global
index site to gather information on upload and download bandwidth around the
world.
3 changes: 3 additions & 0 deletions data/network-stats/speedtest-bandwidth-data/countries.csv
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
echo -n > data.csv
while read line; do
echo $line
echo $line,$(wget -qO- "https://www.speedtest.net/global-index/$line" | grep 'class="number">' | cut -d'>' -f2 | cut -d'<' -f1 | tr '\n' ', ') >> data.csv
done < countries.csv
3 changes: 3 additions & 0 deletions data/network-stats/speedtest-bandwidth-data/data.csv
Git LFS file not shown
3 changes: 3 additions & 0 deletions data/network-stats/speedtest-bandwidth-data/intersection.csv
Git LFS file not shown
Loading