Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Tip

Step - by - step guide on how to Install Insights Enterprise - Hyperledger Fabric Network.

Installing Hyperledger Network covers the initial setup procedures including InstallationConfigurations (Hardware, Software, and Network) and various Commands.  Please note that these instructions are only for Linux (Debian & Ubuntu).

Prerequisites


Expand
titleHardware Configuration



Hyperledger Fabric Minimum configuration - Pilot/POC
No. of instances1
OSUbuntu 16.04 Xenial (64bit) 
Storage75 GB (Fabric Network Only)
Mem (GiB)8 GB
vCPU2




Hyperledger Fabric Minimum configuration - Production
No. of instances1
OSUbuntu 16.04 Xenial (64bit) 
Storage100 GB (Fabric Network Only)
Mem (GiB)16 GB
vCPU4


Note
Configuration varies depending on the work load.



Expand
titleSoftware
  • Docker 17.06.2-ce or greater, Docker Compose  1.14.0 or greater , curl
  • Go 1.11.x
  • Python 3.x
  • Node.js Runtime 8.x and NPM 5.x
  • git (git bash to clone the repo)

Refer the link to know the Software component version for latest fabric network: https://hyperledger-fabric.readthedocs.io/en/latest/prereqs.html

Fabric Version Specific. Change the version in the URL for other versions: https://hyperledger-fabric.readthedocs.io/en/release-1.4/prereqs.html

Docker, Docker Compose and curl

  1. apt-get update
  2. apt-get install apt-transport-https ca-certificates curl software-properties-common
  3. curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  4. add-apt-repository \
       "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
       $(lsb_release -cs) \
       stable"
  5. apt-get udpate
  6. apt-get install docker.io
  7. apt-get install docker-ce
  8. systemctl status docker

Reference: https://docs.docker.com/install/linux/docker-ce/ubuntu/

GO

  1. Download the archive: wget https://dl.google.com/go/go1.11.10.linux-amd64.tar.gz
  2. Extract it into /usr/local, creating a Go tree in /usr/local/go
  3. tar -C /usr/local -xzf go1.11.10.linux-amd64.tar.gz
  4. Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.bashprofile:                  export PATH=$PATH:/usr/local/go/bin
    Reference - Section Linux :https://golang.org/doc/install#install

Python

As of Ubuntu 16.04 LTS (xenial),  both python 2 and python3 by default. Recommended to use python3. Check and then install if required.

  1. apt-get install python3.5
  2. apt-get install python3-pip

set alias to respectiive python version in ~/.bashrc to avoid error while installing the module.

alias pip=pip3

alias python=python3.5

Reference: https://wiki.ubuntu.com/Python

Node.js Runtime and NPM
The recommended versions for node and npm are Node 8.x.x and npm5.x.x. If you are getting lower versions using apt-get install, remove existing node setup from your machine and then run the following:

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
apt-get install nodejs

Git

As Of Ubuntu, git is available by default. Check and then install if required.

  1. apt-get update
  2. apt-get install git

                                 


Expand
titleRecommended Network Ports

Following port must be opened to access the fabric network from fabric sdk.

Source : fabric sdk instance

Destination: fabric network installed instance

Example Ports: You can change these ports based on availability and configuration in fabric network. Then, enable connectivity to those ports.

  • Orderer - 7050 
  • Peer0.Org1 - 7051
  • EventHub : 7053
  • ca.org1 : 7054


Please browse through the below sections to setup specific Fabric Network

Panel
titleTypes of Hyperledger Fabric Network

Different types of hyperledger fabric network


Expand
titleSOLO Orderer

Make sure you've done all the Prerequisites 

Network Architecture

  • 1 Orderer
  • 1 Organization
  • 3 peers
  • 3 couchdb for each peer
  • 1 ca
  • 1 cli (Optional)

Clone from GitHub

  1. git clone of Solo Orderer Network:    git clone -b SoloOrdererNetwork https://github.com/TheCognizantFoundry/Insights.git
  2. cd hyperledger-fabric-basic-network
  3. Configuration: Values like DOMAIN, CHANNEL_NAME, FABRIC_VERSION, TIME_ZONE,etc ... can be modified in .env file based on your requirement.
  4. Start network for the first time. 

    network.sh - Generate the crypto-material, start/stop/restart the network.

    ./network.sh -m download

    ./network.sh -m up
  5. Start for the first time:

  6. Start/Stop the Network :

     ./network.sh -m start./network.sh -m stop
  7. Recreate the containers without losing the data.

     ./network.sh -m recreate
  8. Clean and Remove the Network.

     ./network.sh -m down
  9. Verify if all the docker containers are running

    docker ps
  10. Create and Join channel in Anchor peer - peer0.org1:  

      Get into peer0.org1 container: docker exec -it peer0.org1.<DOMAIN> bash

      Create: peer channel create -o orderer0.<DOMAIN>:7050 -c mychannel -f /var/hyperledger/configs/channel.tx


      Join: peer channel join -o orderer0.<DOMAIN> -b mychannel.block
  11. Fetch the block and join channel in other peers: 

    Get into peer0.org1 container: docker exec -it peer0.org1.<DOMAIN> bash


    Fetch block: peer channel fetch 0 mychannel.block --channelID mychannel --orderer orderer0.<DOMAIN>:7050

    Join channel: peer channel join -o orderer0.<DOMAIN> -b mychannel.block

  12. Install,Instantiate the chaincode in Anchor peer - peer0. Get into respective peer containers and use the below install command to install chaincode in other peers.

      Get into peer0.org1 container: docker exec -it peer0.org1.<DOMAIN> bash

      Install: peer chaincode install -n insightsAuditing -p /chaincode/src/node/js -l node -v 1.0

      Instantiate: peer chaincode instantiate -n insightsAuditing -v 1.0 -c '{"Args":["init"]}' -C mychannel

  13. Get into ca container. Create user to connect from fabric sdk by using admin. Fabric sdk network connection requires the user's cert details to get connected to the fabric network.

    docker exec -it ca.org1.<DOMAIN> bash

    fabric-ca-client enroll -u http://Admin:<password>@localhost:7054

    fabric-ca-client register -u "http://localhost:7054" --id.name "newusername" --id.secret "password" --id.type "client" --id.affiliation "org1.department1"

    fabric-ca-client enroll -u "http://newusername:password@localhost:7054"

  14. Test the Chaincode. Either insert record manually or let the data gets inserted via PlatformAuditEngine. Then, query as shown below. Modify ASSET-ID with your Asset ID value.

      Query: peer chaincode query -n insightsAuditing -c '{"Args":["GetAssetDetails","ASSET-ID"]}' -C mychannel



Expand
titleKafka Fabric Network

Make sure you've done all the Prerequisites 

Network Architecture

  • 3 Orderers
  • 2 Organizations
  • 4 peers, 2 for each organization
  • 4 couchdb for each peer
  • 2 ca, 1 for each organization
  • 4 Kafka broker instances
  • 3 Zookeper instances
  • 1 cli (Optional)

Clone from GitHub

  1. Set the GOPATH. You can do this by adding this line to your /etc/environment (for a system-wide installation) or $HOME/.bashprofile : export GOPATH=/opt/gopath Source if you set this in the same linux sesison then, source /etc/environment (OR)  source $HOME/.bashprofile
  2. Keep the hyperledger fabric source under GOPATH. 
    cd $GOPATH/src/github.com/
    mkdir hyperledger
    cd hyperledger
    git clone https://github.com/hyperledger/fabric.git

  3. git clone of Kafka Fabric Network:   git clone -b KafkaFabricNetwork https://github.com/TheCognizantFoundry/Insights.git
  4. cd Hyperledger_fabric_kafka
  5. Configuration: Values like DOMAIN, CORE_PEER configs,etc ... can be modified in .env file based on your requirement.
  6. chmod 777 *.sh
  7. Generate the crypto-material. Input arguments to generate.sh are channelname and domain name : 

    ./generate.sh <channelname> <DOMAIN>

    For Example: ./generate.sh mychannel cogdevops.com
  8. Start/Restart the Network :

    ./start.sh
  9. Verify if all the docker containers are running

    docker ps
  10. Create and Join channel in Anchor peer - peer0.org1:  

      Get into peer0.org1 container: docker exec -it peer0.org1.<DOMAIN> bash

      Create: peer channel create -o orderer0.<DOMAIN>:7050 -c mychannel -f /var/hyperledger/configs/channel.tx


      Join channel: peer channel join -o orderer0.<DOMAIN> -b mychannel.block
  11. Fetch the block and join channel in other peers: 

    Get into peer0.org1 container: docker exec -it peer0.org1.<DOMAIN> bash


    Fetch block: peer channel fetch 0 mychannel.block --channelID mychannel --orderer orderer0.<DOMAIN>:7050

    Join: peer channel join -o orderer0.<DOMAIN> -b mychannel.block

  12. Install,Instantiate the chaincode in Anchor peer - peer0. Get into respective peer containers and use the below install command to install chaincode in other peers.

      Get into peer0.org1 container: docker exec -it peer0.org1.<DOMAIN> bash

      Install: peer chaincode install -n insightsAuditing -p /chaincode/src/nodejs -l node -v 1.0

      Instantiate: peer chaincode instantiate -n insightsAuditing -v 1.0 -c '{"Args":["init"]}' -C mychannel

  13. Get into ca container. Create user to connect from fabric sdk by using admin. Fabric sdk network connection requires the user's cert details to get connected to the fabric network.

    docker exec -it ca.org1.<DOMAIN> bash

    fabric-ca-client enroll -u http://Admin:<password>@localhost:7054

    fabric-ca-client register -u "http://localhost:7054" --id.name "newusername" --id.secret "password" --id.type "client" --id.affiliation "org1.department1"

    fabric-ca-client enroll -u "http://newusername:password@localhost:7054"

  14. Test the Chaincode. Either insert record manually or let the data gets inserted via PlatformAuditEngine. Then, query as shown below. Modify ASSET-ID with your Asset ID value.

      Query: peer chaincode query -n insightsAuditing -c '{"Args":["GetAssetDetails","ASSET-ID"]}' -C mychannel



Expand
titleRaft (etcd/raft) Fabric Network

Raft (etcd/raft) Fabric Network


Note
Configuration varies depending on the work load.





...