Fabric开发(二) Ubuntu20.04.1快速搭建Fabric1.0.0 (排雷版)

   日期:2020-09-25     浏览:103    评论:0    
核心提示:一、安装Fabric前准备:1、安装ubuntu,建议virbox+ubuntu镜像。我所使用的版本:1、virtualBox 5.2.202、ubuntu-20.04.1-desktop-amd64.iso安装注意点:1、内存: 2048M2、CPU: 23、磁盘: 位置放在D盘,大小50G。 fabric 安装完需要10G4、网络模式: 桥接2、xshell6 连接 可以网站直接申请学校版本采用xshell 进行操作,方便复制sudo apt-get install

一、安装Fabric前准备:

1、安装ubuntu,建议virtualBox+ubuntu镜像。

我所使用的版本:

1、virtualBox 5.2.20
#ubuntu桌面版,方便某些操作,例如修改源。(建议安装英文版)
2、ubuntu-20.04.1-desktop-amd64.iso 


安装注意点:

1、内存: 2048M
2、CPU: 2
3、磁盘: 位置放在D盘,大小50G。 fabric 安装完需要10G
4、网络模式: 桥接

1、内存 显存 存储修改


2、网络修改

3、安装完成后,九宫格找到Software&Update,修改源。

2、xshell6 连接 可以网站直接申请学校版本

1.采用xshell 进行操作,方便复制

sudo apt-get install openssh-server
ps -e|grep ssh

2.查看ip

sudo apt install net-tools
ifconfig

查看ip也可以直接点击 九宫格找到Setting ->Network

3.进行xshell连接

3、安装 vim、git、curl、pip、npm

此处注意:python-pip安装会报找不到,所以改为python3-pip

sudo apt-get update
sudo apt-get install vim
sudo apt-get install git
sudo apt-get install curl
sudo apt-get install python3-pip
pip3 install --upgrade pip
sudo apt-get install npm

4、安装go

安装版本:1.14.4

wget https://storage.googleapis.com/golang/go1.14.4.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.14.4.linux-amd64.tar.gz

家目录创建go文件夹

cd ~
mkdir go

编辑当前用户的环境变量.(:x可以直接返回保存。)

vim ~/.profile

末尾追加:

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

环境变量立即生效

source ~/.profile

检验go是否安装成功(成功显示go version go1.14.4 linux/amd64

go version

5、安装Docker

1.卸载旧版本docker

sudo apt-get remove docker docker-engine docker.io

2.更新系统软件

sudo apt-get update

3.安装依赖包

sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

4.添加官方密钥

执行该命令时,如遇到长时间没有响应说明网络连接不到docker网站,需要使用代-理进行。
显示OK,表示添加成功.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

5.添加仓库

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable"

6.修改仓库源(如果要设置专属阿里云,自己先百度下哈)

sudo vim /etc/docker/daemon.json

填写以下内容

{ 
    "registry-mirrors": ["http://hub-mirror.c.163.com"]
}

重置docker服务

systemctl restart docker.service

7.再次更新软件

sudo apt-get update

8.安装docker

如果想指定安装某一版本,可使用 sudo apt-get install docker-ce= 命令,把替换为具体版本即可。
以下命令没有指定版本,默认就会安装最新版

sudo apt-get install docker-ce

9.查看docker版本

docker -v

10.安装完成后需要修改当前用户(我使用的用户叫halfape)权限:

sudo gpasswd -a halfape docker #正在将用户“halfape”加入到“docker”组中
newgrp docker #更新用户组

6、安装docker-compose

1.下载docker-compose

sudo curl -L https://github.com/docker/compose/releases/download/1.17.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

2.授权

sudo chmod +x /usr/local/bin/docker-compose

3.查看版本信息

docker-compose --version

二、安装Fabric

1、下载 Fabric源码

我们可以使用Git命令下载源码,首先需要建立对应的目录,然后进入该目录,Git下载源码:

mkdir -p ~/go/src/github.com/hyperledger 
cd ~/go/src/github.com/hyperledger 
git clone https://github.com/hyperledger/fabric.git

由于Fabric一直在更新,所有我们并不需要最新最新的源码,需要切换到v1.0.0版本的源码即可:(这个下载过程比较慢,目前看到一种从gitee下载的方法 我没有试)

cd ~/go/src/github.com/hyperledger/fabric
git checkout v1.0.0

2、Fabric Docker镜像的下载

因为我们已经设置了Docker Hub镜像地址,所以下载也会很快。官方文件也提供了批量下载的脚本。我们直接运行:

cd ~/go/src/github.com/hyperledger/fabric/examples/e2e_cli/
source download-dockerimages.sh -c x86_64-1.0.0 -f x86_64-1.0.0

检查Fabric Docker镜像列表

docker images


可以看出,文件还是蛮大的。
至此,下载 fabric 源码、fabric 镜像的工作已经完成。

三、Fabric简单调试

1、启动Fabric网络并完成ChainCode的测试

我们仍然停留在e2e_cli文件夹,这里提供了启动、关闭Fabric网络的自动化脚本。我们要启动Fabric网络,并自动运行Example02 ChainCode的测试,执行一个命令:

./network_setup.sh up
1.1编译生成Fabric公私钥、证书的程序,程序在目录:fabric/release/linux-amd64/bin
1.2基于configtx.yaml生成创世区块和通道相关信息,并保存在channel-artifacts文件夹。
1.3基于crypto-config.yaml生成公私钥和证书信息,并保存在crypto-config文件夹中。
1.4基于docker-compose-cli.yaml启动1Orderer+4Peer+1CLI的Fabric容器。
1.5在CLI启动的时候,会运行scripts/script.sh文件,这个脚本文件包含了创建Channel,加入Channel,安装Example02,运行Example02等功能。

最后运行完毕,我们可以看到这样的界面:

看到这里 恭喜你,说明我们整个Fabric网络已经OK了。

记录下具体过程,以便于后续研究。

halfape@halfape-VirtualBox:~/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/halfape/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/halfape/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/halfape/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/halfape/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/halfape/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/halfape/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/halfape/go/src/github.com/hyperledger/fabric'

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

Using configtxgen -> /home/halfape/go/src/github.com/hyperledger/fabric/examples/e2e_cli/../../release/linux-amd64/bin/configtxgen
##########################################################
######### Generating Orderer Genesis block ##############
##########################################################
2020-09-24 14:03:21.695 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2020-09-24 14:03:21.712 CST [common/configtx/tool] doOutputBlock -> INFO 002 Generating genesis block
2020-09-24 14:03:21.714 CST [common/configtx/tool] doOutputBlock -> INFO 003 Writing genesis block

#################################################################
### Generating channel configuration transaction 'channel.tx' ###
#################################################################
2020-09-24 14:03:21.756 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2020-09-24 14:03:21.760 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2020-09-24 14:03:21.761 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 003 Writing new channel tx

#################################################################
####### Generating anchor peer update for Org1MSP ##########
#################################################################
2020-09-24 14:03:21.793 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2020-09-24 14:03:21.798 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2020-09-24 14:03:21.798 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update

#################################################################
####### Generating anchor peer update for Org2MSP ##########
#################################################################
2020-09-24 14:03:21.835 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2020-09-24 14:03:21.839 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2020-09-24 14:03:21.840 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update

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

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

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/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2020-09-24 06:03:35.240 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:35.240 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:35.244 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-09-24 06:03:35.244 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2020-09-24 06:03:35.244 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2020-09-24 06:03:35.244 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2020-09-24 06:03:35.244 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2020-09-24 06:03:35.244 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A88060A074F7267314D535012FC052D...53616D706C65436F6E736F727469756D 
2020-09-24 06:03:35.244 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 13F31E852E3702746BDF69BB4E8101889C7FF20CCB0A369CB048D4F2366435B0 
2020-09-24 06:03:35.244 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2020-09-24 06:03:35.244 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2020-09-24 06:03:35.244 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2020-09-24 06:03:35.244 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2020-09-24 06:03:35.244 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0ABF060A1508021A0608B7EDB0FB0522...959D6EC845FCE532A9A3ADDAD6C1AD31 
2020-09-24 06:03:35.244 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: AE949BCE386EAABE88210C5FB64D2C525F9E74B8D8CF1554F4B806FA576574C1 
2020-09-24 06:03:35.493 UTC [msp] GetLocalMSP -> DEBU 010 Returning existing local MSP
2020-09-24 06:03:35.493 UTC [msp] GetDefaultSigningIdentity -> DEBU 011 Obtaining default signing identity
2020-09-24 06:03:35.493 UTC [msp] GetLocalMSP -> DEBU 012 Returning existing local MSP
2020-09-24 06:03:35.493 UTC [msp] GetDefaultSigningIdentity -> DEBU 013 Obtaining default signing identity
2020-09-24 06:03:35.493 UTC [msp/identity] Sign -> DEBU 014 Sign: plaintext: 0ABF060A1508021A0608B7EDB0FB0522...825BD6FDF69112080A021A0012021A00 
2020-09-24 06:03:35.493 UTC [msp/identity] Sign -> DEBU 015 Sign: digest: 8378ACEDEF10F25823178B4C1ECB0EA5C0157422A9EE3B2241623F02FC25C523 
2020-09-24 06:03:35.494 UTC [channelCmd] readBlock -> DEBU 016 Got status:*orderer.DeliverResponse_Status 
2020-09-24 06:03:35.494 UTC [msp] GetLocalMSP -> DEBU 017 Returning existing local MSP
2020-09-24 06:03:35.494 UTC [msp] GetDefaultSigningIdentity -> DEBU 018 Obtaining default signing identity
2020-09-24 06:03:35.496 UTC [channelCmd] InitCmdFactory -> INFO 019 Endorser and orderer connections initialized
2020-09-24 06:03:35.698 UTC [msp] GetLocalMSP -> DEBU 01a Returning existing local MSP
2020-09-24 06:03:35.698 UTC [msp] GetDefaultSigningIdentity -> DEBU 01b Obtaining default signing identity
2020-09-24 06:03:35.702 UTC [msp] GetLocalMSP -> DEBU 01c Returning existing local MSP
2020-09-24 06:03:35.702 UTC [msp] GetDefaultSigningIdentity -> DEBU 01d Obtaining default signing identity
2020-09-24 06:03:35.703 UTC [msp/identity] Sign -> DEBU 01e Sign: plaintext: 0ABF060A1508021A0608B7EDB0FB0522...E5E08F74893C12080A021A0012021A00 
2020-09-24 06:03:35.703 UTC [msp/identity] Sign -> DEBU 01f Sign: digest: 56339A77350C1A804A8058ACEF0550D108CCB7E266A5734533F7A286133E4D9C 
2020-09-24 06:03:35.732 UTC [channelCmd] readBlock -> DEBU 020 Received block:0 
2020-09-24 06:03:35.733 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/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2020-09-24 06:03:35.822 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:35.822 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:35.826 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-09-24 06:03:35.827 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A86070A5C08011A0C08B7EDB0FB0510...5F92D770B8D41A080A000A000A000A00 
2020-09-24 06:03:35.827 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 1FC95717CF159E5BF071FA4D741025AB9BC17E307B1E7F11364BE1976D03F700 
2020-09-24 06:03:35.895 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2020-09-24 06:03:35.896 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/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org1.example.com:7051
2020-09-24 06:03:38.001 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:38.001 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:38.004 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-09-24 06:03:38.004 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A85070A5B08011A0B08BAEDB0FB0510...5F92D770B8D41A080A000A000A000A00 
2020-09-24 06:03:38.004 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: EF0E34FD2143F9EFFFB91C7593AABBCFC309C952E3AAB70DD675E67EBDBE0840 
2020-09-24 06:03:38.077 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2020-09-24 06:03:38.077 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/Admin@org2.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2020-09-24 06:03:40.144 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:40.144 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:40.148 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-09-24 06:03:40.148 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A85070A5B08011A0B08BCEDB0FB0510...5F92D770B8D41A080A000A000A000A00 
2020-09-24 06:03:40.148 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 7E3D9471CB81833879C4AAA68D07B99ED16F344BEBEB88BED2985D49C236C0DC 
2020-09-24 06:03:40.197 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2020-09-24 06:03:40.197 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/Admin@org2.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
2020-09-24 06:03:42.277 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:42.277 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:42.280 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-09-24 06:03:42.280 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A86070A5C08011A0C08BEEDB0FB0510...5F92D770B8D41A080A000A000A000A00 
2020-09-24 06:03:42.280 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 307429B2F0A712EB734DC605111D796A5FDE454D649BCDF4D1D4CF282A863C55 
2020-09-24 06:03:42.317 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel!
2020-09-24 06:03:42.317 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/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2020-09-24 06:03:44.389 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:44.389 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:44.392 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-09-24 06:03:44.392 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2020-09-24 06:03:44.392 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2020-09-24 06:03:44.392 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2020-09-24 06:03:44.392 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2020-09-24 06:03:44.392 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A88060A074F7267314D535012FC052D...72731200220A0A0641646D696E731200 
2020-09-24 06:03:44.392 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: CE0BBEE6477F6F778EE453DD7F6172D57C855AD11FC332755829725A2E195930 
2020-09-24 06:03:44.392 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2020-09-24 06:03:44.392 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2020-09-24 06:03:44.392 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2020-09-24 06:03:44.393 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2020-09-24 06:03:44.393 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0ABF060A1508021A0608C0EDB0FB0522...71DB89122D78577A76A4201071ABD7A8 
2020-09-24 06:03:44.393 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 88B311AC32A7BEEF909651FEB7B79E909386ED503F0221447D0CEEAC27453BF1 
2020-09-24 06:03:44.456 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/Admin@org2.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2020-09-24 06:03:49.507 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:49.507 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:49.514 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2020-09-24 06:03:49.514 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP
2020-09-24 06:03:49.514 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity
2020-09-24 06:03:49.514 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP
2020-09-24 06:03:49.514 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity
2020-09-24 06:03:49.514 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A88060A074F7267324D535012FC052D...72731200220A0A0641646D696E731200 
2020-09-24 06:03:49.514 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: A8F3368AF8D87033B10CB75AC0171242483FBDDDF710623AEF2D1ECB6D246921 
2020-09-24 06:03:49.515 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2020-09-24 06:03:49.515 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2020-09-24 06:03:49.515 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP
2020-09-24 06:03:49.515 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity
2020-09-24 06:03:49.515 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0ABF060A1508021A0608C5EDB0FB0522...55111F568CFB353B048DB7829B697A59 
2020-09-24 06:03:49.515 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: DF93F35003104A57C7C8A59332669DEC2695B0EDAC5CA0A7E02256EF8B7AA20E 
2020-09-24 06:03:49.559 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/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2020-09-24 06:03:54.637 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:54.638 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:54.638 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2020-09-24 06:03:54.638 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2020-09-24 06:03:55.266 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
2020-09-24 06:03:55.822 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt
2020-09-24 06:03:55.822 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2020-09-24 06:03:55.822 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer
2020-09-24 06:03:55.822 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv
2020-09-24 06:03:55.822 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done
2020-09-24 06:03:55.824 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A86070A5C08031A0C08CBEDB0FB0510...8BAEFF040000FFFF84DB3255002C0000 
2020-09-24 06:03:55.824 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 96E6D9272AB1D988DE69DF975A28FB8F8A142EA54D938D198973C019BBBEF948 
2020-09-24 06:03:55.828 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 
2020-09-24 06:03:55.828 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/Admin@org2.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2020-09-24 06:03:55.939 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:55.940 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:55.940 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2020-09-24 06:03:55.940 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2020-09-24 06:03:56.002 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
2020-09-24 06:03:56.175 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt
2020-09-24 06:03:56.175 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2020-09-24 06:03:56.175 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer
2020-09-24 06:03:56.175 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv
2020-09-24 06:03:56.175 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done
2020-09-24 06:03:56.179 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A85070A5B08031A0B08CCEDB0FB0510...8BAEFF040000FFFF84DB3255002C0000 
2020-09-24 06:03:56.179 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 2A11FA33DEFC09AF44B6DBD74145C6268B7B7F5D2D07DD79833515BBC4EB302B 
2020-09-24 06:03:56.186 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 
2020-09-24 06:03:56.186 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/Admin@org2.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
2020-09-24 06:03:56.239 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:03:56.239 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:03:56.242 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2020-09-24 06:03:56.242 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2020-09-24 06:03:56.242 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A90070A6608031A0B08CCEDB0FB0510...324D53500A04657363630A0476736363 
2020-09-24 06:03:56.242 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 135B4574B3AB6306330828AD313204BBC9C2EF3E5D33572E7333F02F4C312733 
2020-09-24 06:04:20.617 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext: 0A90070A6608031A0B08CCEDB0FB0510...1AA6B5B27683580A87310BC79AC46E3E 
2020-09-24 06:04:20.617 UTC [msp/identity] Sign -> DEBU 008 Sign: digest: 77FD9776C5844429F4A45B4F98499A9F45AD33998FE8DF510DF62A781F339F22 
2020-09-24 06:04:20.621 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/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
Attempting to Query PEER0 ...3 secs

2020-09-24 06:04:23.794 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:04:23.795 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:04:23.795 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2020-09-24 06:04:23.795 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2020-09-24 06:04:23.798 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A91070A6708031A0C08E7EDB0FB0510...6D7963631A0A0A0571756572790A0161 
2020-09-24 06:04:23.798 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 21B941E99A3C8C6AD6FB5661499F8DE8045AE9FE6E403C7B59ADEE113F4C59D9 
Query Result: 100
2020-09-24 06:04:44.543 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/Admin@org1.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer0.org1.example.com:7051
2020-09-24 06:04:44.700 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:04:44.700 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:04:44.702 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2020-09-24 06:04:44.702 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2020-09-24 06:04:44.702 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A91070A6708031A0C08FCEDB0FB0510...696E766F6B650A01610A01620A023130 
2020-09-24 06:04:44.702 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 0638FE536E7005EBCEA47F0CF3D65C8D441E7776CF800D3A4C3F2306CF3F681B 
2020-09-24 06:04:44.719 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext: 0A91070A6708031A0C08FCEDB0FB0510...060BE069770A9E6C00A400AF6CB2E539 
2020-09-24 06:04:44.719 UTC [msp/identity] Sign -> DEBU 008 Sign: digest: F039995E54AECAE7B91FCF2FA22CED099637CF87F6077BB49D662DA6AD4B933F 
2020-09-24 06:04:44.725 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> DEBU 009 ESCC invoke result: version:1 response:<status:200 message:"OK" > payload:"\n \rS-\342\361Y\335?*\201\351N\005\230o\277X\230i\272a\334^\344\210\234\033\316\200J_<\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\200\006-----BEGIN -----\nMIICGTCCAb+gAwIBAgIQIZPhuFKON7Dh0xFNWEO7AzAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0yMDA5MjQwNjAzMjFaFw0zMDA5MjIwNjAzMjFa\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEXbaYHsF2xGrK5cBDcmglRok/AMWCcK9n\npkZXPTp0IG0ton3ymR3MPkQmdaM2r/SgB6mLdeqvGbOR++A0d5ordKNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgv4/KeWE5IHBe\naPsMw/1zyM5IiduLeFOiwQtdspNmj7IwCgYIKoZIzj0EAwIDSAAwRQIhAJIKngNQ\nSg6LYwF3IKNPlzQV4smJYVHhiJ2duJYelbCnAiAaZgQkPDJ/noDgaEaYSr1OQDJ0\nTNAFAC2ewt9H5qoObw==\n-----END -----\n" signature:"0D\002 n\357HA\236\3571o\336\215\334\362\341\354}?W\301\027\246=bn(\034J\246\213g\224KT\002 )\303\236\313\347c\003_C8\306\315<\367j\316\006\013\340iw\n\236l\000\244\000\257l\262\3459" > 
2020-09-24 06:04:44.726 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 00a Chaincode invoke successful. result: status:200 
2020-09-24 06:04:44.726 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/Admin@org2.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
2020-09-24 06:04:44.821 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:04:44.821 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:04:44.821 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2020-09-24 06:04:44.821 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2020-09-24 06:04:45.003 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
2020-09-24 06:04:45.239 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt
2020-09-24 06:04:45.239 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2020-09-24 06:04:45.239 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer
2020-09-24 06:04:45.239 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv
2020-09-24 06:04:45.239 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done
2020-09-24 06:04:45.260 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A85070A5B08031A0B08FDEDB0FB0510...8BAEFF040000FFFF84DB3255002C0000 
2020-09-24 06:04:45.260 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: A67215B0359AC06B8937C654F6AC7CA853C6DBCBA9D4ACA38758FACAFD448734 
2020-09-24 06:04:45.280 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 
2020-09-24 06:04:45.280 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/Admin@org2.example.com/msp
CORE_PEER_ID=cli
CORE_LOGGING_LEVEL=DEBUG
CORE_PEER_ADDRESS=peer1.org2.example.com:7051
Attempting to Query PEER3 ...3 secs

2020-09-24 06:04:48.368 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP
2020-09-24 06:04:48.368 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2020-09-24 06:04:48.368 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2020-09-24 06:04:48.368 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
2020-09-24 06:04:48.368 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A91070A6708031A0C0880EEB0FB0510...6D7963631A0A0A0571756572790A0161 
2020-09-24 06:04:48.368 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 4A1E7EE3E79A10E47F765C9832AC153022C90FFFAECD020608AEBBD33CD2277B 
Query Result: 90
2020-09-24 06:05:07.907 UTC [main] main -> INFO 007 Exiting.....
===================== Query on PEER3 on channel 'mychannel' is successful ===================== 

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


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

2、手动测试一下Fabric网络

我们仍然是以现在安装好的Example02为例,在官方例子中,channel名字是mychannel,链码的名字是mycc。我们首先进入CLI,我们重新打开一个命令行窗口,输入:

docker exec -it cli bash

运行以下命令可以查询a账户的余额:

peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'


然后,我们试一试把a账户的余额再转80元给b账户,运行命令:

peer chaincode invoke -o orderer.example.com:7050  --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem  -C mychannel -n mycc -c '{"Args":["invoke","a","b","80"]}'

运行结果如下图:

现在转账完毕, 我们试一试再查询一下a账户的余额,没问题的话,应该是只剩下10块大洋了。我们看看实际情况:

bingo,正如我们所愿。

3、关闭Fabric网络

最后我们要关闭Fabric网络,首先需要运行exit命令退出cli容器。关闭Fabric的命令与启动类似,命令为:

cd ~/go/src/github.com/hyperledger/fabric/examples/e2e_cli
./network_setup.sh down

过程如下:

halfape@halfape-VirtualBox:~/go/src/github.com/hyperledger/fabric/examples/e2e_cli$ ./network_setup.sh down
setting to default channel 'mychannel'
WARNING: The CHANNEL_NAME variable is not set. Defaulting to a blank string.
WARNING: The TIMEOUT variable is not set. Defaulting to a blank string.
Stopping cli                    ... done
Stopping peer0.org1.example.com ... done
Stopping peer0.org2.example.com ... done
Stopping orderer.example.com    ... done
Stopping peer1.org2.example.com ... done
Stopping peer1.org1.example.com ... done
Removing cli                    ... done
Removing peer0.org1.example.com ... done
Removing peer0.org2.example.com ... done
Removing orderer.example.com    ... done
Removing peer1.org2.example.com ... done
Removing peer1.org1.example.com ... done
Removing network e2ecli_default
49c35a7144ed
1757636a5f53
425fba1bd2d7
Untagged: dev-peer1.org2.example.com-mycc-1.0:latest
Deleted: sha256:9e7b2495f4433d5b0f5eb3a876f74a246cb37af919e5b47d567505ae77f83df4
Deleted: sha256:fd93b79a499dc6e372009449bfe7a913a8695941052467c1f63eb6b86a001786
Deleted: sha256:66d9b3022ef4fc06246be09a9dfe1afe493d6cecff955f77fa8ad583b1ecbbbf
Deleted: sha256:64ec50d0ff3b4c6f1eb678ddc8ec8c0866cf98f300a925175e964fa45090c930
Deleted: sha256:cb08a8077c6f7451b589da007ea0877f1bf7393fcf3f773e4907e7e0985890ef
Deleted: sha256:f53aee1e74e529c3af7bb8d5acb750bf00f85e27af7b49f47ff8095ff5c8d575
Deleted: sha256:fe91dc1cbc204858760cc561b545038d9d8b5965ffca853ece60a59deb7eba92
Untagged: dev-peer0.org1.example.com-mycc-1.0:latest
Deleted: sha256:107d6723dd0cd2633ecf004dc6612fca57709d2dba90a657d9072534a6477c9b
Deleted: sha256:bfc9fc6475aac3b7f446171b677a6554227a3e8a0c066d28c2af679c060a6e1d
Deleted: sha256:2a5d86ab68ff3d8b4fe320754f844daef9ad76e5b8a14ec1bd09f87570cd6165
Deleted: sha256:917f297dddfd0bb4fa50928e9a43a3eea526b3b985bcccda01bafdd3f4a1b90f
Deleted: sha256:f423d7575cb773000a2fbe0dca51aa215d00bd91d8fbb37c4c26378af8134813
Deleted: sha256:fa96f0e5805e6b00d2e95b6e798dfa7470fb7431855eed4399a22bc2fc270c0c
Deleted: sha256:6586cb10d4d95034a464d7dba9f2fe509bf80413e6c30ac3119330d92f20cb40
Untagged: dev-peer0.org2.example.com-mycc-1.0:latest
Deleted: sha256:8370b1cd876644e610eb2ff362f29c96538370f7d4f513e010801cfce3a63ace
Deleted: sha256:f2190cdc9c8235ab0d9f37975a71923c7fd498fa517533e527d87bbaddbbf4ea
Deleted: sha256:e5d2ead105e3246c0cdcc1be6c8ac78fb11d959564839a2b41c147962e37cbb4
Deleted: sha256:a592dd4f7d4346b5921d6dc7fd48652bfa70907e40e04942382cdd16329be9ef
Deleted: sha256:92bae31265fc9a8bbcf394328f7855a64ef8c13b1885e21015b5accc7b9e487c
Deleted: sha256:5b34425a5f4db01b75d04a1b4f9acd367a9378a5834f77b99c441df323d1e52b
Deleted: sha256:4298b29759ca67c745a5fca6da441dd2e74d1a4802159afd1fd001a354b33d73
halfape@halfape-VirtualBox:~/go/src/github.com/hyperledger/fabric/examples/e2e_cli$ 

参考文章:

https://blog.csdn.net/jambeau/article/details/103712408
https://www.cnblogs.com/studyzy/p/7437157.html

写在最后

感谢上面两位大佬的贡献,我个人在此基础上进行了整合,自己也是排了很多雷,终于成功了。如果你觉得这篇文章对你有所帮助,关注微信公众号半路猿,拉你进我们的学习交流群,一起学习,一同成长。

 
打赏
 本文转载自:网络 
所有权利归属于原作者,如文章来源标示错误或侵犯了您的权利请联系微信13520258486
更多>最近资讯中心
更多>最新资讯中心
0相关评论

推荐图文
推荐资讯中心
点击排行
最新信息
新手指南
采购商服务
供应商服务
交易安全
关注我们
手机网站:
新浪微博:
微信关注:

13520258486

周一至周五 9:00-18:00
(其他时间联系在线客服)

24小时在线客服