Skip to content

A scalable blockchain-based distributed system to satisfy supply chain collaborators' needs

License

Notifications You must be signed in to change notification settings

bajelidze/ccchain

Repository files navigation

Description

This code is associated with my Master's thesis titled "A Company-Centric Approach for Incrementally Deployable Blockchain-Based Supply Chain Management".

The thesis later served as the foundation for a research paper published in IEEE, titled "Scalable and Privacy-Focused Company-Centric Supply Chain Management".

The paper is available at: https://doi.org/10.1109/ICBC54727.2022.9805503

See CITATION.cff for the citation information.

Setup

Building all the necessary components and running them is a multi-step process. We tried to write down all the steps such that they use specific versions of dependencies and still work in the future.

Build the Bootnode

Ethereum nodes require a bootnode to be able to discover other nodes in the network. For that, we have a special Docker image that builds a bootnode image. To build it, run:

bootnode/build.sh

Create the Docker Network

The collaborator nodes run in a pre-created Docker network, which we need to create manually. To create the network, run:

docker network create --subnet 172.255.0.0/16 --gateway 172.255.255.254 ccchain

As you can notice, we are intentionally reassigning the default gateway IP to 172.255.255.254. That's just so that the nodes' IP addresses start from 172.255.0.1 and onward.

Install Dependencies

Install Python

We require Python version 3.9 to be installed and available in PATH as python3.9. On Arch Linux, you can install it from AUR:

yay -S python39

You could also try installing it with: https://github.com/pyenv/pyenv

Install the Solidity Compiler

We require solc version 0.8.19.

You can download a static binary and install it in PATH from here: https://github.com/ethereum/solidity/releases/tag/v0.8.19

Setup the Python Virtual Environment

python3.9 -m venv venv
virtualenv venv
source venv/bin/activate

pip3.9 install web3==5.20.0 py-solc==3.2.0

Running

To start up a 2 node CCChain collaborator network, run:

python3.9 scripts/chain.py -n 2

This will deploy 7 Docker containers. One for the bootnode, and 3 for each of the two collaborators. Each of those 3 containers are:

  • A CCChain instance
  • A MongoDB instance
  • A Geth instance

As a part of the chain.py script, the first collaborator, will also deploy the smart contract located at contracts/global.sol.

See python3.9 scripts/chain.py -h for more deployment options.

Using the API

We do not have a concrete documentation of the CCChain API, as this was a research prototype.

To see how the API is used in practice, check out the Python code in the sim directory. The sim/simDemo.py would be a good start.

About

A scalable blockchain-based distributed system to satisfy supply chain collaborators' needs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published