This project originated from the seminar on Advanced Blockchain Technologies (IN2107) at the Technical University of Munich. Within the scope of this course, we analyzed the technical characteristics, advantages as well as limitations of Hyperledger Fabric thoroughly, and proposed a proof-of-concept for a given use case.
With the objective to track money in large construction projects, project CashFlow
aims to build a redundant alternative to legal agreements on paper. By implementing a prototype based on Hyperledger Fabric, we suggest a solution that is transparent, secure and efficient.
In our report and presentation, we examined the technical characteristics of Hyperledger Fabric and described a specific use case of the proposed prototype in more detail.
To get started with Hyperledger Fabric, you have to follow the subsequent five steps.
-
Add the Go environment variable
export GOPATH=$HOME/go
andexport PATH=$PATH:$GOPATH/bin
to your startup file (e.g.~/.bashrc
or~/.zshrc
) -
Install node.js and update globally with
npm install npm@5.6.0 -g
-
Install
Python
withsudo apt-get install python
-
Copy
curl -sSL http://bit.ly/2ysbOFE | bash -s
to your terminal to download all necessary samples, binaries and Docker images
The application has been developed on MacOS 10.15 Catalina. For more detailed information and instruction on how to install all necessary prerequisites also for other operating systems, we refer to the official Hyperledger Fabric Documentation.
Having installed all prerequisites, the following commands setup the network by executing the startFabric.sh
script and installing all required node modules. First, ensure to launch Docker and then subsequently copy the following commands to setup the network. The startFabric
script will configure the Docker containers. Concatenating the command with the flag '--rm' will remove any node_modules, otherwise the cached modules are utilized.
# Change to cashflow directory and start Fabric network
./cashflow/startFabric.sh
# Change to javascript folder and install all necessary node modules
cd javascript && npm install
After this setup, an admin user can be enrolled in the network.
# Register the admin user
node enrollAdmin.js
After enrolling the user, it is possible to register one or multiple users and interacting with the Blockchain network by executing node query.js
and providing the name of the according function as argument.
# Register client users "Authority", "Construction Company" and "Architect"
# Flags (-a, -o, -c) specify the respective role
node registerUser.js -a Authority -o Construction\ Company -c Architect
# Create and sign a new legal agreement as organizer with the following parameters:
# > id: "LAG4", hash: "52ABC1042", amount: "10M", partner_1: "Construction Company", partner_2: "Architect"
node query.js organizer create LAG4 52ABC1042 10M Construction\ Company Architect
# Sign legal agreement "LAG4" as contractor and check the respective document
node query.js contractor sign LAG4
node query.js contractor query LAG4
# Query all agreements as authority
node query.js authority queryAll
The following commands will be performed within the startFabric
script. However, if there seems to be an issue with Docker, it might help to reboot all containers and prune the images. Hence, the following commands might help here.
# Take the network down
.first-network/byfn.sh down
# Deletes all the dangling images
docker image prune –a
# Remove all the containers that are stopped in the application
docker container prune
This project is licensed under the MIT License - see the LICENSE.md file for details.
- We are very grateful for the advices of the entire Hyperledger Community, the master repository and the provided samples
- Kudos to Horea Porutiu for inspiration, his insights and videos on setting up Hyperledger Fabric