零基础搭建区块链Hyperledger Fabric v1.0环境

  2018新年伊始,一个被大家炒的比较热门的技术映入大众眼帘,没错就是“区块链”,这个去中心化技术的爆红得益于以比特币为代表的数字货币最近这几年的疯涨,也因此伴随着衍生出各种诸如“挖矿”、“矿工”、“矿机”...等新鲜词汇。作为一名搞技术的理工男,区块链适合研发什么样的项目,如何着手研发,它的技术特性及优势...才是我们最关心的。下面就来介绍下Hyperledger Fabric v1.0的搭建过程~

 

环境搭建所需准备的软件及版本

Linux系统Ubuntu 16.04 + go1.9 linux/amd64 + docker17.12.0-ce + docker-compose 1.12.0

 

1、如果是windows开发环境的话建议先装一个VMware,之后下载Ubuntu系统的iso镜像ubuntukylin-16.04-desktop-amd64.iso。将该镜像文件载入到VMware中安装运行,如果出现安装好的虚拟机无法自适应屏幕大小,则可以参考另一篇博文:VMware安装的虚拟机窗口如何自适应屏幕大小

 

2、更新apt source为国内

 

在终端中执行以下命令行查看apt源列表

$ sudo vi /etc/apt/sources.list 

 

如果其中看到的是http://us.xxxxx之类的,那么就是外国的,如果看到的是http://cn.xxxxx之类的,那么就不用换的。 

 

如果是us,则在命令模式下,输入: 

:%s/us./cn./g 

批量替换,然后输入 :wq 保存退出

 

3、安装go

a,由于Ubuntu的apt-get自带的go版本太低,这里我们重新安装,输入指令:
$ wget https://storage.googleapis.com/golang/go1.9.linux-amd64.tar.gz

b,解压
$ sudo tar -C /usr/local -xzf go1.9.linux-amd64.tar.gz 

c,编辑当前用户的环境变量
$ vi ~/.profile

d,在最后添加以下内容

export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$PATH:$HOME/go/bin

e,:wq保存并退出

f,重新编译载入环境变量
$ source ~/.profile

 

注意:我们把go的目录GOPATH设置在当前用户的文件夹下,所以记得要创建go文件夹 

$ cd ~ 回到根目录 

$ mkdir go 创建go文件夹 

 

4、安装docker

具体安装步骤请参考另一篇博文:Ubuntu 16.04环境下安装Docker17.12.0-ce详细步骤

 

5、安装docker-compose(官方推荐为1.8.0版本以上,这里我们下载的是1.12.0) 

a,从docker-compose官网获取linux环境下对应版本的下载命令并执行
$ sudo curl -L https://github.com/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

b,给当前用户增加docker-compose的安装目录可执行权限
$ chmod +x /usr/local/bin/docker-compose

c,查看docker-compose的安装版本,验证是否安装成功
$ docker-compose version

 

6、下载fabric源码

a,创建存放源码的文件夹
$ mkdir -p ~/go/src/github.com/hyperledger

b,切换到存放源码的文件夹目录下
$ cd ~/go/src/github.com/hyperledger

c,用git命令下载完整源码 
$ git clone https://github.com/hyperledger/fabric.git

 

7、下载fabric的docker镜像

a,切换到上一步下载好的fabric源码目录fabric/examples/e2e_cli/下
$ cd ~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/

b,执行以下命令开始下载fabric的docker镜像
$ source download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0

c,执行以下命令查看已下载的docker镜像
$ docker images

 

8、启动Fabric网络

 

首先进入到fabric/examples/e2e_cli/下,这里提供了启动、关闭Fabric网络的自动化脚本。我们要启动Fabric网络,并自动运行Example02 ChainCode的测试,执行以下命令: 

$ ./network_setup.sh up

 

这个过程比较漫长,需要耐心等待一会,最终看到end-e2e打印体界面,那就说明整个Fabric网络已经通了。Ctrl + C 退出,启动成功。

 

qiangjy@ubuntu:~/go/src/github.com/hyperledger/fabric/examples/e2e_cli$ ./network_setup.sh up
setting to default channel 'mychannel'
mychannel

Building cryptogen
make: Entering directory '/home/qiangjy/go/src/github.com/hyperledger/fabric'
Building release/linux-amd64/bin/configtxgen for linux-amd64
mkdir -p release/linux-amd64/bin
CGO_CFLAGS=" " GOOS=linux GOARCH=amd64 go build -o /home/qiangjy/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin/configtxgen -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/common/configtx/tool/configtxgen/metadata.Version=1.0.0" github.com/hyperledger/fabric/common/configtx/tool/configtxgen
Building release/linux-amd64/bin/cryptogen for linux-amd64
mkdir -p release/linux-amd64/bin
CGO_CFLAGS=" " GOOS=linux GOARCH=amd64 go build -o /home/qiangjy/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin/cryptogen -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/common/tools/cryptogen/metadata.Version=1.0.0" github.com/hyperledger/fabric/common/tools/cryptogen
Building release/linux-amd64/bin/configtxlator for linux-amd64
mkdir -p release/linux-amd64/bin
CGO_CFLAGS=" " GOOS=linux GOARCH=amd64 go build -o /home/qiangjy/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin/configtxlator -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/common/tools/configtxlator/metadata.Version=1.0.0" github.com/hyperledger/fabric/common/tools/configtxlator
Building release/linux-amd64/bin/peer for linux-amd64
mkdir -p release/linux-amd64/bin
CGO_CFLAGS=" " GOOS=linux GOARCH=amd64 go build -o /home/qiangjy/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin/peer -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/common/metadata.Version=1.0.0 -X github.com/hyperledger/fabric/common/metadata.BaseVersion=0.3.1 -X github.com/hyperledger/fabric/common/metadata.BaseDockerLabel=org.hyperledger.fabric -X github.com/hyperledger/fabric/common/metadata.DockerNamespace=hyperledger -X github.com/hyperledger/fabric/common/metadata.BaseDockerNamespace=hyperledger" github.com/hyperledger/fabric/peer
Building release/linux-amd64/bin/orderer for linux-amd64
mkdir -p release/linux-amd64/bin
CGO_CFLAGS=" " GOOS=linux GOARCH=amd64 go build -o /home/qiangjy/go/src/github.com/hyperledger/fabric/release/linux-amd64/bin/orderer -tags "nopkcs11" -ldflags "-X github.com/hyperledger/fabric/orderer/metadata.Version=1.0.0" github.com/hyperledger/fabric/orderer
mkdir -p release/linux-amd64/bin
make: Leaving directory '/home/qiangjy/go/src/github.com/hyperledger/fabric'

##########################################################
##### Generate certificates using cryptogen tool #########
##########################################################
org1.example.com
org2.example.com

Using configtxgen -> /home/qiangjy/go/src/github.com/hyperledger/fabric/examples/e2e_cli/../../release/linux-amd64/bin/configtxgen
##########################################################
#########  Generating Orderer Genesis block ##############
##########################################################
2018-02-08 15:13:52.659 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2018-02-08 15:13:52.802 CST [common/configtx/tool] doOutputBlock -> INFO 002 Generating genesis block
2018-02-08 15:13:52.804 CST [common/configtx/tool] doOutputBlock -> INFO 003 Writing genesis block

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
2018-02-08 15:13:52.851 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2018-02-08 15:13:52.855 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2018-02-08 15:13:52.856 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 003 Writing new channel tx

#################################################################
#######    Generating anchor peer update for Org1MSP   ##########
#################################################################
2018-02-08 15:13:52.873 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2018-02-08 15:13:52.881 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2018-02-08 15:13:52.881 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update

#################################################################
#######    Generating anchor peer update for Org2MSP   ##########
#################################################################
2018-02-08 15:13:52.895 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2018-02-08 15:13:52.899 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2018-02-08 15:13:52.900 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update

Creating network "e2ecli_default" with the default driver
Creating peer1.org1.example.com
Creating peer0.org1.example.com
Creating peer0.org2.example.com
Creating peer1.org2.example.com
Creating orderer.example.com
Creating cli

 ____    _____      _      ____    _____           _____   ____    _____ 
/ ___|  |_   _|    / \    |  _ \  |_   _|         | ____| |___ \  | ____|
\___ \    | |     / _ \   | |_) |   | |    _____  |  _|     __) | |  _|  
 ___) |   | |    / ___ \  |  _ <    | |   |_____| | |___   / __/  | |___ 
|____/    |_|   /_/   \_\ |_| \_\   |_|           |_____| |_____| |_____|

Channel name : mychannel
Creating channel...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2018-02-08 07:14:27.774 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:27.797 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:27.839 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-08 07:14:27.840 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2018-02-08 07:14:27.840 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2018-02-08 07:14:27.840 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2018-02-08 07:14:27.840 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2018-02-08 07:14:27.840 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D 
2018-02-08 07:14:27.840 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 292B1080A2B609C24160DF5B5663A566949945C324C8E0A82190F79C7985E6B4 
2018-02-08 07:14:27.840 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-02-08 07:14:27.840 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-02-08 07:14:27.840 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2018-02-08 07:14:27.840 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2018-02-08 07:14:27.840 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608D3F1EFD30522...D9CA7D9CD07F223E568C3D3CE1A32F17 
2018-02-08 07:14:27.840 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: DA852435ABA4230866B7C4DC0F0A0AA30B92062F1E734722636CF67DC4820232 
2018-02-08 07:14:28.015 UTC [msp] GetLocalMSP -> DEBU 010 Returning existing local MSP
2018-02-08 07:14:28.015 UTC [msp] GetDefaultSigningIdentity -> DEBU 011 Obtaining default signing identity
2018-02-08 07:14:28.016 UTC [msp] GetLocalMSP -> DEBU 012 Returning existing local MSP
2018-02-08 07:14:28.016 UTC [msp] GetDefaultSigningIdentity -> DEBU 013 Obtaining default signing identity
2018-02-08 07:14:28.016 UTC [msp/identity] Sign -> DEBU 014 Sign: plaintext: 0AC3060A1508021A0608D4F1EFD30522...AB1B2224CA9D12080A021A0012021A00 
2018-02-08 07:14:28.016 UTC [msp/identity] Sign -> DEBU 015 Sign: digest: DA0C068B4BA4E3AD3827EB3D0336B99EF51BD0591E52FAB17D39F90A0CE8E1D6 
2018-02-08 07:14:28.047 UTC [channelCmd] readBlock -> DEBU 016 Got status:*orderer.DeliverResponse_Status 
2018-02-08 07:14:28.047 UTC [msp] GetLocalMSP -> DEBU 017 Returning existing local MSP
2018-02-08 07:14:28.047 UTC [msp] GetDefaultSigningIdentity -> DEBU 018 Obtaining default signing identity
2018-02-08 07:14:28.082 UTC [channelCmd] InitCmdFactory -> INFO 019 Endorser and orderer connections initialized
2018-02-08 07:14:28.283 UTC [msp] GetLocalMSP -> DEBU 01a Returning existing local MSP
2018-02-08 07:14:28.283 UTC [msp] GetDefaultSigningIdentity -> DEBU 01b Obtaining default signing identity
2018-02-08 07:14:28.283 UTC [msp] GetLocalMSP -> DEBU 01c Returning existing local MSP
2018-02-08 07:14:28.283 UTC [msp] GetDefaultSigningIdentity -> DEBU 01d Obtaining default signing identity
2018-02-08 07:14:28.283 UTC [msp/identity] Sign -> DEBU 01e Sign: plaintext: 0AC3060A1508021A0608D4F1EFD30522...B8306F66052112080A021A0012021A00 
2018-02-08 07:14:28.283 UTC [msp/identity] Sign -> DEBU 01f Sign: digest: ABB41E9CCCAB4625849D9B05E68340BDFB90A07AA0BF867D7667CB1B19C6B443 
2018-02-08 07:14:28.287 UTC [channelCmd] readBlock -> DEBU 020 Received block:0 
2018-02-08 07:14:28.288 UTC [main] main -> INFO 021 Exiting.....
===================== Channel "mychannel" is created successfully ===================== 

Having all peers join the channel...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2018-02-08 07:14:28.422 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:28.422 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:28.425 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-08 07:14:28.425 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A8A070A5C08011A0C08D4F1EFD30510...2A56FF57326F1A080A000A000A000A00 
2018-02-08 07:14:28.425 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: D63F5A58927DC6D0AB7CD15A20C0D4616258E843CB1E0BD6F072736A3DE2FA5E 
2018-02-08 07:14:28.507 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2018-02-08 07:14:28.507 UTC [main] main -> INFO 007 Exiting.....
===================== PEER0 joined on the channel "mychannel" ===================== 

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org1.example.com:7051
2018-02-08 07:14:30.691 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:30.691 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:30.694 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-08 07:14:30.695 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A8A070A5C08011A0C08D6F1EFD30510...2A56FF57326F1A080A000A000A000A00 
2018-02-08 07:14:30.695 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 28E2C3438FCC7646EFAE1AC47E025A3D3436CCB840C1CA6D90086959F9F841D2 
2018-02-08 07:14:30.758 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2018-02-08 07:14:30.758 UTC [main] main -> INFO 007 Exiting.....
===================== PEER1 joined on the channel "mychannel" ===================== 

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2018-02-08 07:14:32.897 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:32.897 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:32.908 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-08 07:14:32.909 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A8A070A5C08011A0C08D8F1EFD30510...2A56FF57326F1A080A000A000A000A00 
2018-02-08 07:14:32.909 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 53DA21A1021245E4941F0A8559E3713B886CEF6D4350DE73413F226BFA15A71C 
2018-02-08 07:14:32.972 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2018-02-08 07:14:32.972 UTC [main] main -> INFO 007 Exiting.....
===================== PEER2 joined on the channel "mychannel" ===================== 

CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
2018-02-08 07:14:35.084 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:35.085 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:35.088 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-08 07:14:35.088 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A89070A5B08011A0B08DBF1EFD30510...2A56FF57326F1A080A000A000A000A00 
2018-02-08 07:14:35.088 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: F307A45A204FE413CA682121025C5018CD07B23F1C9F09D3996337CC426F468B 
2018-02-08 07:14:35.176 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2018-02-08 07:14:35.176 UTC [main] main -> INFO 007 Exiting.....
===================== PEER3 joined on the channel "mychannel" ===================== 

Updating anchor peers for org1...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2018-02-08 07:14:37.330 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:37.330 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:37.334 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-08 07:14:37.334 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2018-02-08 07:14:37.334 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2018-02-08 07:14:37.334 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2018-02-08 07:14:37.334 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2018-02-08 07:14:37.334 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...72731200220A0A0641646D696E731200 
2018-02-08 07:14:37.334 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 27BF8D60C3526464F6F8F5251260282C8A7DFE92CCCE82A09AEE83492BD856A6 
2018-02-08 07:14:37.335 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-02-08 07:14:37.335 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-02-08 07:14:37.335 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2018-02-08 07:14:37.335 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2018-02-08 07:14:37.335 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608DDF1EFD30522...0235DC13EDB742C5F35A4494648EB56F 
2018-02-08 07:14:37.335 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 6EC614D71AB12A1AD7C58C673B85371CF940FDEECC83BF94BDD82F4BBFB2C2CC 
2018-02-08 07:14:37.373 UTC [main] main -> INFO 010 Exiting.....
===================== Anchor peers for org "Org1MSP" on "mychannel" is updated successfully ===================== 

Updating anchor peers for org2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2018-02-08 07:14:42.508 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:42.508 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:42.512 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2018-02-08 07:14:42.513 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2018-02-08 07:14:42.513 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2018-02-08 07:14:42.513 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2018-02-08 07:14:42.513 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2018-02-08 07:14:42.513 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267324D53501280062D...72731200220A0A0641646D696E731200 
2018-02-08 07:14:42.513 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: A4E4947C5D02CB70DF06427414F9747E6ACF15604965C2384A713769DAF70E32 
2018-02-08 07:14:42.513 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-02-08 07:14:42.513 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-02-08 07:14:42.513 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2018-02-08 07:14:42.513 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2018-02-08 07:14:42.513 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608E2F1EFD30522...2A3F4123A8A7BDE44D676CEF43B0E34C 
2018-02-08 07:14:42.513 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 727F48E10AB6BDFBC7357FE11A720DC4BD49DFD19D8CDF9FE8E44C5BA81AA8B7 
2018-02-08 07:14:42.568 UTC [main] main -> INFO 010 Exiting.....
===================== Anchor peers for org "Org2MSP" on "mychannel" is updated successfully ===================== 

Installing chaincode on org1/peer0...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2018-02-08 07:14:47.724 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:47.724 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:47.724 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-02-08 07:14:47.724 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-02-08 07:14:49.935 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
2018-02-08 07:14:51.279 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt
2018-02-08 07:14:51.279 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2018-02-08 07:14:51.279 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer
2018-02-08 07:14:51.279 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv
2018-02-08 07:14:51.280 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done
2018-02-08 07:14:51.293 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A8A070A5C08031A0C08EBF1EFD30510...175DFF090000FFFF7C012598002C0000 
2018-02-08 07:14:51.293 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 707DA98908BCB10B9FEED067FAD16BFA1CA2F065988A8DCC4CE1AD4782015224 
2018-02-08 07:14:51.313 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 
2018-02-08 07:14:51.313 UTC [main] main -> INFO 00e Exiting.....
===================== Chaincode is installed on remote peer PEER0 ===================== 

Install chaincode on org2/peer2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2018-02-08 07:14:51.416 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:51.416 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:51.416 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-02-08 07:14:51.416 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-02-08 07:14:51.482 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
2018-02-08 07:14:51.657 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt
2018-02-08 07:14:51.657 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2018-02-08 07:14:51.657 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer
2018-02-08 07:14:51.657 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv
2018-02-08 07:14:51.657 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done
2018-02-08 07:14:51.659 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A8A070A5C08031A0C08EBF1EFD30510...175DFF090000FFFF7C012598002C0000 
2018-02-08 07:14:51.659 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 8ECC43BDCA8965CE515EEA72B23F1EC82AD3B5DD60CFCF15BE76463BE127B504 
2018-02-08 07:14:51.665 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 
2018-02-08 07:14:51.665 UTC [main] main -> INFO 00e Exiting.....
===================== Chaincode is installed on remote peer PEER2 ===================== 

Instantiating chaincode on org2/peer2...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2018-02-08 07:14:51.742 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:14:51.742 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:14:51.746 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-02-08 07:14:51.746 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-02-08 07:14:51.758 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A95070A6708031A0C08EBF1EFD30510...324D53500A04657363630A0476736363 
2018-02-08 07:14:51.758 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: BE7DF19230F9E155F8BB9171D0F38E1ACC1E77390C98BEF498990C669D3D73FD 
2018-02-08 07:15:48.325 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext: 0A95070A6708031A0C08EBF1EFD30510...961368B2BDF440FAE44422A366C351FE 
2018-02-08 07:15:48.407 UTC [msp/identity] Sign -> DEBU 008 Sign: digest: 9EAA55F2807022A0952C7672ED0E14464FECAD64808F2359B560B3ED7838B8C0 
2018-02-08 07:15:48.975 UTC [main] main -> INFO 009 Exiting.....
===================== Chaincode Instantiation on PEER2 on channel 'mychannel' is successful ===================== 

Querying chaincode on org1/peer0...
===================== Querying on PEER0 on channel 'mychannel'... ===================== 
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
Attempting to Query PEER0 ...3 secs

2018-02-08 07:15:53.672 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:15:53.686 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:15:53.686 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-02-08 07:15:53.686 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-02-08 07:15:53.686 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A95070A6708031A0C08A9F2EFD30510...6D7963631A0A0A0571756572790A0161 
2018-02-08 07:15:53.686 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 8D3042C9F766D93B04B54C108462325A61EEE49A1DED2BAFD0052A454447935B 
Query Result: 100
2018-02-08 07:16:58.761 UTC [main] main -> INFO 007 Exiting.....
===================== Query on PEER0 on channel 'mychannel' is successful ===================== 
Sending invoke transaction on org1/peer0...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2018-02-08 07:17:02.751 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:17:02.751 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:17:03.586 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-02-08 07:17:03.586 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-02-08 07:17:03.587 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A95070A6708031A0C08EFF2EFD30510...696E766F6B650A01610A01620A023130 
2018-02-08 07:17:03.587 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 97B24074EA45C15457B95F56C0F635659B5549A9C7BFDF1207F4AA2B7D7A97B1 
2018-02-08 07:17:03.852 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext: 0A95070A6708031A0C08EFF2EFD30510...CF69EFAFCAABFEA5D908B8A75359C9CB 
2018-02-08 07:17:03.852 UTC [msp/identity] Sign -> DEBU 008 Sign: digest: 7353551348EEA0527A72CA62F9CEF56DE0BE41F3AC1179CD7459044A1C8B04AB 
2018-02-08 07:17:04.459 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> DEBU 009 ESCC invoke result: version:1 response:<status:200 message:"OK" > payload:"\n I\r\244\202\330~\347xjF\203H07\271\241U/\360AnVj\312\233\337\346+\200\025\004>\022Y\nE\022\024\n\004lscc\022\014\n\n\n\004mycc\022\002\010\003\022-\n\004mycc\022%\n\007\n\001a\022\002\010\003\n\007\n\001b\022\002\010\003\032\007\n\001a\032\00290\032\010\n\001b\032\003210\032\003\010\310\001\"\013\022\004mycc\032\0031.0" endorsement:<endorser:"\n\007Org1MSP\022\374\005-----BEGIN -----\nMIICGDCCAb+gAwIBAgIQOlMl6mZqYZKA0mr6Sm9PmTAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xODAyMDgwNzEzNTFaFw0yODAyMDYwNzEzNTFa\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEJWwmR7xAzhj3Nh+ipgD/VAs+48V7R56y\nDphNfIk1B8yGzWNXsYXePGfCUboMbrGMRFxpP3p92LZJ44tVQcYTfKNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgSnJY4muYpP0W\nF78e+ox/bnyPpWQ0AwB5WwNEobIaTXUwCgYIKoZIzj0EAwIDRwAwRAIhAO/tMrR1\nioVQStjN1GUfHzdskYjyKEf9Qf/X8P9pR1L9Ah8xnH+ewWcWoeVMnoRrAWk+VPgE\n0Me077VvtaAxdqqS\n-----END -----\n" signature:"0D\002 v;\307v\334\356\331\257\320t:\201\177eaO\222\302\026\254!h1\024\321\241\016r\215\231\372t\002 \007\001\265(&\3037\022\016U\201\330G=\022\324\317i\357\257\312\253\376\245\331\010\270\247SY\311\313" > 
2018-02-08 07:17:04.460 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 00a Chaincode invoke successful. result: status:200 
2018-02-08 07:17:04.460 UTC [main] main -> INFO 00b Exiting.....
===================== Invoke transaction on PEER0 on channel 'mychannel' is successful ===================== 

Installing chaincode on org2/peer3...
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
2018-02-08 07:17:04.745 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:17:04.745 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:17:04.803 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-02-08 07:17:04.803 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-02-08 07:17:08.292 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
2018-02-08 07:17:09.849 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt
2018-02-08 07:17:09.849 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2018-02-08 07:17:09.849 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer
2018-02-08 07:17:09.849 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv
2018-02-08 07:17:09.850 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done
2018-02-08 07:17:09.870 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A8A070A5C08031A0C08F5F2EFD30510...175DFF090000FFFF7C012598002C0000 
2018-02-08 07:17:09.870 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 7F75915586A497BCB922EC4E37DE92DA2BEAA088803980FED449566785205BCA 
2018-02-08 07:17:09.974 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 
2018-02-08 07:17:09.974 UTC [main] main -> INFO 00e Exiting.....
===================== Chaincode is installed on remote peer PEER3 ===================== 

Querying chaincode on org2/peer3...
===================== Querying on PEER3 on channel 'mychannel'... ===================== 
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
CORE_PEER_LOCALMSPID=Org2MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.crt
CORE_PEER_TLS_ENABLED=true
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/[email protected]/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
Attempting to Query PEER3 ...3 secs

2018-02-08 07:17:13.191 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2018-02-08 07:17:13.191 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2018-02-08 07:17:13.191 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2018-02-08 07:17:13.192 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2018-02-08 07:17:13.192 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A94070A6608031A0B08F9F2EFD30510...6D7963631A0A0A0571756572790A0161 
2018-02-08 07:17:13.192 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 079426B2F1F7E0F5C911A0964760FA5EDA5B0D684418FBB3D6B47B354FFE2CE3 
Query Result: 90
2018-02-08 07:18:20.133 UTC [main] main -> INFO 007 Exiting.....
===================== Query on PEER3 on channel 'mychannel' is successful ===================== 

===================== All GOOD, End-2-End execution completed ===================== 


 _____   _   _   ____            _____   ____    _____ 
| ____| | \ | | |  _ \          | ____| |___ \  | ____|
|  _|   |  \| | | | | |  _____  |  _|     __) | |  _|  
| |___  | |\  | | |_| | |_____| | |___   / __/  | |___ 
|_____| |_| \_| |____/          |_____| |_____| |_____|


 

9、通过ChainCode手动测试Fabric网络

这里有官方提供的小例子,在官方例子中,channel名字是mychannel,链码的名字是mycc。 
输入以下命令进入CLI:
$ docker exec -it cli bash 

这时用户为root@6569408c5320,在/opt/gopath/src/github.com/hyperledger/fabric/peer目录下,
运行以下命令可以查询a账户的余额:
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}' 

 

 

至此,我们整个Fabric的环境已经搭建并测试完毕!

猜你喜欢

转载自qiangjiyi.iteye.com/blog/2410610