Hyperledger Fabric 1.0 集群部署
介绍
hyperledger fabric(超级账本)这里不做过多的描述,有兴趣的可以看概念,目前比较热门的区块链框架想对比比特币和以太坊,fabric属于联盟或者私有链,更适合商用。
硬件环境
搭建虚拟机环境(vmware workstation)文档采用的是Centos7.4,建议linux内核在3.10以上,Centos安装server版本即可。
名称 | ip | 节点标识 | 节点 | Organization |
Server1 | 192.168.166.133 | orderer | orderer.example.com | Orderer |
Server2 | 192.168.166.134 | Peer0 | peer0.org1.example.com | Org1 |
Server3 | 192.168.166.135 | Peer1 | peer1.org1.example.com | Org1 |
Server4 | 192.168.166.136 | Peer2 | peer0.org2.example.com | Org2 |
Server5 | 192.168.166.137 | Peer3 | Peer1.org2.example.com | Org2 |
操作系统安装
关闭防火墙和selinux
关闭selinux vi /etc/sysconfig/selinux #SELINUX=enabled SELINUX=disabled
root用户# setenforce 0
systemctl stop firewalld.service #停止firewall |
安装好第一台机器后通过克隆虚拟机创建peer节点,并且修改对用的主机名。
Go语言环境安装
yum -y install git
yum -y install gcc
下载地址 https://golang.org/dl/
下载最近的go1.10版本 go1.10.linux-amd64.tar.gz
上传到服务器上进行安装
解压go1.8.3.linux-amd64.tar.gz至/usr/local目录下,执行如下操作:
tar -C /usr/local/ -xzf go1.10.linux-amd64.tar.gz |
3、配置go环境变量
修改/etc/profile文件使其永久性生效,并对所有系统用户生效,在文件末尾加上如下两行代码
export PATH=$PATH:/usr/local/go/bin export GOPATH=$HOME/go |
执行修改后,继续执行:
source /etc/profile |
查看当前go版本信息,正常情况下如下视图:
Docker环境安装
根据官网的指导我们安装docker,这里我们是测试就安装docker ce版本
https://docs.docker.com/install/linux/docker-ce/centos/#os-requirements
先卸载旧版本没有可以不执行
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-selinux \ docker-engine-selinux \ docker-engine |
执行安装
sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2 |
sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo |
sudo yum install docker-ce |
启动docker测试helloworld
systemctl start docker systemctl enable docker docker run hello-world |
添加阿里云的Docker Hub镜像:
mkdir -p /etc/docker tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://obou6wyb.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker |
Docker-compose安装
curl -L https://get.daocloud.io/docker/compose/releases/download/1.20.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose docker-compose --version |
Fabric源码下载安装
直接下载地址 https://github.com/hyperledger/fabric 选对应的版本
fabric-1.0.1.tar.gz
上传至服务器
Mkdir -p /opt/go/src/github.com/hyperledger/fabric
解压fabric-1.0.1.tar.gz到fabric目录下
Fabric Docker镜像的下载
cd /opt/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 docker images |
验证环境是否成功
如果成功说明环境配置没有问题则关闭
这个做了以下操作:
1.   编译生成Fabric公私钥、证书的程序,程序在目录:fabric/release/linux-amd64/bin基于configtx.yaml生成创世区块和通道相关信息,并保存在channel-artifacts文件夹。
2. 基于crypto-config.yaml生成公私钥和证书信息,并保存在crypto-config文件夹中。
3.   基于docker-compose-cli.yaml启动1个Orderer+4Peer+1CLI的Fabric容器。
4.   在CLI启动的时候,会运行scripts/script.sh文件,这个脚本文件包含了创建Channel,加入Channel,安装Example02,运行Example02等功能。
关闭单节点的环境验证
./network_setup.sh down
配置多服务器的docker-compose文件
生成公私钥、证书、创世区块等
公私钥和证书是用于Server和Server之间的安全通信,另外要创建Channel并让其他节点加入Channel就需要创世区块,这些必备文件都可以一个命令生成,
在Order节点的e2e_cli目录下执行:
./generateArtifacts.sh mychannel |
运行这个命令后,系统会创建channel-artifacts文件夹,里面包含了mychannel这个通道相关的文件,另外还有一个crypto-config文件夹,里面包含了各个节点的公私钥和证书的信息。
在运行该命令的服务器/opt/gopath/src/github.com/hyperledger/fabric/examples/e2e_cli目录下会生成channel-artifacts和crypto-config目录,后面需要把它们拷贝到其它服务器相同的e2e_cli目录下。
修改docker-compose-base.yaml文件
在Orderer节点的目录下
/opt/go/src/github.com/hyperledger/fabric/examples/e2e_cli/base
修改docker-compose-base.yaml文件,将所有peer端口设置为7051-5053,因为是多台机器部署所有端口可以相同
如下:
# Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 #
version: '2'
services:
orderer.example.com: container_name: orderer.example.com image: hyperledger/fabric-orderer environment: - ORDERER_GENERAL_LOGLEVEL=debug - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp # enabled TLS - ORDERER_GENERAL_TLS_ENABLED=true - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt] working_dir: /opt/gopath/src/github.com/hyperledger/fabric command: orderer volumes: - ../channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block - ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp - ../crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls ports: - 7050:7050
peer0.org1.example.com: container_name: peer0.org1.example.com extends: file: peer-base.yaml service: peer-base environment: - CORE_PEER_ID=peer0.org1.example.com - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org1.example.com:7052 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP volumes: - /var/run/:/host/var/run/ - ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp - ../crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls ports: - 7051:7051 - 7052:7052 - 7053:7053
peer1.org1.example.com: container_name: peer1.org1.example.com extends: file: peer-base.yaml service: peer-base environment: - CORE_PEER_ID=peer1.org1.example.com - CORE_PEER_ADDRESS=peer1.org1.example.com:7051 - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org1.example.com:7052 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP volumes: - /var/run/:/host/var/run/ - ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp - ../crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
ports: - 7051:7051 - 7052:7052 - 7053:7053
peer0.org2.example.com: container_name: peer0.org2.example.com extends: file: peer-base.yaml service: peer-base environment: - CORE_PEER_ID=peer0.org2.example.com - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org2.example.com:7052 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051 - CORE_PEER_LOCALMSPID=Org2MSP volumes: - /var/run/:/host/var/run/ - ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp - ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls ports: - 7051:7051 - 7052:7052 - 7053:7053
peer1.org2.example.com: container_name: peer1.org2.example.com extends: file: peer-base.yaml service: peer-base environment: - CORE_PEER_ID=peer1.org2.example.com - CORE_PEER_ADDRESS=peer1.org2.example.com:7051 - CORE_PEER_CHAINCODELISTENADDRESS=peer1.org2.example.com:7052 - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:7051 - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051 - CORE_PEER_LOCALMSPID=Org2MSP volumes: - /var/run/:/host/var/run/ - ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp - ../crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls ports: - 7051:7051 - 7052:7052 - 7053:7053 |
设置orderer节点的docker-compose文件
我们复制一个yaml文件出来进行修改:
cp docker-compose-cli.yaml docker-compose-orderer.yaml
orderer服务器上我们只需要保留order设置,其他peer和cli设置都可以删除。orderer可以不设置extra_hosts。
# Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 #
version: '2'
services:
orderer.example.com: extends: file: base/docker-compose-base.yaml service: orderer.example.com container_name: orderer.example.com |
设置peer0节点的docker-compose文件
登录到peer0节点并且到目录
/opt/go/src/github.com/hyperledger/fabric/examples/e2e_cli
执行
cp docker-compose-cli.yaml docker-compose-peer.yaml并修改
如下
# Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 #
version: '2'
services:
peer0.org1.example.com: container_name: peer0.org1.example.com extends: file: base/docker-compose-base.yaml service: peer0.org1.example.com extra_hosts: - "orderer.example.com:192.168.166.133"
cli: container_name: cli image: hyperledger/fabric-tools tty: true environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_ID=cli - CORE_PEER_ADDRESS=peer0.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_TLS_ENABLED=true - 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_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_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_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer volumes: - /var/run/:/host/var/run/ - ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts depends_on: - peer0.org1.example.com extra_hosts: - "orderer.example.com:192.168.166.133" - "peer0.org1.example.com:192.168.166.134" - "peer1.org1.example.com:192.168.166.135" - "peer0.org2.example.com:192.168.166.136" - "peer1.org2.example.com:192.168.166.137" |
设置peer1节点的docker-compose文件
登录到peer1节点并且到目录
/opt/go/src/github.com/hyperledger/fabric/examples/e2e_cli
执行
cp docker-compose-cli.yaml docker-compose-peer.yaml并修改
如下
# Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 #
version: '2'
services:
peer1.org1.example.com: container_name: peer1.org1.example.com extends: file: base/docker-compose-base.yaml service: peer1.org1.example.com extra_hosts: - "orderer.example.com:192.168.166.133" - "peer0.org1.example.com:192.168.166.134"
cli: container_name: cli image: hyperledger/fabric-tools tty: true environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_ID=cli - CORE_PEER_ADDRESS=peer1.org1.example.com:7051 - CORE_PEER_LOCALMSPID=Org1MSP - CORE_PEER_TLS_ENABLED=true - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls/ca.crt - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer volumes: - /var/run/:/host/var/run/ - ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts depends_on: - peer1.org1.example.com extra_hosts: - "orderer.example.com:192.168.166.133" - "peer0.org1.example.com:192.168.166.134" - "peer1.org1.example.com:192.168.166.135" - "peer0.org2.example.com:192.168.166.136" |
设置peer2节点的docker-compose文件
登录到peer2节点并且到目录
/opt/go/src/github.com/hyperledger/fabric/examples/e2e_cli
执行
cp docker-compose-cli.yaml docker-compose-peer.yaml并修改
如下
# Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 #
version: '2'
services:
peer0.org2.example.com: container_name: peer0.org2.example.com extends: file: base/docker-compose-base.yaml service: peer0.org2.example.com extra_hosts: - "orderer.example.com:192.168.166.133"
cli: container_name: cli image: hyperledger/fabric-tools tty: true environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_ID=cli - CORE_PEER_ADDRESS=peer0.org2.example.com:7051 - CORE_PEER_LOCALMSPID=Org2MSP - CORE_PEER_TLS_ENABLED=true - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key - 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_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer volumes: - /var/run/:/host/var/run/ - ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts depends_on: - peer0.org2.example.com extra_hosts: - "orderer.example.com:192.168.166.133" - "peer0.org1.example.com:192.168.166.134" - "peer1.org1.example.com:192.168.166.135" - "peer0.org2.example.com:192.168.166.136" - "peer1.org2.example.com:192.168.166.137" |
设置peer3节点的docker-compose文件
登录到peer3节点并且到目录
/opt/go/src/github.com/hyperledger/fabric/examples/e2e_cli
执行
cp docker-compose-cli.yaml docker-compose-peer.yaml并修改
如下
# Copyright IBM Corp. All Rights Reserved. # # SPDX-License-Identifier: Apache-2.0 #
version: '2'
services:
peer1.org2.example.com: container_name: peer1.org2.example.com extends: file: base/docker-compose-base.yaml service: peer1.org2.example.com extra_hosts: - "orderer.example.com:192.168.166.133" - "peer0.org2.example.com:192.168.166.136"
cli: container_name: cli image: hyperledger/fabric-tools tty: true environment: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - CORE_LOGGING_LEVEL=DEBUG - CORE_PEER_ID=cli - CORE_PEER_ADDRESS=peer1.org2.example.com:7051 - CORE_PEER_LOCALMSPID=Org2MSP - CORE_PEER_TLS_ENABLED=true - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.crt - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/server.key - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls/ca.crt - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer volumes: - /var/run/:/host/var/run/ - ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/ - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts depends_on: - peer1.org2.example.com extra_hosts: - "orderer.example.com:192.168.166.133" - "peer0.org1.example.com:192.168.166.134" - "peer1.org1.example.com:192.168.166.135" - "peer0.org2.example.com:192.168.166.136" - "peer1.org2.example.com:192.168.166.137" |
启动Fabric多节点集群
启动orderer节点服务
docker-compose -f docker-compose-orderer.yaml up -d 对应关闭的命令 docker-compose -f docker-compose-orderer.yaml down |
启动peer节点服务
docker-compose -f docker-compose-peer.yaml up -d 对应关闭的命令 docker-compose -f docker-compose-peer.yaml down |
现在我们整个Fabric4+1服务器网络已经成型
创建channel和运行chaincode
切换到peer0.org1.example.com服务器上,使用该服务器上的cli来运行创建Channel和运行ChainCode的操作。首先需要进入cli容器,执行如下命令:
docker exec -it cli bash |
进入容器后我们可以看到命令提示变为如下所示:
root@f51b1670b48a:/opt/gopath/src/github.com/hyperledger/fabric/peer# |
说明我们已经以root的身份进入到cli容器内部。官方已经提供了完整的创建Channel和测试ChainCode的脚本,并且已经映射到cli容器内部,所以我们只需要在cli内运行如下命令:
./scripts/script.sh mychannel |
[root@peer0 e2e_cli]# docker exec -it cli bash script.sh mychannelopt/gopath/src/github.com/hyperledger/fabric/peer# ./scripts/
____ _____ _ ____ _____ _____ ____ _____ / ___| |_ _| / \ | _ \ |_ _| | ____| |___ \ | ____| \___ \ | | / _ \ | |_) | | | _____ | _| __) | | _| ___) | | | / ___ \ | _ < | | |_____| | |___ / __/ | |___ |____/ |_| /_/ \_\ |_| \_\ |_| |_____| |_____| |_____|
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 2018-04-03 05:14:56.114 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:14:56.114 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:14:56.118 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized 2018-04-03 05:14:56.118 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP 2018-04-03 05:14:56.118 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity 2018-04-03 05:14:56.118 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP 2018-04-03 05:14:56.118 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity 2018-04-03 05:14:56.118 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D 2018-04-03 05:14:56.118 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 2FE7CD4357F7C591469BD5EEB3C705F6C2F527ADF54253DEDBEEA50866476C39 2018-04-03 05:14:56.118 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP 2018-04-03 05:14:56.118 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity 2018-04-03 05:14:56.118 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP 2018-04-03 05:14:56.118 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity 2018-04-03 05:14:56.119 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608D09B8CD60522...368A3E7D7B4B5051F6578D374DFCAFC8 2018-04-03 05:14:56.119 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: FCF568D1FBC8BC8EB407EA8003E0C038CC0B3140931498D715952C170F559D5B 2018-04-03 05:14:56.174 UTC [msp] GetLocalMSP -> DEBU 010 Returning existing local MSP 2018-04-03 05:14:56.174 UTC [msp] GetDefaultSigningIdentity -> DEBU 011 Obtaining default signing identity 2018-04-03 05:14:56.174 UTC [msp] GetLocalMSP -> DEBU 012 Returning existing local MSP 2018-04-03 05:14:56.174 UTC [msp] GetDefaultSigningIdentity -> DEBU 013 Obtaining default signing identity 2018-04-03 05:14:56.174 UTC [msp/identity] Sign -> DEBU 014 Sign: plaintext: 0AC3060A1508021A0608D09B8CD60522...7981AAFD7C2E12080A021A0012021A00 2018-04-03 05:14:56.174 UTC [msp/identity] Sign -> DEBU 015 Sign: digest: 1F1FEFEB85CFFD3D797A32F9E59981DEE461B4DD7CBD36A58786D59B581A8B78 2018-04-03 05:14:56.190 UTC [channelCmd] readBlock -> DEBU 016 Got status:*orderer.DeliverResponse_Status 2018-04-03 05:14:56.190 UTC [msp] GetLocalMSP -> DEBU 017 Returning existing local MSP 2018-04-03 05:14:56.190 UTC [msp] GetDefaultSigningIdentity -> DEBU 018 Obtaining default signing identity 2018-04-03 05:14:56.219 UTC [channelCmd] InitCmdFactory -> INFO 019 Endorser and orderer connections initialized 2018-04-03 05:14:56.420 UTC [msp] GetLocalMSP -> DEBU 01a Returning existing local MSP 2018-04-03 05:14:56.420 UTC [msp] GetDefaultSigningIdentity -> DEBU 01b Obtaining default signing identity 2018-04-03 05:14:56.420 UTC [msp] GetLocalMSP -> DEBU 01c Returning existing local MSP 2018-04-03 05:14:56.420 UTC [msp] GetDefaultSigningIdentity -> DEBU 01d Obtaining default signing identity 2018-04-03 05:14:56.420 UTC [msp/identity] Sign -> DEBU 01e Sign: plaintext: 0AC3060A1508021A0608D09B8CD60522...674261A6060F12080A021A0012021A00 2018-04-03 05:14:56.420 UTC [msp/identity] Sign -> DEBU 01f Sign: digest: BE363D8AA45C05EB2F54B0F726E41AE57C3A8C3DFCE42D777AEFC018B435BC75 2018-04-03 05:14:56.423 UTC [channelCmd] readBlock -> DEBU 020 Received block:0 2018-04-03 05:14:56.423 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 2018-04-03 05:14:56.470 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:14:56.470 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:14:56.473 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized 2018-04-03 05:14:56.473 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A8A070A5C08011A0C08D09B8CD60510...01B1E7D21CBE1A080A000A000A000A00 2018-04-03 05:14:56.473 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 56490565A1DB53E56C5BCEDE6FEB4B7B7AF2E297A6F9EC3F907F23F847387D2B 2018-04-03 05:14:56.497 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel! 2018-04-03 05:14:56.497 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 2018-04-03 05:14:58.557 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:14:58.557 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:14:58.561 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized 2018-04-03 05:14:58.561 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A8A070A5C08011A0C08D29B8CD60510...01B1E7D21CBE1A080A000A000A000A00 2018-04-03 05:14:58.561 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 280B863FB316B77539CE02B9CD04F97FBE5838232DD0F1CFCDE4CE9E767BC0DC 2018-04-03 05:14:58.581 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel! 2018-04-03 05:14:58.581 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 2018-04-03 05:15:00.641 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:15:00.641 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:15:00.644 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized 2018-04-03 05:15:00.644 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A86070A5C08011A0C08D49B8CD60510...01B1E7D21CBE1A080A000A000A000A00 2018-04-03 05:15:00.644 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: C28CDA934410F5366EDCB3C57C564C34C0D9B975D02CBE1A4E7FC255BF8F548D 2018-04-03 05:15:00.668 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel! 2018-04-03 05:15:00.668 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 2018-04-03 05:15:02.719 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:15:02.719 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:15:02.723 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized 2018-04-03 05:15:02.724 UTC [msp/identity] Sign -> DEBU 004 Sign: plaintext: 0A86070A5C08011A0C08D69B8CD60510...01B1E7D21CBE1A080A000A000A000A00 2018-04-03 05:15:02.724 UTC [msp/identity] Sign -> DEBU 005 Sign: digest: 0A30162F4D3054C8EECD2117766480207F2FA753C52B0603B27EB8E9893697DF 2018-04-03 05:15:02.750 UTC [channelCmd] executeJoin -> INFO 006 Peer joined the channel! 2018-04-03 05:15:02.750 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 2018-04-03 05:15:04.815 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:15:04.815 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:15:04.820 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized 2018-04-03 05:15:04.820 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP 2018-04-03 05:15:04.820 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity 2018-04-03 05:15:04.820 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP 2018-04-03 05:15:04.820 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity 2018-04-03 05:15:04.820 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8C060A074F7267314D53501280062D...72731200220A0A0641646D696E731200 2018-04-03 05:15:04.820 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: FAEFFCBC79EC35032265CD8A22B9512B46F8DA145C0462AE7923F83256FEE013 2018-04-03 05:15:04.820 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP 2018-04-03 05:15:04.820 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity 2018-04-03 05:15:04.820 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP 2018-04-03 05:15:04.820 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity 2018-04-03 05:15:04.820 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0AC3060A1508021A0608D89B8CD60522...9D19A7DB153F8F581C096B12052A8E3B 2018-04-03 05:15:04.821 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 2C655FEEF903CC7E1910A287032DEB9A7C650DBA472EA26BB48FDCA7300FADEA 2018-04-03 05:15:04.839 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 2018-04-03 05:15:09.882 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:15:09.882 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:15:09.884 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized 2018-04-03 05:15:09.885 UTC [msp] GetLocalMSP -> DEBU 004 Returning existing local MSP 2018-04-03 05:15:09.885 UTC [msp] GetDefaultSigningIdentity -> DEBU 005 Obtaining default signing identity 2018-04-03 05:15:09.885 UTC [msp] GetLocalMSP -> DEBU 006 Returning existing local MSP 2018-04-03 05:15:09.885 UTC [msp] GetDefaultSigningIdentity -> DEBU 007 Obtaining default signing identity 2018-04-03 05:15:09.885 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A88060A074F7267324D535012FC052D...731200220B0A07526561646572731200 2018-04-03 05:15:09.885 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 765B1D75AA8AF77D8642A42059CD0968F97292409A8066CFB7294D15D98A309A 2018-04-03 05:15:09.885 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP 2018-04-03 05:15:09.885 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity 2018-04-03 05:15:09.885 UTC [msp] GetLocalMSP -> DEBU 00c Returning existing local MSP 2018-04-03 05:15:09.885 UTC [msp] GetDefaultSigningIdentity -> DEBU 00d Obtaining default signing identity 2018-04-03 05:15:09.885 UTC [msp/identity] Sign -> DEBU 00e Sign: plaintext: 0ABF060A1508021A0608DD9B8CD60522...4AB9891F3A6ABBBCEBBF8ED121EBBEBC 2018-04-03 05:15:09.885 UTC [msp/identity] Sign -> DEBU 00f Sign: digest: 26BB453597E8E901854642F036C8257829E5FD4994CAC25E57AEA241F2D3B164 2018-04-03 05:15:09.902 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 2018-04-03 05:15:14.946 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:15:14.946 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:15:14.946 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-04-03 05:15:14.946 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-04-03 05:15:15.145 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 2018-04-03 05:15:15.468 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt 2018-04-03 05:15:15.468 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim 2018-04-03 05:15:15.468 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer 2018-04-03 05:15:15.468 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv 2018-04-03 05:15:15.468 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done 2018-04-03 05:15:15.469 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A8A070A5C08031A0C08E39B8CD60510...5F74FD270000FFFFCEF44F9B002C0000 2018-04-03 05:15:15.469 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: B83F2476AF405B7C788CF3E2982BF00208A0262F4CF1BB1C3A1AE80F3C30400C 2018-04-03 05:15:15.472 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 2018-04-03 05:15:15.472 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 2018-04-03 05:15:15.524 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:15:15.524 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:15:15.524 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-04-03 05:15:15.524 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-04-03 05:15:15.581 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 2018-04-03 05:15:15.720 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt 2018-04-03 05:15:15.720 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim 2018-04-03 05:15:15.720 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer 2018-04-03 05:15:15.720 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv 2018-04-03 05:15:15.720 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done 2018-04-03 05:15:15.722 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A86070A5C08031A0C08E39B8CD60510...5F74FD270000FFFFCEF44F9B002C0000 2018-04-03 05:15:15.722 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 8A21D337B23BDF442BDCB8A0B1FB3B5B945E922FE2F184D784B3D88D3457C212 2018-04-03 05:15:15.725 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 2018-04-03 05:15:15.725 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 2018-04-03 05:15:15.777 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:15:15.777 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:15:15.780 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-04-03 05:15:15.780 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-04-03 05:15:15.780 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A91070A6708031A0C08E39B8CD60510...324D53500A04657363630A0476736363 2018-04-03 05:15:15.780 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: F1625617FCA9460C636BEC5CD098C1F009D9D0284883F1AB61B133805C71D63A 2018-04-03 05:15:51.621 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext: 0A91070A6708031A0C08E39B8CD60510...A14B550CD2E2ADE71B6BF98942F2920F 2018-04-03 05:15:51.621 UTC [msp/identity] Sign -> DEBU 008 Sign: digest: BE69CE17E7045559F6E882A2B1B30E20649257893E00BB024962439F3F00D43D 2018-04-03 05:15:51.624 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
2018-04-03 05:15:54.689 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:15:54.689 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:15:54.689 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-04-03 05:15:54.689 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-04-03 05:15:54.689 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A95070A6708031A0C088A9C8CD60510...6D7963631A0A0A0571756572790A0161 2018-04-03 05:15:54.689 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 3785CD6A2D44212C1C5917F73AC7FFAB0B0B6337039CFF0565110B07B853D465 Query Result: 100 2018-04-03 05:16:29.877 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 2018-04-03 05:16:29.926 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:16:29.926 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:16:29.930 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-04-03 05:16:29.930 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-04-03 05:16:29.931 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A95070A6708031A0C08AD9C8CD60510...696E766F6B650A01610A01620A023130 2018-04-03 05:16:29.931 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: 93FF408D00A74B15BCF3D6DC28BF7874D961C23F28917CE386AE4E90195E82DE 2018-04-03 05:16:29.939 UTC [msp/identity] Sign -> DEBU 007 Sign: plaintext: 0A95070A6708031A0C08AD9C8CD60510...9A249F05E967D9C826C1CDAFB0D0D77E 2018-04-03 05:16:29.939 UTC [msp/identity] Sign -> DEBU 008 Sign: digest: D1FDCFC6542C6CA2261129DA92AFFEFAC3C155B1A98E7E3C850E2495743D0BBF 2018-04-03 05:16:29.942 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> DEBU 009 ESCC invoke result: version:1 response:<status:200 message:"OK" > payload:"\n \031\3750\235\242Z~\243z\361\345\235N\036\0201\026oC\210@/\341\006\200\357\222\257\r\266\331]\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+gAwIBAgIQIimHlcYB2tn5DYNtAOznyTAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xODA0MDMwNDU0MzFaFw0yODAzMzEwNDU0MzFa\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEfHnjN4+bLRhwbfQeJ3S5Y/Gkd85QzEp0\nf/1ADjyWeUybslVTm51GjWVtq/iHSX1gnIxtpOSVQicHB3qCmk9EjKNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgCE/Dr6wlH52Q\nV3WuVI9sfm7dXg3SUI2tOgeAB2zlJLQwCgYIKoZIzj0EAwIDSAAwRQIhAIoPMstI\nxiKjefLaPBotnOtaBUh6+OOaanmvdhTfY3xzAiBTtcWpf/hHXI3GT69sKZMKK9Zj\nls78VkB2bONJiBcUPQ==\n-----END -----\n" signature:"0E\002!\000\316\250\223\034%z\354RK\252z+\025M\277NU\267Y\224\246\"\2132B\300\225\032N\336%e\002 W\022\315\230\340\036\022'\005\322\r,\316\351\373\000\232$\237\005\351g\331\310&\301\315\257\260\320\327~" > 2018-04-03 05:16:29.942 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 00a Chaincode invoke successful. result: status:200 2018-04-03 05:16:29.942 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 2018-04-03 05:16:29.986 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:16:29.986 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:16:29.986 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-04-03 05:16:29.986 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-04-03 05:16:30.044 UTC [golang-platform] getCodeFromFS -> DEBU 005 getCodeFromFS github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 2018-04-03 05:16:30.191 UTC [golang-platform] func1 -> DEBU 006 Discarding GOROOT package fmt 2018-04-03 05:16:30.191 UTC [golang-platform] func1 -> DEBU 007 Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim 2018-04-03 05:16:30.191 UTC [golang-platform] func1 -> DEBU 008 Discarding provided package github.com/hyperledger/fabric/protos/peer 2018-04-03 05:16:30.191 UTC [golang-platform] func1 -> DEBU 009 Discarding GOROOT package strconv 2018-04-03 05:16:30.191 UTC [golang-platform] GetDeploymentPayload -> DEBU 00a done 2018-04-03 05:16:30.194 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A85070A5B08031A0B08AE9C8CD60510...5F74FD270000FFFFCEF44F9B002C0000 2018-04-03 05:16:30.194 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 5A503BB0F9DE10D8C15E81E893F798EB24F24106891E0DC719E530520934B448 2018-04-03 05:16:30.197 UTC [chaincodeCmd] install -> DEBU 00d Installed remotely response:<status:200 payload:"OK" > 2018-04-03 05:16:30.197 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
2018-04-03 05:16:33.246 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing local MSP 2018-04-03 05:16:33.246 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity 2018-04-03 05:16:33.246 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc 2018-04-03 05:16:33.246 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc 2018-04-03 05:16:33.246 UTC [msp/identity] Sign -> DEBU 005 Sign: plaintext: 0A90070A6608031A0B08B19C8CD60510...6D7963631A0A0A0571756572790A0161 2018-04-03 05:16:33.246 UTC [msp/identity] Sign -> DEBU 006 Sign: digest: F8BA26569A966F6CE1068A914DA34C578A0F30568C7DD60F9EBA98EB4BBEF253 Query Result: 90 2018-04-03 05:17:08.588 UTC [main] main -> INFO 007 Exiting..... ===================== Query on PEER3 on channel 'mychannel' is successful =====================
===================== All GOOD, End-2-End execution completed =====================
_____ _ _ ____ _____ ____ _____ | ____| | \ | | | _ \ | ____| |___ \ | ____| | _| | \| | | | | | _____ | _| __) | | _| | |___ | |\ | | |_| | |_____| | |___ / __/ | |___ |_____| |_| \_| |____/ |_____| |_____| |_____| |
验证集群
查询账户A的存款
我们首先进入CLI,我们重新打开一个命令行窗口,输入:
docker exec -it cli bash |
运行以下命令可以查询a账户的余额:
peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}' |
可以看到余额是90:
然后,我们试一试把a账户的余额再转20元给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","20"]}' |
运行结果为:
在其他节点查询剩余