DEV Community

Cover image for Installing Hyperledger Fabric on windows and Deploy /Start chain code
Swapan
Swapan

Posted on • Edited on

Installing Hyperledger Fabric on windows and Deploy /Start chain code

Windows Installation

Below are the instructions to intall and run chain code on a windows machine.
For this installation, you should be prepared for some obstacles as installation on windows is not simple.

Pre-reqs

• Docker (https://docs.docker.com/desktop/windows/install/)
• cURL (https://curl.se/download.html)
• Go (https://go.dev/dl/)
• Node.js (https://nodejs.org/en/download/)
• Git (https://git-scm.com)

Download, if needed and check on each pre-requisite item

Validatation for pre-reqs

Run command prompt in admin mode (cmd) check all installations

cURL Version
Check cUrl Version

docker version
docker version

git version
git version

go version
go version

Node version
Node version

npm version
npm version

Let's proceed to install other items

WSL (https://docs.microsoft.com/en-us/windows/wsl/install)
Use this command to install Windows Subsystem for Linux (WSL) - wsl –install
To update : WSL2 Linux kernel update package for x64 machines (https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi)

Use this command to validate installation wsl -l -v
Check Windows Feature if it has been installed, do check the Virtual Machine Platform, if not done set.

WSL and Virtual Machine Platform

WSL

Once done, log in Microsoft app store and download Ubantu and Windows Terminal
Run Windows Terminal under Admin mode
Below screen shows, how it looks after installation.
Note: Open Windows Terminal in Admin mode
Ubantu and Windows Terminal installation

Once Ubantu starts, it will ask for username and password.
Ubantu is picky with user names.. just like Unix, it needs to start with lower case (https://www.oreilly.com/library/view/practical-unix-and/0596003234/ch04s01.html)

Ubantu

User name and password

Docker desktop app start

Run docker under admin mode and under setting-> resources see that Ubantu is selected (First time users, will have to create docker hub ID)
Make sure

  1. WSL 2 is checked
  2. Ubantu is being referenced

Docker WSL check

Enable Ubantu on docker container
Enable Ubantu

Installing Hyperledger Fabric and Binaries

• Clone the hyperledger/fabric-samples repository.
I’m installing Hyperledger fabric version 2.2.0
curl -sSL http://bit.ly/2ysbOFE | bash -s -- <fabric_version> <fabric-ca_version> <thirdparty_version>
curl -sSL http://bit.ly/2ysbOFE | bash -s -- 2.2.0 1.4.9 0.4.22

Read this doc before you move ahead (https://hyperledger-fabric.readthedocs.io/en/release-1.4/developapps/scenario.html)

Read this doc to aid in testing (https://hyperledger-fabric.readthedocs.io/en/release-2.2/test_network.html)
cd fabric-samples/test-network

Step by step testing and running chain code

hyperledger fabric sample

Probe the folder ls
Hyperledger Fabric -2

Start the network with script file ./network.sh up
Note: run ./network.sh down to take anything running down on docker.
check existing processes running by using : docker ps -a
Hyperledger Fabric -3

Create mychannel ./network.sh up createChannel
Hyperledger Fabric -4

Deploying the chain code ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-javascript -ccl javascript

Hyperledger Fabric -5

Hyperledger Fabric -6

Docker container showing images created
Hyperledger Fabric -7

Note: in the end run ./network.sh down to stop process. Check docker's to confirm all processes are stopped..

Top comments (0)