Deploying Hyperledger Business Networks in Centos 7 with Composer

Clone Steven Perry's Project, Build, Deploy, and Start a Business Network

$ cd $HOME/projects/hlf
$ git clone https://github.com/makotogo/developerWorks.git

Use the Node.js package manager (npm) to build the business network.

[kiat@emgsdev iot-perishable-network]$ npm install

Deploy the business network with composer network install:

[kiat@emgsdev iot-perishable-network]$ composer network install -a dist/iot-perishable-network.bna -c PeerAdmin@hlfv1
✔ Installing business network. This may take a minute...
Succes...

Hyperledger Composer Playground

Playground is an environment that lets you quickly build and test blockchain business networks. It doesn't need a running blockchain network, and so it reduces the complexity of getting a business network defined, validated, and tested.

Interactive Mode

This starts Docker interactively. I like to run Playground like this so I can see what gets logged to STDOUT.

In WSL Ubuntu terminal:

docker run --name composer-playground --publish 8080:8080 hyperledger/composer-playground

where

  • docker run runs the docker image
  • `--na...

$'\r': command not foundUntitled note

In VS Code, at the bottom, status bar, locate CRLF, click on it and set it to LF, then save the .sh file.

Hyperledger Fabric in Windows 10 WSL

Install WSL, Ubuntu, Docker

Install WSL Ubuntu, see instructions here

Note: important to choose Ubuntu as this will make installing Fabric much easier.

Install Docker, see instructions here

All instructions are issued in WSL Ubuntu terminal.

Install Golang

Use a helper script to install the latest Golang in $HOME:

$ cd
$ git clone https://github.com/udhos/update-golang
$ cd update-golang
$ sudo...

Conflict with The PHP Package Repository - Composer

Windows 10 Git Bash

$ ./createPeerAdminCard.sh
Development only script for Hyperledger Fabric control
Running 'createPeerAdminCard.sh'
FABRIC_VERSION is set to 'hlfv12'
FABRIC_START_TIMEOUT is unset, assuming 15 (seconds)

Cannot use Composer version 1.5.2 2017-09-11 16:59:25 
version of composer with fabric 1.2, v0.20 or higher is 
required

To find out the dir of the conflicting composer:

$ which composer
/c/ProgramData/ComposerSetup/bin/composer

To resolve the conflict, add 2 lines in C:\Users\kiat.bashrc

alias co...

ERROR: Mount denied: The source path "\\\\var\\\\run:/host/var/run/" is not a valid Windows path'

Windows 10

ERROR: for peer0.org2.example.com Cannot create container for service peer0.org2.example.com: Mount denied:
The source path "\\var\\run:/host/var/run/" is not a valid Windows path'

Solution:
Locate the .env file and add this at the bottom

COMPOSE_CONVERT_WINDOWS_PATHS=1

This is to instruct Docker Compose to convert windows path from linux.

Alternatively:

in Power Shell: $Env:COMPOSE_CONVERT_WINDOWS_PATHS=1

then in Git Bash: export COMPOSE_CONVERT_WINDOWS_PATHS=1 and
export MSYS_NO_PATHCONV=1

Card Trading Blockchain

d:\Work\Fabric>npm install -g composer-cli
C:\Users\kiat\AppData\Roaming\npm\composer -> C:\Users\kiat\AppData\Roaming\npm\node_modules\composer-cli\cli.js

> dtrace-provider@0.8.7 install C:\Users\kiat\AppData\Roaming\npm\node_modules\composer-cli\node_modules\dtrace-provider
> node-gyp rebuild || node suppress-error.js


C:\Users\kiat\AppData\Roaming\npm\node_modules\composer-cli\node_modules\dtrace-provider>if not defined npm_config_node_gyp (node "C:\Users\kiat\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-...

2. Install Hyperledger Fabric Client SDK for Node.js

d:\Work\Fabric>npm install -g gulp
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN notice [SECURITY] lodash has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=lodash&version=1.0.2 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN deprecated graceful-f...

1. Install Samples, Binaries and Docker Images

Installed the following

  1. cURL ver 7.61.1
  2. Docker ver 18.06.1-ce-win73 (19507)
  3. Go ver go1.11.1 windows/amd64
  4. Node.js ver 8.9.1
  5. npm install npm@5.6.0 -g
  6. Python ver 2.7
  7. git config --global core.autocrlf false git config --global core.longpaths true
  8. Be patient, this took more than 10 minutes: npm install --global windows-build-tools
  9. npm install --global grpc

PowerShell:

PS D:\Work\Fabric> curl https://github.com/hyperledger/fabric/blob/master/scripts/bootstrap.sh | bash -s 1.2.1
curl : The request wa...