A Hyperledger Fabric blockchain network to cast votes
If you're running on Ubuntu, you can download the prerequisites using the following commands:
curl -O https://hyperledger.github.io/composer/latest/prereqs-ubuntu.sh
chmod u+x prereqs-ubuntu.sh
Next run the script - as this briefly uses sudo during its execution, you will be prompted for your password.
./prereqs-ubuntu.sh
Next install the following tools:
npm install -g composer-cli
npm install -g composer-rest-server
npm install -g composer-playground
npm install -g yo generator-hyperledger-composer
Run the following commands to install the local Hyperledger Fabric runtime:
mkdir ~/fabric-dev-servers
cd ~/fabric-dev-servers
tar -xvf fabric-dev-servers.tar.gz
export FABRIC_VERSION=hlfv12
./downloadFabric.sh
./startFabric.sh
./createPeerAdminCard.sh
Follow the steps below to run the application:
- Go to Hyperledger Fabric Server Folder
- Open a terminal in there and run the command:
./startFabric.sh
- Go to voting-blockchain folder
- Open a new terminal in there and run the command:
composer network install --archiveFile [email protected] --card PeerAdmin@hlfv1
- To deploy the network now run the command:
composer network start --networkName voting-app-network --networkVersion 0.1.0 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file voting-app-admin.card
- To start the Rest Server open a new terminal in voting-blockchain folder
- Run the command:
composer-rest-server -c admin@voting-app-network -n never -u true -w true
- Go to the voting-angular-app and open a new terminal
- Run the command:
npm start