How to Install Hyperledger Fabric 2.0 in Ubuntu 18.04

Hyperledger Fabric is a consortium blockchain system. It’s performance is relatively good and its modular architecture enables it to be usable in many scenarios. Hyperledger Fabric itself has rich documents and samples of test networks. For beginners, deploying a new network for trying and testing still consumes quite some time. In this post, we will provide a script specifically for deploying Hyperledger Fabric 2.0.0 on Ubuntu 18.04. The goal is to help beginners quickly set up an environment that is running and usable through running a single scripts instead of configuring a group of tools/packages with many steps.

The script to install Hyperledger Fabric 2.0 on Ubuntu 18.04

You can get the script install-hyperledger-fabric-2-ubuntu-18.04.sh. Another script install-go.sh is needed in the same repository that installs go 1.13.9.

Install Hyperledger Fabric 2.0

Following these steps in a Ubuntu 18.04 Linux under a user that can sudo.

$ git clone https://github.com/zma/usefulscripts
$ cd usefulscripts && git checkout git checkout 0088716ce8b649652150672b8ccdc6beb42d4aa5
$ script/install-hyperledger-fabric-2-ubuntu-18.04.sh

That’s it! It will install the needed packages, deploy Hyperledger Fabric 2.0.0 for you. If you see a message as follows, you have a good and running Hyperledger Fabric 2.0 network.

**** Congratulations! ****
Your Hyperledger Fabric 2.0.0 test network with channel mychannel and chaincode fabcar is ready. Enjoy.

To shutdown the network, first logout and then login again, then run:
cd /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network && ./network.sh down

(a full STDOUT output is at the later part of this post for reference)

What’s next?

You can continue the test-network tutorial by trying more Fabric commands/tools.

Step by step explanation of what the script does

The script sets up the test-network environment following the fabric-sample tutorial.

Following are the steps the scripts does.

First, it installs Go 1.13.9 using the install-go.sh script.

Then, it adds lines to ~/.bashrc following Fabric’s requirement that the $GOPATH must be set with only one path.

  echo 'export GOPATH=$HOME/go' >> ~/.bashrc
  echo 'export PATH=$GOPATH/bin:$PATH' >> ~/.bashrc

Then, it installs the packages needed.

sudo apt install git curl wget docker docker-compose nodejs npm
sudo npm install npm@5.6.0 -g
sudo usermod -aG docker $USER

Then, it prints the versions out as a reference.

docker --version
docker-compose --version
npm --version
go version

Then, it uses the Fabric’s bootstrap.sh script to install the binaries and docker images.

sg docker -c "curl -sSL https://bit.ly/2ysbOFE | bash -s -- 2.0.0 1.4.6 0.4.18 -s"

Then, it use the test-network scripts from fabric-samples to set up one network.

sg docker -c "./network.sh up"

Then, it create a channel named mychannel.

sg docker -c "./network.sh createChannel -c mychannel"

Last, it deploys a go chaincode fabcar.

sg docker -c "./network.sh deployCC -l go"

Appendix: an example of script execution’s STDOUT

A full execution STDOUT is as follows for reference.

ericma@ubuntu18-04:~$ git clone https://github.com/zma/usefulscripts
Cloning into 'usefulscripts'...
remote: Enumerating objects: 142, done.
remote: Counting objects: 100% (142/142), done.
remote: Compressing objects: 100% (98/98), done.
remote: Total 545 (delta 80), reused 78 (delta 44), pack-reused 403
Receiving objects: 100% (545/545), 109.59 KiB | 233.00 KiB/s, done.
Resolving deltas: 100% (306/306), done.
ericma@ubuntu18-04:~$ cd usefulscripts/
ericma@ubuntu18-04:~/usefulscripts$ git checkout 0088716ce8b649652150672b8ccdc6beb42d4aa5
Note: checking out '0088716ce8b649652150672b8ccdc6beb42d4aa5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 2fc9fda install-go avoid name collision
ericma@ubuntu18-04:~/usefulscripts$ ./script/install-hyperledger-fabric-2-ubuntu-18.04.sh ^C
ericma@ubuntu18-04:~/usefulscripts$ script/install-hyperledger-fabric-2-ubuntu-18.04.sh

Set up Go 1.13.9 ...
--2020-04-07 17:08:05--  https://dl.google.com/go/go1.13.9.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)... 172.217.26.142, 2404:6800:4005:808::200e
Connecting to dl.google.com (dl.google.com)|172.217.26.142|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 120139686 (115M) [application/octet-stream]
Saving to: ‘go1.13.9.linux-amd64.tar.gz’

go1.13.9.linux-amd64.tar.gz         100%[================================================================>] 114.57M  7.13MB/s    in 66s     

2020-04-07 17:09:12 (1.73 MB/s) - ‘go1.13.9.linux-amd64.tar.gz’ saved [120139686/120139686]

[sudo] password for ericma: 
export GOROOT=/usr/local/go-1.13

export PATH=$GOROOT/bin:$PATH
Installed Go 1.13. You can now logout and login again to verify.

Installa packages ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version (7.58.0-2ubuntu3.8).
curl set to manually installed.
git is already the newest version (1:2.17.1-1ubuntu0.5).
git set to manually installed.
wget is already the newest version (1.19.4-1ubuntu2.2).
wget set to manually installed.
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu bridge-utils build-essential cgroupfs-mount containerd cpp cpp-7 docker.io dpkg-dev
  fakeroot g++ g++-7 gcc gcc-7 gcc-7-base golang-docker-credential-helpers gyp javascript-common libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libbinutils libc-ares2 libc-dev-bin libc6-dev libcc1-0 libcilkrts5
  libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-7-dev libgomp1 libhttp-parser2.7.1 libisl19 libitm1 libjs-async libjs-inherits
  libjs-jquery libjs-node-uuid libjs-underscore liblsan0 libmpc3 libmpx2 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib
  libquadmath0 libsecret-1-0 libsecret-common libssl1.0-dev libstdc++-7-dev libtsan0 libubsan0 libuv1-dev linux-libc-dev make manpages-dev
  node-abbrev node-ansi node-ansi-color-table node-archy node-async node-balanced-match node-block-stream node-brace-expansion
  node-builtin-modules node-combined-stream node-concat-map node-cookie-jar node-delayed-stream node-forever-agent node-form-data
  node-fs.realpath node-fstream node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-gyp node-hosted-git-info
  node-inflight node-inherits node-ini node-is-builtin-module node-isexe node-json-stringify-safe node-lockfile node-lru-cache node-mime
  node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv
  node-path-is-absolute node-pseudomap node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha
  node-slide node-spdx-correct node-spdx-expression-parse node-spdx-license-ids node-tar node-tunnel-agent node-underscore
  node-validate-npm-package-license node-which node-wrappy node-yallist nodejs-dev nodejs-doc pigz python python-asn1crypto
  python-backports.ssl-match-hostname python-cached-property python-certifi python-cffi-backend python-chardet python-cryptography
  python-docker python-dockerpty python-dockerpycreds python-docopt python-enum34 python-funcsigs python-functools32 python-idna
  python-ipaddress python-jsonschema python-minimal python-mock python-openssl python-pbr python-pkg-resources python-requests python-six
  python-texttable python-urllib3 python-websocket python-yaml python2.7 python2.7-minimal runc ubuntu-fan
Suggested packages:
  binutils-doc ifupdown cpp-doc gcc-7-locales aufs-tools debootstrap docker-doc rinse zfs-fuse | zfsutils debian-keyring g++-multilib
  g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib autoconf automake libtool flex bison gdb gcc-doc gcc-7-multilib libgcc1-dbg
  libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg
  apache2 | lighttpd | httpd glibc-doc bzr libstdc++-7-doc make-doc node-hawk node-aws-sign node-oauth-sign node-http-signature debhelper
  python-doc python-tk python-cryptography-doc python-cryptography-vectors python-enum34-doc python-funcsigs-doc python-mock-doc
  python-openssl-doc python-openssl-dbg python-setuptools python-socks python-ntlm python2.7-doc binfmt-support
The following NEW packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu bridge-utils build-essential cgroupfs-mount containerd cpp cpp-7 docker docker-compose
  docker.io dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base golang-docker-credential-helpers gyp javascript-common libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libbinutils libc-ares2 libc-dev-bin libc6-dev libcc1-0 libcilkrts5
  libdpkg-perl libfakeroot libfile-fcntllock-perl libgcc-7-dev libgomp1 libhttp-parser2.7.1 libisl19 libitm1 libjs-async libjs-inherits
  libjs-jquery libjs-node-uuid libjs-underscore liblsan0 libmpc3 libmpx2 libpython-stdlib libpython2.7-minimal libpython2.7-stdlib
  libquadmath0 libsecret-1-0 libsecret-common libssl1.0-dev libstdc++-7-dev libtsan0 libubsan0 libuv1-dev linux-libc-dev make manpages-dev
  node-abbrev node-ansi node-ansi-color-table node-archy node-async node-balanced-match node-block-stream node-brace-expansion
  node-builtin-modules node-combined-stream node-concat-map node-cookie-jar node-delayed-stream node-forever-agent node-form-data
  node-fs.realpath node-fstream node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-gyp node-hosted-git-info
  node-inflight node-inherits node-ini node-is-builtin-module node-isexe node-json-stringify-safe node-lockfile node-lru-cache node-mime
  node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt node-normalize-package-data node-npmlog node-once node-osenv
  node-path-is-absolute node-pseudomap node-qs node-read node-read-package-json node-request node-retry node-rimraf node-semver node-sha
  node-slide node-spdx-correct node-spdx-expression-parse node-spdx-license-ids node-tar node-tunnel-agent node-underscore
  node-validate-npm-package-license node-which node-wrappy node-yallist nodejs nodejs-dev nodejs-doc npm pigz python python-asn1crypto
  python-backports.ssl-match-hostname python-cached-property python-certifi python-cffi-backend python-chardet python-cryptography
  python-docker python-dockerpty python-dockerpycreds python-docopt python-enum34 python-funcsigs python-functools32 python-idna
  python-ipaddress python-jsonschema python-minimal python-mock python-openssl python-pbr python-pkg-resources python-requests python-six
  python-texttable python-urllib3 python-websocket python-yaml python2.7 python2.7-minimal runc ubuntu-fan
0 upgraded, 163 newly installed, 0 to remove and 21 not upgraded.
Need to get 123 MB of archives.
After this operation, 560 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
...
Setting up libquadmath0:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up libgomp1:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up libjs-jquery (3.2.1-1) ...
Setting up libatomic1:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up nodejs-doc (8.10.0~dfsg-2ubuntu0.4) ...
Setting up libsecret-common (0.18.6-1) ...
Setting up libhttp-parser2.7.1:amd64 (2.7.1-2) ...
Setting up libcc1-0:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up make (4.1-9.1ubuntu1) ...
Setting up libjs-node-uuid (1.4.7-5) ...
Setting up libjs-underscore (1.8.3~dfsg-1) ...
Setting up runc (1.0.0~rc10-0ubuntu1~18.04.2) ...
Setting up libjs-inherits (2.0.3-1) ...
Setting up libtsan0:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up linux-libc-dev:amd64 (4.15.0-96.97) ...
Setting up libdpkg-perl (1.19.0.5ubuntu2.3) ...
Setting up libssl1.0-dev:amd64 (1.0.2n-1ubuntu5.3) ...
Setting up cgroupfs-mount (1.4) ...
Setting up containerd (1.3.3-0ubuntu1~18.04.2) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up bridge-utils (1.5-15ubuntu1) ...
Setting up liblsan0:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up gcc-7-base:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up binutils-common:amd64 (2.30-21ubuntu1~18.04.2) ...
Setting up libfile-fcntllock-perl (0.22-3build2) ...
Setting up libmpx2:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up ubuntu-fan (0.12.10) ...
Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-fan.service → /lib/systemd/system/ubuntu-fan.service.
Setting up libfakeroot:amd64 (1.22-2ubuntu1) ...
Setting up libalgorithm-diff-perl (1.19.03-1) ...
Setting up libmpc3:amd64 (1.1.0-1) ...
Setting up libc-dev-bin (2.27-3ubuntu1) ...
Setting up javascript-common (11) ...
Setting up libjs-async (0.8.0-3) ...
Setting up manpages-dev (4.15-1) ...
Setting up libsecret-1-0:amd64 (0.18.6-1) ...
Setting up libc6-dev:amd64 (2.27-3ubuntu1) ...
Setting up docker (1.5-1build1) ...
Setting up pigz (2.4-1) ...
Setting up libc-ares2:amd64 (1.14.0-1) ...
Setting up libitm1:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up libpython2.7-stdlib:amd64 (2.7.17-1~18.04) ...
Setting up libuv1-dev:amd64 (1.18.0-3) ...
Setting up libisl19:amd64 (0.19-1) ...
Setting up docker.io (19.03.6-0ubuntu1~18.04.1) ...
Adding group `docker' (GID 113) ...
Done.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
docker.service is a disabled or a static unit, not starting it.
Setting up libasan4:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up nodejs (8.10.0~dfsg-2ubuntu0.4) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
Setting up libbinutils:amd64 (2.30-21ubuntu1~18.04.2) ...
Setting up node-balanced-match (0.4.2-1) ...
Setting up libcilkrts5:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up node-node-uuid (1.4.7-5) ...
Setting up node-yallist (2.0.0-1) ...
Setting up libubsan0:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up node-slide (1.1.6-1) ...
Setting up node-github-url-from-git (1.4.0-1) ...
Setting up node-pseudomap (1.0.2-1) ...
Setting up python2.7 (2.7.17-1~18.04) ...
Setting up node-spdx-license-ids (1.2.2-1) ...
Setting up node-wrappy (1.0.2-1) ...
Setting up node-mime (1.3.4-1) ...
Setting up fakeroot (1.22-2ubuntu1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up node-abbrev (1.0.9-1) ...
Setting up node-semver (5.4.1-1) ...
Setting up libgcc-7-dev:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up cpp-7 (7.5.0-3ubuntu1~18.04) ...
Setting up libstdc++-7-dev:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up node-retry (0.10.1-1) ...
Setting up libpython-stdlib:amd64 (2.7.15~rc1-1) ...
Setting up libalgorithm-merge-perl (0.08-3) ...
Setting up node-forever-agent (0.5.1-1) ...
Setting up node-underscore (1.8.3~dfsg-1) ...
Setting up libalgorithm-diff-xs-perl (0.04-5) ...
Setting up golang-docker-credential-helpers (0.5.0-2) ...
Setting up node-json-stringify-safe (5.0.0-1) ...
Setting up node-inherits (2.0.3-1) ...
Setting up node-graceful-fs (4.1.11-1) ...
Setting up node-archy (1.0.0-1ubuntu1) ...
Setting up node-path-is-absolute (1.0.0-1) ...
Setting up node-builtin-modules (1.1.1-1) ...
Setting up node-isexe (2.0.0-3) ...
Setting up node-spdx-correct (1.0.2-1) ...
Setting up node-async (0.8.0-3) ...
Setting up node-cookie-jar (0.3.1-1) ...
Setting up node-mute-stream (0.0.7-1) ...
Setting up node-concat-map (0.0.1-1) ...
Setting up node-ini (1.3.4-1) ...
Setting up node-mkdirp (0.5.1-1) ...
Setting up node-once (1.4.0-2ubuntu1) ...
Setting up python (2.7.15~rc1-1) ...
Setting up node-sha (1.2.3-1) ...
Setting up node-fs.realpath (1.0.0-1) ...
Setting up binutils-x86-64-linux-gnu (2.30-21ubuntu1~18.04.2) ...
Setting up node-lockfile (0.4.1-1) ...
Setting up node-brace-expansion (1.1.8-1) ...
Setting up python-idna (2.6-1) ...
Setting up node-spdx-expression-parse (1.0.4-1) ...
Setting up cpp (4:7.4.0-1ubuntu2.3) ...
Setting up node-qs (2.2.4-1ubuntu1) ...
Setting up python-texttable (0.9.1-1) ...
Setting up node-osenv (0.1.4-1) ...
Setting up node-ansi (0.3.0-2ubuntu1) ...
Setting up python-functools32 (3.2.3.2-3) ...
Setting up python-yaml (3.12-1build2) ...
Setting up node-is-builtin-module (1.0.0-1) ...
Setting up python-asn1crypto (0.24.0-1) ...
Setting up node-hosted-git-info (2.5.0-1) ...
Setting up node-delayed-stream (0.0.5-1) ...
Setting up node-tunnel-agent (0.3.1-1) ...
Setting up node-nopt (3.0.6-3) ...
Setting up node-which (1.3.0-1) ...
Setting up node-lru-cache (4.1.1-1) ...
Setting up python-certifi (2018.1.18-2) ...
Setting up node-combined-stream (0.0.5-1) ...
Setting up node-block-stream (0.0.9-1ubuntu1) ...
Setting up python-pkg-resources (39.0.1-2) ...
Setting up python-backports.ssl-match-hostname (3.5.0.1-1) ...
Setting up node-validate-npm-package-license (3.0.1-1) ...
Setting up node-inflight (1.0.6-1) ...
Setting up python-cffi-backend (1.11.5-1) ...
Setting up node-read (1.0.7-1) ...
Setting up python-six (1.11.0-2) ...
Setting up python-dockerpty (0.4.1-1) ...
Setting up gyp (0.1+20150913git1f374df9-1ubuntu1) ...
Setting up python-pbr (3.1.1-3ubuntu3) ...
update-alternatives: using /usr/bin/python2-pbr to provide /usr/bin/pbr (pbr) in auto mode
Setting up python-enum34 (1.1.6-2) ...
Setting up python-funcsigs (1.0.2-4) ...
Setting up binutils (2.30-21ubuntu1~18.04.2) ...
Setting up python-docopt (0.6.2-1build1) ...
Setting up python-ipaddress (1.0.17-1) ...
Setting up node-form-data (0.1.0-1) ...
Setting up node-request (2.26.1-1) ...
Setting up node-minimatch (3.0.4-3) ...
Setting up nodejs-dev (8.10.0~dfsg-2ubuntu0.4) ...
Setting up python-cached-property (1.3.1-1) ...
Setting up node-normalize-package-data (2.3.5-2) ...
Setting up node-ansi-color-table (1.0.0-1) ...
Setting up node-npmlog (0.0.4-1) ...
Setting up python-urllib3 (1.22-1ubuntu0.18.04.1) ...
Setting up python-chardet (3.0.4-1) ...
Setting up python-dockerpycreds (0.2.1-1) ...
Setting up gcc-7 (7.5.0-3ubuntu1~18.04) ...
Setting up g++-7 (7.5.0-3ubuntu1~18.04) ...
Setting up python-mock (2.0.0-3) ...
Setting up gcc (4:7.4.0-1ubuntu2.3) ...
Setting up node-glob (7.1.2-4) ...
Setting up python-websocket (0.44.0-0ubuntu2) ...
update-alternatives: using /usr/bin/python2-wsdump to provide /usr/bin/wsdump (wsdump) in auto mode
Setting up dpkg-dev (1.19.0.5ubuntu2.3) ...
Setting up python-cryptography (2.1.4-1ubuntu1.3) ...
Setting up python-requests (2.18.4-2ubuntu0.1) ...
Setting up g++ (4:7.4.0-1ubuntu2.3) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up python-jsonschema (2.6.0-2) ...
update-alternatives: using /usr/bin/python2-jsonschema to provide /usr/bin/jsonschema (jsonschema) in auto mode
Setting up python-openssl (17.5.0-1ubuntu1) ...
Setting up build-essential (12.4ubuntu1) ...
Setting up python-docker (2.5.1-1) ...
Setting up docker-compose (1.17.1-2) ...
Setting up node-rimraf (2.6.2-1) ...
Setting up node-read-package-json (1.2.4-1) ...
Setting up node-fstream (1.0.10-1ubuntu0.18.04.1) ...
Setting up node-fstream-ignore (0.0.6-2) ...
Setting up node-tar (2.2.1-1) ...
Setting up node-gyp (3.6.2-1ubuntu1) ...
Setting up npm (3.5.2-0ubuntu4) ...
...
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/lib
...
├─┬ npm@5.6.0 
...

Versions of software:
Docker version 19.03.6, build 369ce74a3c
docker-compose version 1.17.1, build unknown
5.6.0
go version go1.13.9 linux/amd64
package github.com/hyperledger/fabric-samples: no Go files in /home/ericma/go/src/github.com/hyperledger/fabric-samples
Note: checking out 'a026a4ffbfcf69f33a2a25cd71c5a776ca2fdda5'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at a026a4f Fixed typo (#90)

Install Hyperledger Fabric 2.0.0 binaries and coker images ...

Pull Hyperledger Fabric binaries

===> Downloading version 2.0.0 platform specific fabric binaries
===> Downloading:  https://github.com/hyperledger/fabric/releases/download/v2.0.0/hyperledger-fabric-linux-amd64-2.0.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   633  100   633    0     0    708      0 --:--:-- --:--:-- --:--:--   708
100 72.7M  100 72.7M    0     0  3984k      0  0:00:18  0:00:18 --:--:-- 5100k
==> Done.
===> Downloading version 1.4.6 platform specific fabric-ca-client binary
===> Downloading:  https://github.com/hyperledger/fabric-ca/releases/download/v1.4.6/hyperledger-fabric-ca-linux-amd64-1.4.6.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   636  100   636    0     0    711      0 --:--:-- --:--:-- --:--:--   710
100 23.3M  100 23.3M    0     0  3119k      0  0:00:07  0:00:07 --:--:-- 4928k
==> Done.

Pull Hyperledger Fabric docker images

FABRIC_IMAGES: peer orderer ccenv tools nodeenv baseos javaenv
===> Pulling fabric Images
====> hyperledger/fabric-peer:2.0.0
2.0.0: Pulling from hyperledger/fabric-peer
...
===> List out hyperledger docker images
hyperledger/fabric-ca          1.4                 3b96a893c1e4        5 weeks ago         150MB
hyperledger/fabric-ca          1.4.6               3b96a893c1e4        5 weeks ago         150MB
hyperledger/fabric-ca          latest              3b96a893c1e4        5 weeks ago         150MB
hyperledger/fabric-tools       2.0                 639ab50feac9        2 months ago        514MB
hyperledger/fabric-tools       2.0.0               639ab50feac9        2 months ago        514MB
hyperledger/fabric-tools       latest              639ab50feac9        2 months ago        514MB
hyperledger/fabric-peer        2.0                 5f8a6b13db9f        2 months ago        57.2MB
hyperledger/fabric-peer        2.0.0               5f8a6b13db9f        2 months ago        57.2MB
hyperledger/fabric-peer        latest              5f8a6b13db9f        2 months ago        57.2MB
hyperledger/fabric-orderer     2.0                 161632cc3c59        2 months ago        39.7MB
hyperledger/fabric-orderer     2.0.0               161632cc3c59        2 months ago        39.7MB
hyperledger/fabric-orderer     latest              161632cc3c59        2 months ago        39.7MB
hyperledger/fabric-ccenv       2.0                 6514ca872b68        2 months ago        529MB
hyperledger/fabric-ccenv       2.0.0               6514ca872b68        2 months ago        529MB
hyperledger/fabric-ccenv       latest              6514ca872b68        2 months ago        529MB
hyperledger/fabric-baseos      2.0                 50075bc26291        2 months ago        6.9MB
hyperledger/fabric-baseos      2.0.0               50075bc26291        2 months ago        6.9MB
hyperledger/fabric-baseos      latest              50075bc26291        2 months ago        6.9MB
hyperledger/fabric-javaenv     2.0                 ac433f4353e4        2 months ago        507MB
hyperledger/fabric-javaenv     2.0.0               ac433f4353e4        2 months ago        507MB
hyperledger/fabric-javaenv     latest              ac433f4353e4        2 months ago        507MB
hyperledger/fabric-nodeenv     2.0                 c7fe428889ec        2 months ago        274MB
hyperledger/fabric-nodeenv     2.0.0               c7fe428889ec        2 months ago        274MB
hyperledger/fabric-nodeenv     latest              c7fe428889ec        2 months ago        274MB
hyperledger/fabric-zookeeper   0.4                 ede9389347db        5 months ago        276MB
hyperledger/fabric-zookeeper   0.4.18              ede9389347db        5 months ago        276MB
hyperledger/fabric-zookeeper   latest              ede9389347db        5 months ago        276MB
hyperledger/fabric-kafka       0.4                 caaae0474ef2        5 months ago        270MB
hyperledger/fabric-kafka       0.4.18              caaae0474ef2        5 months ago        270MB
hyperledger/fabric-kafka       latest              caaae0474ef2        5 months ago        270MB
hyperledger/fabric-couchdb     0.4                 d369d4eaa0fd        5 months ago        261MB
hyperledger/fabric-couchdb     0.4.18              d369d4eaa0fd        5 months ago        261MB
hyperledger/fabric-couchdb     latest              d369d4eaa0fd        5 months ago        261MB
'bin/configtxgen' -> '/home/ericma/go/bin/configtxgen'
'bin/configtxlator' -> '/home/ericma/go/bin/configtxlator'
'bin/cryptogen' -> '/home/ericma/go/bin/cryptogen'
'bin/discover' -> '/home/ericma/go/bin/discover'
'bin/fabric-ca-client' -> '/home/ericma/go/bin/fabric-ca-client'
'bin/fabric-ca-server' -> '/home/ericma/go/bin/fabric-ca-server'
'bin/idemixgen' -> '/home/ericma/go/bin/idemixgen'
'bin/orderer' -> '/home/ericma/go/bin/orderer'
'bin/peer' -> '/home/ericma/go/bin/peer'

Now start test-network ...
Starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb' with crypto from 'cryptogen'

LOCAL_VERSION=2.0.0
DOCKER_IMAGE_VERSION=2.0.0
/home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/../bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################

##########################################################
############ Create Org1 Identities ######################
##########################################################
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org1.yaml --output=organizations
org1.example.com
+ res=0
+ set +x
##########################################################
############ Create Org2 Identities ######################
##########################################################
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-org2.yaml --output=organizations
org2.example.com
+ res=0
+ set +x
##########################################################
############ Create Orderer Org Identities ###############
##########################################################
+ cryptogen generate --config=./organizations/cryptogen/crypto-config-orderer.yaml --output=organizations
+ res=0
+ set +x

Generate CCP files for Org1 and Org2
/home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/../bin/configtxgen
#########  Generating Orderer Genesis block ##############
+ configtxgen -profile TwoOrgsOrdererGenesis -channelID system-channel -outputBlock ./system-genesis-block/genesis.block
2020-04-07 17:36:36.343 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-04-07 17:36:36.378 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 002 orderer type: etcdraft
2020-04-07 17:36:36.378 UTC [common.tools.configtxgen.localconfig] completeInitialization -> INFO 003 Orderer.EtcdRaft.Options unset, setting to tick_interval:"500ms" election_tick:10 heartbeat_tick:1 max_inflight_blocks:5 snapshot_interval_size:16777216 
2020-04-07 17:36:36.378 UTC [common.tools.configtxgen.localconfig] Load -> INFO 004 Loaded configuration: /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/configtx/configtx.yaml
2020-04-07 17:36:36.382 UTC [common.tools.configtxgen] doOutputBlock -> INFO 005 Generating genesis block
2020-04-07 17:36:36.383 UTC [common.tools.configtxgen] doOutputBlock -> INFO 006 Writing genesis block
+ res=0
+ set +x
Creating network "net_test" with the default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_peer0.org2.example.com" with default driver
Creating volume "net_orderer.example.com" with default driver
Creating peer0.org1.example.com ... 
Creating orderer.example.com ... 
Creating peer0.org2.example.com ... 
Creating peer0.org1.example.com
Creating peer0.org2.example.com
Creating peer0.org1.example.com ... done
CONTAINER ID        IMAGE                               COMMAND             CREATED             STATUS                  PORTS                              NAMES
4bc71ea46a7b        hyperledger/fabric-orderer:latest   "orderer"           5 seconds ago       Up 1 second             0.0.0.0:7050->7050/tcp             orderer.example.com
7ee825162895        hyperledger/fabric-peer:latest      "peer node start"   5 seconds ago       Up Less than a second   0.0.0.0:7051->7051/tcp             peer0.org1.example.com
b0ab9e02b101        hyperledger/fabric-peer:latest      "peer node start"   5 seconds ago       Up 2 seconds            7051/tcp, 0.0.0.0:9051->9051/tcp   peer0.org2.example.com

Congratulations! Your Hyperledger Fabric 2.0.0 test network is up.

Will create channel and register chaincode after a while...

Creating channel mychannel ...
Creating channel 'mychannel'.

If network is not up, starting nodes with CLI timeout of '5' tries and CLI delay of '3' seconds and using database 'leveldb 

### Generating channel configuration transaction 'mychannel.tx' ###
+ configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/mychannel.tx -channelID mychannel
2020-04-07 17:36:50.013 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-04-07 17:36:50.069 UTC [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/configtx/configtx.yaml
2020-04-07 17:36:50.069 UTC [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 003 Generating new channel configtx
2020-04-07 17:36:50.081 UTC [common.tools.configtxgen] doOutputChannelCreateTx -> INFO 004 Writing new channel tx
+ res=0
+ set +x

### Generating channel configuration transaction 'mychannel.tx' ###
#######    Generating anchor peer update for Org1MSP  ##########
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP
2020-04-07 17:36:50.139 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-04-07 17:36:50.189 UTC [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/configtx/configtx.yaml
2020-04-07 17:36:50.189 UTC [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2020-04-07 17:36:50.196 UTC [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
+ res=0
+ set +x

#######    Generating anchor peer update for Org2MSP  ##########
+ configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
2020-04-07 17:36:50.248 UTC [common.tools.configtxgen] main -> INFO 001 Loading configuration
2020-04-07 17:36:50.290 UTC [common.tools.configtxgen.localconfig] Load -> INFO 002 Loaded configuration: /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/configtx/configtx.yaml
2020-04-07 17:36:50.290 UTC [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 003 Generating anchor peer update
2020-04-07 17:36:50.292 UTC [common.tools.configtxgen] doOutputAnchorPeersUpdate -> INFO 004 Writing anchor peer update
+ res=0
+ set +x

Creating channel mychannel
+ peer channel create -o localhost:7050 -c mychannel --ordererTLSHostnameOverride orderer.example.com -f ./channel-artifacts/mychannel.tx --outputBlock ./channel-artifacts/mychannel.block --tls true --cafile /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-04-07 17:36:53.581 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-07 17:36:53.632 UTC [cli.common] readBlock -> INFO 002 Expect block, but got status: &{NOT_FOUND}
2020-04-07 17:36:53.635 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-04-07 17:36:53.845 UTC [cli.common] readBlock -> INFO 004 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-04-07 17:36:53.852 UTC [channelCmd] InitCmdFactory -> INFO 005 Endorser and orderer connections initialized
2020-04-07 17:36:54.054 UTC [cli.common] readBlock -> INFO 006 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-04-07 17:36:54.058 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2020-04-07 17:36:54.261 UTC [cli.common] readBlock -> INFO 008 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-04-07 17:36:54.265 UTC [channelCmd] InitCmdFactory -> INFO 009 Endorser and orderer connections initialized
2020-04-07 17:36:54.468 UTC [cli.common] readBlock -> INFO 00a Expect block, but got status: &{SERVICE_UNAVAILABLE}
2020-04-07 17:36:54.473 UTC [channelCmd] InitCmdFactory -> INFO 00b Endorser and orderer connections initialized
2020-04-07 17:36:54.681 UTC [cli.common] readBlock -> INFO 00c Received block: 0
===================== Channel 'mychannel' created ===================== 

Join Org1 peers to the channel...
+ peer channel join -b ./channel-artifacts/mychannel.block
+ res=0
+ set +x
2020-04-07 17:36:57.941 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-07 17:36:58.058 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel

Join Org2 peers to the channel...
+ peer channel join -b ./channel-artifacts/mychannel.block
+ res=0
+ set +x
2020-04-07 17:37:01.138 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-07 17:37:01.232 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel

Updating anchor peers for org1...
+ peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c mychannel -f ./channel-artifacts/Org1MSPanchors.tx --tls true --cafile /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-04-07 17:37:01.293 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-07 17:37:01.318 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org1MSP' on channel 'mychannel' ===================== 

Updating anchor peers for org2...
+ peer channel update -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --tls true --cafile /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
+ res=0
+ set +x
2020-04-07 17:37:04.442 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-07 17:37:04.456 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' ===================== 

========= Channel successfully joined =========== 

Create a chaincode in go ...
deploying chaincode on channel 'mychannel'

Vendoring Go dependencies ...
~/go/src/github.com/hyperledger/fabric-samples/chaincode/fabcar/go ~/go/src/github.com/hyperledger/fabric-samples/test-network
go: downloading github.com/hyperledger/fabric-contract-api-go v0.0.0-20191118113407-4c6ff12b4f96
go: extracting github.com/hyperledger/fabric-contract-api-go v0.0.0-20191118113407-4c6ff12b4f96
go: downloading github.com/xeipuuv/gojsonschema v1.2.0
go: downloading github.com/hyperledger/fabric-protos-go v0.0.0-20191114160927-6bee4929a99f
go: downloading github.com/hyperledger/fabric-chaincode-go v0.0.0-20191108205148-17c4b2760b56
go: downloading github.com/go-openapi/spec v0.19.4
go: downloading github.com/gobuffalo/packr v1.30.1
go: extracting github.com/xeipuuv/gojsonschema v1.2.0
go: extracting github.com/hyperledger/fabric-chaincode-go v0.0.0-20191108205148-17c4b2760b56
go: extracting github.com/gobuffalo/packr v1.30.1
go: extracting github.com/hyperledger/fabric-protos-go v0.0.0-20191114160927-6bee4929a99f
go: downloading google.golang.org/grpc v1.23.0
go: extracting github.com/go-openapi/spec v0.19.4
go: downloading github.com/gobuffalo/packd v0.3.0
go: downloading github.com/golang/protobuf v1.3.2
go: extracting github.com/gobuffalo/packd v0.3.0
go: extracting github.com/golang/protobuf v1.3.2
go: extracting google.golang.org/grpc v1.23.0
go: downloading golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
go: downloading github.com/go-openapi/swag v0.19.5
go: downloading github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
go: extracting github.com/go-openapi/swag v0.19.5
go: downloading google.golang.org/genproto v0.0.0-20180831171423-11092d34479b
go: extracting github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415
go: downloading github.com/gobuffalo/envy v1.7.0
go: downloading github.com/go-openapi/jsonreference v0.19.2
go: downloading golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542
go: downloading github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f
go: downloading github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e
go: extracting golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297
go: downloading gopkg.in/yaml.v2 v2.2.2
go: downloading github.com/go-openapi/jsonpointer v0.19.3
go: extracting github.com/go-openapi/jsonreference v0.19.2
go: extracting github.com/gobuffalo/envy v1.7.0
go: downloading github.com/rogpeppe/go-internal v1.3.0
go: downloading github.com/joho/godotenv v1.3.0
go: downloading golang.org/x/text v0.3.2
go: extracting github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f
go: extracting google.golang.org/genproto v0.0.0-20180831171423-11092d34479b
go: extracting github.com/go-openapi/jsonpointer v0.19.3
go: extracting gopkg.in/yaml.v2 v2.2.2
go: downloading github.com/PuerkitoBio/purell v1.1.1
go: extracting github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e
go: extracting github.com/joho/godotenv v1.3.0
go: extracting github.com/rogpeppe/go-internal v1.3.0
go: extracting golang.org/x/sys v0.0.0-20190710143415-6ec70d6a5542
go: extracting github.com/PuerkitoBio/purell v1.1.1
go: downloading github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
go: extracting golang.org/x/text v0.3.2
~/go/src/github.com/hyperledger/fabric-samples/test-network
Finished vendoring Go dependencies
++ peer lifecycle chaincode package fabcar.tar.gz --path ../chaincode/fabcar/go/ --lang golang --label fabcar_1
++ res=0
++ set +x
===================== Chaincode is packaged on peer0.org1 ===================== 

Installing chaincode on peer0.org1...
++ peer lifecycle chaincode install fabcar.tar.gz
++ res=0
++ set +x
2020-04-07 17:37:42.393 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nIfabcar_1:8b2412113ee33b4615f83b24636f442913c033049a2dc36f46fe4614b96ab1d3\022\010fabcar_1" > 
2020-04-07 17:37:42.393 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: fabcar_1:8b2412113ee33b4615f83b24636f442913c033049a2dc36f46fe4614b96ab1d3
===================== Chaincode is installed on peer0.org1 ===================== 

Install chaincode on peer0.org2...
++ peer lifecycle chaincode install fabcar.tar.gz
++ res=0
++ set +x
2020-04-07 17:37:59.033 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:<status:200 payload:"\nIfabcar_1:8b2412113ee33b4615f83b24636f442913c033049a2dc36f46fe4614b96ab1d3\022\010fabcar_1" > 
2020-04-07 17:37:59.033 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: fabcar_1:8b2412113ee33b4615f83b24636f442913c033049a2dc36f46fe4614b96ab1d3
===================== Chaincode is installed on peer0.org2 ===================== 

++ peer lifecycle chaincode queryinstalled
++ res=0
++ set +x
Installed chaincodes on peer:
Package ID: fabcar_1:8b2412113ee33b4615f83b24636f442913c033049a2dc36f46fe4614b96ab1d3, Label: fabcar_1
PackageID is fabcar_1:8b2412113ee33b4615f83b24636f442913c033049a2dc36f46fe4614b96ab1d3
===================== Query installed successful on peer0.org1 on channel ===================== 

++ peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls true --cafile /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID mychannel --name fabcar --version 1 --init-required --package-id fabcar_1:8b2412113ee33b4615f83b24636f442913c033049a2dc36f46fe4614b96ab1d3 --sequence 1
++ set +x
2020-04-07 17:38:01.388 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [28c997c2a6ba807117328c99abf86ba30cc644ac4b2fa13dc518a38de5e3e388] committed with status (VALID) at 
===================== Chaincode definition approved on peer0.org1 on channel 'mychannel' ===================== 

===================== Checking the commit readiness of the chaincode definition on peer0.org1 on channel 'mychannel'... ===================== 
Attempting to check the commit readiness of the chaincode definition on peer0.org1 secs
++ peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name fabcar --version 1 --sequence 1 --output json --init-required
++ res=0
++ set +x

{
    "approvals": {
        "Org1MSP": true,
        "Org2MSP": false
    }
}
===================== Checking the commit readiness of the chaincode definition successful on peer0.org1 on channel 'mychannel' ===================== 
===================== Checking the commit readiness of the chaincode definition on peer0.org2 on channel 'mychannel'... ===================== 
Attempting to check the commit readiness of the chaincode definition on peer0.org2 secs
++ peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name fabcar --version 1 --sequence 1 --output json --init-required
++ res=0
++ set +x

{
    "approvals": {
        "Org1MSP": true,
        "Org2MSP": false
    }
}
===================== Checking the commit readiness of the chaincode definition successful on peer0.org2 on channel 'mychannel' ===================== 
++ peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls true --cafile /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID mychannel --name fabcar --version 1 --init-required --package-id fabcar_1:8b2412113ee33b4615f83b24636f442913c033049a2dc36f46fe4614b96ab1d3 --sequence 1
++ set +x
2020-04-07 17:38:09.805 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [bd1cecbf598eb9b0f49d170d6ef095b99107b6ca7983e53a2b37f5a56e50d22e] committed with status (VALID) at 
===================== Chaincode definition approved on peer0.org2 on channel 'mychannel' ===================== 

===================== Checking the commit readiness of the chaincode definition on peer0.org1 on channel 'mychannel'... ===================== 
Attempting to check the commit readiness of the chaincode definition on peer0.org1 secs
++ peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name fabcar --version 1 --sequence 1 --output json --init-required
++ res=0
++ set +x

{
    "approvals": {
        "Org1MSP": true,
        "Org2MSP": true
    }
}
===================== Checking the commit readiness of the chaincode definition successful on peer0.org1 on channel 'mychannel' ===================== 
===================== Checking the commit readiness of the chaincode definition on peer0.org2 on channel 'mychannel'... ===================== 
Attempting to check the commit readiness of the chaincode definition on peer0.org2 secs
++ peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name fabcar --version 1 --sequence 1 --output json --init-required
++ res=0
++ set +x

{
    "approvals": {
        "Org1MSP": true,
        "Org2MSP": true
    }
}
===================== Checking the commit readiness of the chaincode definition successful on peer0.org2 on channel 'mychannel' ===================== 
++ peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls true --cafile /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --channelID mychannel --name fabcar --peerAddresses localhost:7051 --tlsRootCertFiles /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --version 1 --sequence 1 --init-required
++ res=0
++ set +x
2020-04-07 17:38:18.265 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [8e85e8ab6040469007adbd73ba26a95c52697b51441248502051bb47af6d276b] committed with status (VALID) at localhost:7051
2020-04-07 17:38:18.294 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [8e85e8ab6040469007adbd73ba26a95c52697b51441248502051bb47af6d276b] committed with status (VALID) at localhost:9051
===================== Chaincode definition committed on channel 'mychannel' ===================== 

===================== Querying chaincode definition on peer0.org1 on channel 'mychannel'... ===================== 

2020-04-07 17:38:18.265 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [8e85e8ab6040469007adbd73ba26a95c52697b51441248502051bb47af6d276b] committed with status (VALID) at localhost:7051
2020-04-07 17:38:18.294 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [8e85e8ab6040469007adbd73ba26a95c52697b51441248502051bb47af6d276b] committed with status (VALID) at localhost:9051
===================== Query chaincode definition successful on peer0.org1 on channel 'mychannel' ===================== 
===================== Querying chaincode definition on peer0.org2 on channel 'mychannel'... ===================== 
Attempting to Query committed status on peer0.org2, Retry after 3 seconds.
++ peer lifecycle chaincode querycommitted --channelID mychannel --name fabcar
++ res=0
++ set +x

Committed chaincode definition for chaincode 'fabcar' on channel 'mychannel':
Version: 1, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
===================== Query chaincode definition successful on peer0.org2 on channel 'mychannel' ===================== 
++ peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls true --cafile /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n fabcar --peerAddresses localhost:7051 --tlsRootCertFiles /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --isInit -c '{"function":"initLedger","Args":[]}'
++ res=0
++ set +x
2020-04-07 17:38:21.498 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 
===================== Invoke transaction successful on peer0.org1 peer0.org2 on channel 'mychannel' ===================== 

++ peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls true --cafile /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem -C mychannel -n fabcar --peerAddresses localhost:7051 --tlsRootCertFiles /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"function":"initLedger","Args":[]}'
++ res=0
++ set +x
2020-04-07 17:38:31.615 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 
===================== Invoke transaction successful on peer0.org1 peer0.org2 on channel 'mychannel' ===================== 

Querying chaincode on peer0.org1...
===================== Querying on peer0.org1 on channel 'mychannel'... ===================== 
Attempting to Query peer0.org1 ...1586281114 secs
++ peer chaincode query -C mychannel -n fabcar -c '{"Args":["queryAllCars"]}'
++ res=0
++ set +x

[{"Key":"CAR0","Record":{"make":"Toyota","model":"Prius","colour":"blue","owner":"Tomoko"}},{"Key":"CAR1","Record":{"make":"Ford","model":"Mustang","colour":"red","owner":"Brad"}},{"Key":"CAR2","Record":{"make":"Hyundai","model":"Tucson","colour":"green","owner":"Jin Soo"}},{"Key":"CAR3","Record":{"make":"Volkswagen","model":"Passat","colour":"yellow","owner":"Max"}},{"Key":"CAR4","Record":{"make":"Tesla","model":"S","colour":"black","owner":"Adriana"}},{"Key":"CAR5","Record":{"make":"Peugeot","model":"205","colour":"purple","owner":"Michel"}},{"Key":"CAR6","Record":{"make":"Chery","model":"S22L","colour":"white","owner":"Aarav"}},{"Key":"CAR7","Record":{"make":"Fiat","model":"Punto","colour":"violet","owner":"Pari"}},{"Key":"CAR8","Record":{"make":"Tata","model":"Nano","colour":"indigo","owner":"Valeria"}},{"Key":"CAR9","Record":{"make":"Holden","model":"Barina","colour":"brown","owner":"Shotaro"}}]
===================== Query successful on peer0.org1 on channel 'mychannel' ===================== 

**** Congratulations! ****
Your Hyperledger Fabric 2.0.0 test network with channel mychannel and chaincode fabcar is ready. Enjoy.

To shutdown the network, first logout and then login again, then run:
cd /home/ericma/go/src/github.com/hyperledger/fabric-samples/test-network && ./network.sh down

Eric Ma

Eric is a systems guy. Eric is interested in building high-performance and scalable distributed systems and related technologies. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.

3 comments:

  1. Good show Eric and well done!

    I finally got Hyperledger Fabric 2.0 installed on my 18.04, albeit fraught with a number of challenges.

    Please consider updating your script;
    1. To install the latest version of go at any given time.
    2. Should a re-run of the script be carried out, when one runs into errors during installation, on detect ‘mychannel’ already created, script should be able to bypass and continue to the next stage. Just like you skip the installation of ‘go’ when it detects that it’s installed.
    3. Always check and update resolv.conf with ‘nameserver 8.8.8.8’ when it detects that, that line is missing from the resolv.conf file, especially before a ‘curl’ or ‘wget’ activity must be carried out.
    4. The last but not the least, the latest npm version should be installed (optional though).

  2. The script breaks after it performs installations upto go lang. Then it gives errors:

    Versions of software:
    Docker version 19.03.6, build 369ce74a3c
    docker-compose version 1.17.1, build unknown
    5.6.0
    go version go1.13.9 linux/amd64
    package github.com/hyperledger/fabric-samples: no Go files in /home/akawe/go/src/github.com/hyperledger/fabric-samples
    ./install-hyperledger-fabric-2-ubuntu-18.04.sh: line 51: cd: /src/github.com/hyperledger/fabric-samples: No such file or directory

    Can you please correct this error.

Leave a Reply

Your email address will not be published. Required fields are marked *