Hyperledger Fabric Setup in Windows
Hyperledger Fabric Setup in Windows
Hyperledger Fabric Setup in Windows
10
Prerequisites : -
https://git-scm.com/downloads
Download using above link and then install on your machine.
You can check the version of git using “git –version” command using command line.
https://curl.haxx.se/download.html
Download using above link and then install on your machine.
You can check the version of curl using “curl --version” command using command line
System Requirements
The following hardware prerequisites are required to successfully run Client Hyper-V on
Windows 10:
o 64 bit processor with Second Level Address Translation (SLAT)
o 4GB system RAM
o BIOS-level hardware virtualization support must be enabled in the BIOS settings.
https://hub.docker.com/editions/community/docker-ce-desktop-windows/
Using above link you can download docker desktop on your machine.
Installation process : -
If you haven’t already downloaded the installer (Docker Desktop Installer.exe), you can
get it using above mention link. It typically downloads to your Downloads folder, or you
can run it from the recent downloads bar at the bottom of your web browser.
Docker Desktop does not start automatically after installation. To start Docker Desktop, search
for Docker, and select Docker Desktop in the search results.
When the whale icon in the status bar stays steady, Docker Desktop is up-and-running, and is ac-
cessible from any terminal window.
If the whale icon is hidden in the Notifications area, click the up arrow on the taskbar to show it.
To learn more, see Docker Settings.
When the initialization is complete, Docker Desktop launches the onboarding tutorial. The tuto-
rial includes a simple exercise to build an example Docker image, run it as a container, push and
save the image to Docker Hub.
Test your installation
2. Run “docker –version” to ensure that you have a supported version of Docker:
3. Sk@DESKTOP-BVFD1D1 MINGW64 ~
4. $ docker –version
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
5.List the hello-world container :
6. Sk@DESKTOP-BVFD1D1 MINGW64 ~
7. $ docker container ls –all
https://nodejs.org/en/download/
Download using above link and then install on your machine.
You can check the version of node.js using “node --version” command using command
line.
Sk@DESKTOP-BVFD1D1 MINGW64 ~
$ node --version
v12.13.1
3. Once you are ready, and in the directory into which you will install the Fabric Samples
and binaries, go ahead and execute the command to pull down the binaries and images.
4. If you get an error running the above curl command, you may have too old a version of
curl that does not handle redirects or an unsupported environment.
Please visit the Prerequisites page for additional information on where to find the latest ver-
sion of curl and get the right environment. Alternately, you can substitute the un-shortened
URL: https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh
The command above downloads and executes a bash script that will download and extract all
of the platform-specific binaries you will need to set up your network and place them into the
cloned repo you created above. It retrieves the following platform-specific binaries:
configtxgen ,
configtxlator ,
cryptogen ,
discover ,
idemixgen
orderer ,
peer ,
fabric-ca-client
5. On Windows 10 you should use the native Docker distribution and you may use the Win-
dows PowerShell. However, for the binaries command to succeed you will still need to
have the uname command available. You can get it as part of Git but beware that only the
64bit version is supported.
The curl command that comes with Git and Docker Toolbox is old and does not handle properly
the redirect used in Getting Started. Make sure you have and use a newer version which can be
downloaded from the cURL downloads page
For Node.js you also need the necessary Visual Studio C++ Build Tools which are freely avail-
able and can be installed with the following command:
The network is meant to be used only as a tool for education and testing. It should not be used as
a template for deploying a production network. The test network is being introduced in Fabric
v2.0 as the long term replacement for the first-network sample.
Before you can run the test network, you need to clone the fabric-samples repository and down-
load the Fabric images. Make sure that that you have installe the Prerequisites and Installed the
Samples, Binaries and Docker Images.
cd fabric-samples/test-network
./network.sh down
You can then bring up the network by issuing the following command. You will
experience problems if you try to run the script from another directory:
./network.sh up
2. Creating a channel
Now that we have peer and orderer nodes running on our machine, we can use the
script to create a Fabric channel for transactions between Org1 and Org2. Channels
are a private layer of communication between specific network members. Channels
can be used only by organizations that are invited to the channel, and are invisible to
other members of the network.
./network.sh createChannel
If the command was successful, you can see the following message printed in
your logs:
After you have used the network.sh to create a channel, you can start a chaincode
on the channel using the following command:
./network.sh deployCC
4. Bring down the network
When you are finished using the test network, you can bring down the network
with the following command:
./network.sh down
The command will stop and remove the node and chaincode containers, delete the
organization crypto material, and remove the chaincode images from your Docker
Registry. The command also removes the channel artifacts and docker volumes
from previous runs, allowing you to run ./network.sh up again if you encountered
any problems.
If you are interested in learning more about the sample network, you can investigate the files and
scripts in the test-network directory. The steps below provide a guided tour of what happens
when you issue the command of ./network.sh up .
./network. sh creates the certificates and keys for two peer organizations and the orderer or-
ganization. By default, the script uses the cryptogen tool using the configuration files located
in the organizations/cryptogen folder. If you use the -ca flag to create Certificate Authori-
ties, the script uses Fabric CA server configuration files and registerEnroll.sh script lo-
cated in the organizations/fabric-ca folder. Both cryptogen and the Fabric CAs create the
crypto material and MSP folders for all three organizations in the organizations folder.
The script uses configtxgen tool to create the system channel genesis block. Configtxgen
consumes the TwoOrgsOrdererGenesis channel profile in the configtx/configtx.yaml file to
create the genesis block. The block is stored in the system-genesis-block folder.
Once the organization crypto material and the system channel genesis block have been gener-
ated, the network.sh can bring up the nodes of the netwowrk. The script uses the docker-
compose-test-net.yaml file in the docker folder to create the peer and orderer nodes.
The docker folder also contains the docker-compose-e2e.yaml file that brings up the nodes
of the network alongside three Fabric CAs. This file is meant to be used to run end-to-end
tests by the Fabric SDK. Refer to the Node SDK repo for details on running these tests.
If you use the createChannel subcommand, ./network.sh runs the createChannel.sh script
in the scripts folder to create a channel using the supplied channel name. The script uses
the configtx.yaml file to create the channel creation transaction, as well as two anchor peer
update transactions. The script uses the peer cli to create the channel, join peer0.org1.exam -
ple.com and peer0.org2.example.com to the channel, and make both of the peers anchor
peers.
If you issue the deployCC command, ./network.sh runs the deployCC.sh script to install
the fabcar chaincode on both peers and then define then chaincode on the channel. Once the
chaincode definition is committed to the channel, the peer cli initializes the chainocde using
the Init and invokes the chaincode to put initial data on the ledger.