fabric-byfn.sh名利解析

常用命令:

genesis block, then bring up the network. e.g.:

byfn.sh generate -c mychannel
byfn.sh up -c mychannel -s couchdb
byfn.sh up -c mychannel -s couchdb -i 1.2.x
byfn.sh up -l node
byfn.sh down -c mychannel
byfn.sh upgrade -c mychannel:网络有1.1.x升级到1.2.x

Taking all defaults:
byfn.sh generate:生成证书及创始区块
byfn.sh up:启动网络

byfn.sh restart:重启网络
byfn.sh down:清除网络

 

e2e测试
sudo /home/fabric/hyfa/fabric-samples/first-network/byfn.sh -m down
sudo /home/fabric/hyfa/fabric-samples/first-network/byfn.sh -m generate
sudo /home/fabric/hyfa/fabric-samples/first-network/byfn.sh -m up

BYFN——构建你的第一个网络,该方案提供了一个示例Hyperledger Fabric网络,该网络由两个组织组成,每个组织都维护两个对等节点,以及一个solo排序服务。该案例是fabric官方文档的第一个案例,也是市面上几乎所有Fabric教材和课程必讲的内容,其启动过程的重要性也就不言而喻了,可官方文档太长了,信息笔者初次看的时候就没看完,后来根据启动脚本分析了一遍后,再去看的时候就轻轻松松看完了,在此记下自己的经历!

BYFN启动脚本为fabric-samples/first-network/byfn.sh , 其操作主要包括 generate、up、down,笔者将从这三个方面对其进行分析。

 

1、byfn.sh -m generate 分析
gengerate 作用为生成网络初始化配置,包括MSP证书、私钥、创世区块和配置交易等文件,MSP相关的信息在crypto-config文件夹中,创世区块在channel-artifacts文件夹中,MSP证书和私钥用于不同的网络实体,创世块用于启动排序服务,配置交易文件用于配置通道。

generate的日志信息如下:

root@VM-0-17-ubuntu:/opt/gopath/src/github.com/hyperledger/fabric-samples/first-network# ./byfn.sh -m generate
Generating certs and genesis block for with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue (y/n)? y
proceeding ...
/opt/gopath/src/github.com/hyperledger/fabric-samples/first-network/../bin/cryptogen

##########################################################
##### Generate certificates using cryptogen tool #########(1)创建证书
##########################################################
org1.example.com
org2.example.com

/opt/gopath/src/github.com/hyperledger/fabric-samples/first-network/../bin/configtxgen
##########################################################
######### Generating Orderer Genesis block ##############(2)生成创世块
##########################################################
2018-04-17 00:41:28.412 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2018-04-17 00:41:28.454 CST [common/configtx/tool] doOutputBlock -> INFO 002 Generating genesis block
2018-04-17 00:41:28.455 CST [common/configtx/tool] doOutputBlock -> INFO 003 Writing genesis block

#################################################################
### Generating channel configuration transaction 'channel.tx' ###(3)生成通道配置交易文件
#################################################################
2018-04-17 00:41:28.463 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2018-04-17 00:41:28.467 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 002 Generating new channel configtx
2018-04-17 00:41:28.467 CST [common/configtx/tool] doOutputChannelCreateTx -> INFO 003 Writing new channel tx

#################################################################
####### Generating anchor peer update for Org1MSP ##########(4)在通道上为Org1定义一个锚节点
#################################################################
2018-04-17 00:41:28.475 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2018-04-17 00:41:28.479 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2018-04-17 00:41:28.479 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update

#################################################################
####### Generating anchor peer update for Org2MSP ##########(5)在通道上为Org2定义一个锚节点
#################################################################
2018-04-17 00:41:28.487 CST [common/configtx/tool] main -> INFO 001 Loading configuration
2018-04-17 00:41:28.490 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 002 Generating anchor peer update
2018-04-17 00:41:28.491 CST [common/configtx/tool] doOutputAnchorPeersUpdate -> INFO 003 Writing anchor peer update
在byfn.sh脚本上,依次执行了 generateCerts、  replacePrivateKey、  generateChannelArtifacts三个函数,其中:

generateCerts执行上述(1)中操作;replacePrivateKey将Org1、Org2的证书私钥文件配置到docker-compose-e2e.yaml文件中,以便于后续网络启动时候使用;generateChannelArtifacts执行上述中(2)-(5)中的操作。

 

2、byfn.sh -m up 分析
up的功能为启动超级账本网络,在启动之前会先检查本地是否有crypto-config文件夹,若没有则会执行generate操作,有则直接根据$IF_COUCHDB和$COMPOSE_FILE变量来选择对应的docker compose配置文件,进而启动网络,默认的goleveldb数据库对应的配置文件为docker-compose-cli.yaml,若启动参数设置为couchdb则对应的配置文件为docker-compose-couch.yaml。docker compose启动docker-compose-cli.yaml 后最后创建的为cli容器,并执行了fabric-samples/first-network/scripts/script.sh脚本,srcipt.sh脚本完成创建通道、加入通道、更新锚节点、安装-初始化-执行链码等一系列的操作。

up的日志信息如下:

root@VM-0-17-ubuntu:/opt/gopath/src/github.com/hyperledger/fabric-samples/first-network# ./byfn.sh -m up
Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue (y/n)? y
proceeding ...(1)配置容器网络,创建各类容器
Creating peer1.org1.example.com ... done
Creating cli ... done
Creating orderer.example.com ...
Creating peer0.org1.example.com ...
Creating peer1.org1.example.com ...
Creating peer1.org2.example.com ...
Creating cli ...

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

Build your first network (BYFN) end-to-end test

Channel name : mychannel
Creating channel...(2)创建通道
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-16 16:49:43.604 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:49:43.604 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:49:43.604 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls: no such file or directory]
2018-04-16 16:49:43.604 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:49:43.644 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:49:43.644 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:49:43.654 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2018-04-16 16:49:43.654 UTC [msp] GetLocalMSP -> DEBU 008 Returning existing local MSP
2018-04-16 16:49:43.654 UTC [msp] GetDefaultSigningIdentity -> DEBU 009 Obtaining default signing identity
2018-04-16 16:49:43.654 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-04-16 16:49:43.654 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-04-16 16:49:43.654 UTC [msp/identity] Sign -> DEBU 00c Sign: plaintext: 0A8C060A074F7267314D53501280062D...53616D706C65436F6E736F727469756D
2018-04-16 16:49:43.654 UTC [msp/identity] Sign -> DEBU 00d Sign: digest: 9446ED2723045B086882BDEDA76680F07CC628CCE2AAAC81FA74A17614511685
2018-04-16 16:49:43.655 UTC [msp] GetLocalMSP -> DEBU 00e Returning existing local MSP
2018-04-16 16:49:43.655 UTC [msp] GetDefaultSigningIdentity -> DEBU 00f Obtaining default signing identity
2018-04-16 16:49:43.655 UTC [msp] GetLocalMSP -> DEBU 010 Returning existing local MSP
2018-04-16 16:49:43.655 UTC [msp] GetDefaultSigningIdentity -> DEBU 011 Obtaining default signing identity
2018-04-16 16:49:43.655 UTC [msp/identity] Sign -> DEBU 012 Sign: plaintext: 0AC3060A1508021A0608A7A8D3D60522...5C82BA88FD816FCCBC1F6211ED2BE0FF
2018-04-16 16:49:43.655 UTC [msp/identity] Sign -> DEBU 013 Sign: digest: E2221B4CA758306334D633A4ECF6D5DDAB34C69743F5E5AA9B7BBAE0CB49CAC8
2018-04-16 16:49:43.814 UTC [msp] GetLocalMSP -> DEBU 014 Returning existing local MSP
2018-04-16 16:49:43.815 UTC [msp] GetDefaultSigningIdentity -> DEBU 015 Obtaining default signing identity
2018-04-16 16:49:43.815 UTC [msp] GetLocalMSP -> DEBU 016 Returning existing local MSP
2018-04-16 16:49:43.815 UTC [msp] GetDefaultSigningIdentity -> DEBU 017 Obtaining default signing identity
2018-04-16 16:49:43.815 UTC [msp/identity] Sign -> DEBU 018 Sign: plaintext: 0AC3060A1508021A0608A7A8D3D60522...9FA1FF33BE3512080A021A0012021A00
2018-04-16 16:49:43.815 UTC [msp/identity] Sign -> DEBU 019 Sign: digest: 2F84BA609381867A09A4119F945B89A106A40C33FA9D1012F7BD3F81E79CBB39
2018-04-16 16:49:43.925 UTC [channelCmd] readBlock -> DEBU 01a Got status:*orderer.DeliverResponse_Status
2018-04-16 16:49:43.926 UTC [msp] GetLocalMSP -> DEBU 01b Returning existing local MSP
2018-04-16 16:49:43.926 UTC [msp] GetDefaultSigningIdentity -> DEBU 01c Obtaining default signing identity
2018-04-16 16:49:43.929 UTC [channelCmd] InitCmdFactory -> INFO 01d Endorser and orderer connections initialized
2018-04-16 16:49:44.130 UTC [msp] GetLocalMSP -> DEBU 01e Returning existing local MSP
2018-04-16 16:49:44.130 UTC [msp] GetDefaultSigningIdentity -> DEBU 01f Obtaining default signing identity
2018-04-16 16:49:44.130 UTC [msp] GetLocalMSP -> DEBU 020 Returning existing local MSP
2018-04-16 16:49:44.130 UTC [msp] GetDefaultSigningIdentity -> DEBU 021 Obtaining default signing identity
2018-04-16 16:49:44.130 UTC [msp/identity] Sign -> DEBU 022 Sign: plaintext: 0AC3060A1508021A0608A8A8D3D60522...40C9C6B9F09512080A021A0012021A00
2018-04-16 16:49:44.130 UTC [msp/identity] Sign -> DEBU 023 Sign: digest: B1AD5E7112E5597EBAB6223BE5CF61EC0F805FFBC3AE257F1125301E5D94E928
2018-04-16 16:49:44.134 UTC [channelCmd] readBlock -> DEBU 024 Received block:0
2018-04-16 16:49:44.135 UTC [main] main -> INFO 025 Exiting.....
===================== Channel "mychannel" is created successfully =====================

Having all peers join the channel...(3)将所有的节点加入到该通道中
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-16 16:49:44.163 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:49:44.163 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:49:44.163 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls: no such file or directory]
2018-04-16 16:49:44.163 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:49:44.185 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:49:44.185 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:49:44.188 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2018-04-16 16:49:44.188 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A89070A5B08011A0B08A8A8D3D60510...31457AEC467A1A080A000A000A000A00
2018-04-16 16:49:44.188 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 7387368451C22AB49F96338B31937B864694C39A01E9A459B440D32B9F10AA81
2018-04-16 16:49:44.272 UTC [channelCmd] executeJoin -> INFO 00a Peer joined the channel!
2018-04-16 16:49:44.272 UTC [main] main -> INFO 00b Exiting.....
===================== PEER0 joined on the channel "mychannel" =====================(3-1)PEER0(orgt1的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=peer1.org1.example.com:7051
2018-04-16 16:49:47.308 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:49:47.308 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:49:47.308 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls: no such file or directory]
2018-04-16 16:49:47.308 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:49:47.344 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:49:47.344 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:49:47.363 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2018-04-16 16:49:47.363 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8A070A5C08011A0C08ABA8D3D60510...31457AEC467A1A080A000A000A000A00
2018-04-16 16:49:47.363 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: F801028E1F3C0CD87FFFF48E45C9A7BBF73852C6800418495CD5AE64D8FF7297
2018-04-16 16:49:47.450 UTC [channelCmd] executeJoin -> INFO 00a Peer joined the channel!
2018-04-16 16:49:47.450 UTC [main] main -> INFO 00b Exiting.....
===================== PEER1 joined on the channel "mychannel" =====================(3-2)PEER1(org1的peer1)加入通道


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-16 16:49:50.484 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:49:50.485 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:49:50.485 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls: no such file or directory]
2018-04-16 16:49:50.485 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:49:50.505 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:49:50.505 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:49:50.508 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2018-04-16 16:49:50.509 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8A070A5C08011A0C08AEA8D3D60510...31457AEC467A1A080A000A000A000A00
2018-04-16 16:49:50.509 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: 66095CFC073C185E137AF61F0CAD455631B35BC943E67E49F58482C0F3D1CB52
2018-04-16 16:49:50.595 UTC [channelCmd] executeJoin -> INFO 00a Peer joined the channel!
2018-04-16 16:49:50.595 UTC [main] main -> INFO 00b Exiting.....
===================== PEER2 joined on the channel "mychannel" =====================(3-3)PEER2(org2的peer0)加入通道


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-16 16:49:53.636 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:49:53.636 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:49:53.636 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls: no such file or directory]
2018-04-16 16:49:53.636 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:49:53.659 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:49:53.659 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:49:53.678 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2018-04-16 16:49:53.678 UTC [msp/identity] Sign -> DEBU 008 Sign: plaintext: 0A8A070A5C08011A0C08B1A8D3D60510...31457AEC467A1A080A000A000A000A00
2018-04-16 16:49:53.678 UTC [msp/identity] Sign -> DEBU 009 Sign: digest: EF786ACA90A5060D088CDB879DC2A8ED15379B94DC6361A90456F7E392A70ECB
2018-04-16 16:49:53.765 UTC [channelCmd] executeJoin -> INFO 00a Peer joined the channel!
2018-04-16 16:49:53.765 UTC [main] main -> INFO 00b Exiting.....
===================== PEER3 joined on the channel "mychannel" =====================(3-4)PEER3(org2的peer1)加入通道


Updating anchor peers for org1...(4)配置锚节点 (4-1)为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-16 16:49:56.798 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:49:56.798 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:49:56.798 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls: no such file or directory]
2018-04-16 16:49:56.798 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:49:56.816 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:49:56.816 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:49:56.820 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2018-04-16 16:49:56.820 UTC [msp] GetLocalMSP -> DEBU 008 Returning existing local MSP
2018-04-16 16:49:56.820 UTC [msp] GetDefaultSigningIdentity -> DEBU 009 Obtaining default signing identity
2018-04-16 16:49:56.820 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-04-16 16:49:56.820 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-04-16 16:49:56.820 UTC [msp/identity] Sign -> DEBU 00c Sign: plaintext: 0A8C060A074F7267314D53501280062D...731200220B0A07577269746572731200
2018-04-16 16:49:56.820 UTC [msp/identity] Sign -> DEBU 00d Sign: digest: 322C963A585C3A71285435A825F4AC2646FD8E56279E05BFC991116DCE37F72C
2018-04-16 16:49:56.820 UTC [msp] GetLocalMSP -> DEBU 00e Returning existing local MSP
2018-04-16 16:49:56.820 UTC [msp] GetDefaultSigningIdentity -> DEBU 00f Obtaining default signing identity
2018-04-16 16:49:56.820 UTC [msp] GetLocalMSP -> DEBU 010 Returning existing local MSP
2018-04-16 16:49:56.820 UTC [msp] GetDefaultSigningIdentity -> DEBU 011 Obtaining default signing identity
2018-04-16 16:49:56.820 UTC [msp/identity] Sign -> DEBU 012 Sign: plaintext: 0AC3060A1508021A0608B4A8D3D60522...C106E9916000C23FD713A49C4448B4CA
2018-04-16 16:49:56.820 UTC [msp/identity] Sign -> DEBU 013 Sign: digest: C3381FBB58A38E83B977D3A8F3A3DDE9E0DDDC3486E07AACB44D9BABD6954B4E
2018-04-16 16:49:56.858 UTC [main] main -> INFO 014 Exiting.....
===================== Anchor peers for org "Org1MSP" on "mychannel" is updated successfully =====================

Updating anchor peers for org2...(4-2)为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-16 16:49:59.895 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:49:59.895 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:49:59.895 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls: no such file or directory]
2018-04-16 16:49:59.895 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:49:59.921 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:49:59.921 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:49:59.929 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2018-04-16 16:49:59.929 UTC [msp] GetLocalMSP -> DEBU 008 Returning existing local MSP
2018-04-16 16:49:59.929 UTC [msp] GetDefaultSigningIdentity -> DEBU 009 Obtaining default signing identity
2018-04-16 16:49:59.930 UTC [msp] GetLocalMSP -> DEBU 00a Returning existing local MSP
2018-04-16 16:49:59.930 UTC [msp] GetDefaultSigningIdentity -> DEBU 00b Obtaining default signing identity
2018-04-16 16:49:59.930 UTC [msp/identity] Sign -> DEBU 00c Sign: plaintext: 0A8C060A074F7267324D53501280062D...731200220B0A07577269746572731200
2018-04-16 16:49:59.930 UTC [msp/identity] Sign -> DEBU 00d Sign: digest: DA35B6288D23BDFF76AA6998AC7EEF3C7B4C5E2D5F9C70B24702657D4F556943
2018-04-16 16:49:59.930 UTC [msp] GetLocalMSP -> DEBU 00e Returning existing local MSP
2018-04-16 16:49:59.930 UTC [msp] GetDefaultSigningIdentity -> DEBU 00f Obtaining default signing identity
2018-04-16 16:49:59.930 UTC [msp] GetLocalMSP -> DEBU 010 Returning existing local MSP
2018-04-16 16:49:59.930 UTC [msp] GetDefaultSigningIdentity -> DEBU 011 Obtaining default signing identity
2018-04-16 16:49:59.930 UTC [msp/identity] Sign -> DEBU 012 Sign: plaintext: 0AC3060A1508021A0608B7A8D3D60522...76D206F0F4EFCF706F4CE391CD683BB1
2018-04-16 16:49:59.930 UTC [msp/identity] Sign -> DEBU 013 Sign: digest: 861D5554543AE2F4C4E35A47EDCD996B4F24F79BAB0DD2C64F056E7A99035F32
2018-04-16 16:49:59.971 UTC [main] main -> INFO 014 Exiting.....
===================== Anchor peers for org "Org2MSP" on "mychannel" is updated successfully =====================

Installing chaincode on org1/peer0...(5)链码操作 (5-1)在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-16 16:50:03.003 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:50:03.003 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:50:03.003 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls: no such file or directory]
2018-04-16 16:50:03.003 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:50:03.064 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:50:03.064 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:50:03.064 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 007 Using default escc
2018-04-16 16:50:03.064 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 008 Using default vscc
2018-04-16 16:50:03.160 UTC [golang-platform] getCodeFromFS -> DEBU 009 getCodeFromFS github.com/chaincode/chaincode_example02/go/
2018-04-16 16:50:03.323 UTC [golang-platform] func1 -> DEBU 00a Discarding GOROOT package fmt
2018-04-16 16:50:03.323 UTC [golang-platform] func1 -> DEBU 00b Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2018-04-16 16:50:03.323 UTC [golang-platform] func1 -> DEBU 00c Discarding provided package github.com/hyperledger/fabric/protos/peer
2018-04-16 16:50:03.323 UTC [golang-platform] func1 -> DEBU 00d Discarding GOROOT package strconv
2018-04-16 16:50:03.323 UTC [golang-platform] GetDeploymentPayload -> DEBU 00e done
2018-04-16 16:50:03.325 UTC [msp/identity] Sign -> DEBU 00f Sign: plaintext: 0A8A070A5C08031A0C08BBA8D3D60510...F619FF0E0000FFFFACD4020D001C0000
2018-04-16 16:50:03.325 UTC [msp/identity] Sign -> DEBU 010 Sign: digest: 25E15A5C9A37538928052AF2557C4D5093FAB5C8E6D77095A08CE076F01C1EE6
2018-04-16 16:50:03.331 UTC [chaincodeCmd] install -> DEBU 011 Installed remotely response:<status:200 payload:"OK" >
2018-04-16 16:50:03.331 UTC [main] main -> INFO 012 Exiting.....
===================== Chaincode is installed on remote peer PEER0 =====================

Install chaincode on org2/peer2...(5-2)在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-16 16:50:03.361 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:50:03.361 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:50:03.361 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls: no such file or directory]
2018-04-16 16:50:03.361 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:50:03.388 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:50:03.388 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:50:03.388 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 007 Using default escc
2018-04-16 16:50:03.388 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 008 Using default vscc
2018-04-16 16:50:03.476 UTC [golang-platform] getCodeFromFS -> DEBU 009 getCodeFromFS github.com/chaincode/chaincode_example02/go/
2018-04-16 16:50:03.635 UTC [golang-platform] func1 -> DEBU 00a Discarding GOROOT package fmt
2018-04-16 16:50:03.635 UTC [golang-platform] func1 -> DEBU 00b Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2018-04-16 16:50:03.635 UTC [golang-platform] func1 -> DEBU 00c Discarding provided package github.com/hyperledger/fabric/protos/peer
2018-04-16 16:50:03.635 UTC [golang-platform] func1 -> DEBU 00d Discarding GOROOT package strconv
2018-04-16 16:50:03.635 UTC [golang-platform] GetDeploymentPayload -> DEBU 00e done
2018-04-16 16:50:03.636 UTC [msp/identity] Sign -> DEBU 00f Sign: plaintext: 0A8A070A5C08031A0C08BBA8D3D60510...F619FF0E0000FFFFACD4020D001C0000
2018-04-16 16:50:03.636 UTC [msp/identity] Sign -> DEBU 010 Sign: digest: 52F065F4A5A31D2737E6A380AFD5FC302A15C3976B809F560627B1EECC0FA0BD
2018-04-16 16:50:03.644 UTC [chaincodeCmd] install -> DEBU 011 Installed remotely response:<status:200 payload:"OK" >
2018-04-16 16:50:03.644 UTC [main] main -> INFO 012 Exiting.....
===================== Chaincode is installed on remote peer PEER2 =====================

Instantiating chaincode on org2/peer2...(5-3)在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-16 16:50:03.684 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:50:03.684 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:50:03.684 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls: no such file or directory]
2018-04-16 16:50:03.684 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:50:03.721 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:50:03.721 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:50:03.725 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 007 Using default escc
2018-04-16 16:50:03.725 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 008 Using default vscc
2018-04-16 16:50:03.726 UTC [msp/identity] Sign -> DEBU 009 Sign: plaintext: 0A95070A6708031A0C08BBA8D3D60510...324D53500A04657363630A0476736363
2018-04-16 16:50:03.726 UTC [msp/identity] Sign -> DEBU 00a Sign: digest: A28ADB7847779748A9D2C017443F44EC040E6B4C5AD5A65A1BD2E177346037A8
2018-04-16 16:50:33.340 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A95070A6708031A0C08BBA8D3D60510...F643949B1AAD248D2662B19249FB451B
2018-04-16 16:50:33.340 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 230E103BE1059EB3764AD6EAC0CE6C785063A5A597CA04535FA91A751A693534
2018-04-16 16:50:33.344 UTC [main] main -> INFO 00d Exiting.....
===================== Chaincode Instantiation on PEER2 on channel 'mychannel' is successful =====================

Querying chaincode on org1/peer0...(5-4)执行query操作
===================== 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-16 16:50:36.412 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:50:36.412 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:50:36.412 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls: no such file or directory]
2018-04-16 16:50:36.412 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:50:36.444 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:50:36.444 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:50:36.444 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 007 Using default escc
2018-04-16 16:50:36.444 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 008 Using default vscc
2018-04-16 16:50:36.444 UTC [msp/identity] Sign -> DEBU 009 Sign: plaintext: 0A95070A6708031A0C08DCA8D3D60510...6D7963631A0A0A0571756572790A0161
2018-04-16 16:50:36.444 UTC [msp/identity] Sign -> DEBU 00a Sign: digest: 79AD20D743C6A88C998AC1C4C77C704AE1D2D1267F05D7D32595F3D2F63E644C
Query Result: 100
2018-04-16 16:50:59.876 UTC [main] main -> INFO 00b Exiting.....
===================== Query on PEER0 on channel 'mychannel' is successful =====================
Sending invoke transaction on org1/peer0...(5-5)执行invoke操作
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-16 16:51:00.052 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:51:00.052 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:51:00.052 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls: no such file or directory]
2018-04-16 16:51:00.052 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:51:00.085 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:51:00.085 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:51:00.088 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 007 Using default escc
2018-04-16 16:51:00.088 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 008 Using default vscc
2018-04-16 16:51:00.089 UTC [msp/identity] Sign -> DEBU 009 Sign: plaintext: 0A94070A6608031A0B08F4A8D3D60510...696E766F6B650A01610A01620A023130
2018-04-16 16:51:00.089 UTC [msp/identity] Sign -> DEBU 00a Sign: digest: 4641A54D852486C075129E3F19CB7777DB38AA1BAB2652C3CFD92B5AFDB97C54
2018-04-16 16:51:00.107 UTC [msp/identity] Sign -> DEBU 00b Sign: plaintext: 0A94070A6608031A0B08F4A8D3D60510...3BE1BF33CC319B542AE9E5147739325E
2018-04-16 16:51:00.107 UTC [msp/identity] Sign -> DEBU 00c Sign: digest: 6245296F4A4DAAB60986EEAE31420B6A1163818AE62BE8D4DFEA913AD45E5BBB
2018-04-16 16:51:00.110 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> DEBU 00d ESCC invoke result: version:1 response:<status:200 message:"OK" > payload:"\n \306\232\"\260\244,\234\324\263\021\376\325\312\370\002\030\221 \212R.q\246\007\001\307\271rV\237\334\005\022Y\nE\022\024\n\004lscc\022\014\n\n\n\004mycc\022\002\010\003\022-\n\004mycc\022%\n\007\n\001a\022\002\010\003\n\007\n\001b\022\002\010\003\032\007\n\001a\032\00290\032\010\n\001b\032\003210\032\003\010\310\001\"\013\022\004mycc\032\0031.0" endorsement:<endorser:"\n\007Org1MSP\022\374\005-----BEGIN -----\nMIICGDCCAb+gAwIBAgIQNMk/6oe9nv59nfY5UqOrGjAKBggqhkjOPQQDAjBzMQsw\nCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy\nYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu\nb3JnMS5leGFtcGxlLmNvbTAeFw0xODA0MTYxNjQ5MzlaFw0yODA0MTMxNjQ5Mzla\nMFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T\nYW4gRnJhbmNpc2NvMR8wHQYDVQQDExZwZWVyMC5vcmcxLmV4YW1wbGUuY29tMFkw\nEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEsJcLt2s0ZxSrHyMcgCXe9os8plqTtdX5\nfYNd61IZJ1Fv4a5rHMnXFPJ9NemoIDZjENGDX+pFFeEA3bj2QffVbKNNMEswDgYD\nVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAg2zNFuR8577Mf\neYc49BNvW7pZ6iR/h4WkhxU799509E4wCgYIKoZIzj0EAwIDRwAwRAIgerYUzXci\nyxW1S3/N3B+KelJmdpDp2YlhgPg00BAyCZoCIA/m0Ya3v559KucqOpd1havAw5T6\nsyg2wAVDlbtS7QUG\n-----END -----\n" signature:"0E\002!\000\3225\000K\t\\\2374\356ueu\244\032~\251\254ph\332\030+\222vG\327/\2506\337\032L\002 \005r\362\346\231u\355g\337z\221\005e\341\033o;\341\2773\3141\233T*\351\345\024w92^" >
2018-04-16 16:51:00.110 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 00e Chaincode invoke successful. result: status:200
2018-04-16 16:51:00.110 UTC [main] main -> INFO 00f Exiting.....
===================== Invoke transaction on PEER0 on channel 'mychannel' is successful =====================

Installing chaincode on org2/peer3...(5-6)在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-16 16:51:00.142 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:51:00.142 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:51:00.142 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls: no such file or directory]
2018-04-16 16:51:00.142 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:51:00.168 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:51:00.168 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:51:00.168 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 007 Using default escc
2018-04-16 16:51:00.168 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 008 Using default vscc
2018-04-16 16:51:00.223 UTC [golang-platform] getCodeFromFS -> DEBU 009 getCodeFromFS github.com/chaincode/chaincode_example02/go/
2018-04-16 16:51:00.402 UTC [golang-platform] func1 -> DEBU 00a Discarding GOROOT package fmt
2018-04-16 16:51:00.402 UTC [golang-platform] func1 -> DEBU 00b Discarding provided package github.com/hyperledger/fabric/core/chaincode/shim
2018-04-16 16:51:00.402 UTC [golang-platform] func1 -> DEBU 00c Discarding provided package github.com/hyperledger/fabric/protos/peer
2018-04-16 16:51:00.402 UTC [golang-platform] func1 -> DEBU 00d Discarding GOROOT package strconv
2018-04-16 16:51:00.402 UTC [golang-platform] GetDeploymentPayload -> DEBU 00e done
2018-04-16 16:51:00.403 UTC [msp/identity] Sign -> DEBU 00f Sign: plaintext: 0A8A070A5C08031A0C08F4A8D3D60510...F619FF0E0000FFFFACD4020D001C0000
2018-04-16 16:51:00.403 UTC [msp/identity] Sign -> DEBU 010 Sign: digest: 315459862B61D5E51AB94A20DB7734951AC57913FA0D2DE6597C82778ACA88AA
2018-04-16 16:51:00.409 UTC [chaincodeCmd] install -> DEBU 011 Installed remotely response:<status:200 payload:"OK" >
2018-04-16 16:51:00.409 UTC [main] main -> INFO 012 Exiting.....
===================== Chaincode is installed on remote peer PEER3 =====================

Querying chaincode on org2/peer3...(5-7)执行query操作
===================== 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-16 16:51:03.447 UTC [msp] getMspConfig -> WARN 001 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/intermediatecerts: no such file or directory]
2018-04-16 16:51:03.448 UTC [msp] getMspConfig -> WARN 002 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/tlsintermediatecerts: no such file or directory]
2018-04-16 16:51:03.448 UTC [msp] getMspConfig -> WARN 003 crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/crls: no such file or directory]
2018-04-16 16:51:03.448 UTC [msp] getMspConfig -> INFO 004 MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp/config.yaml: no such file or directory]
2018-04-16 16:51:03.497 UTC [msp] GetLocalMSP -> DEBU 005 Returning existing local MSP
2018-04-16 16:51:03.497 UTC [msp] GetDefaultSigningIdentity -> DEBU 006 Obtaining default signing identity
2018-04-16 16:51:03.497 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 007 Using default escc
2018-04-16 16:51:03.497 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 008 Using default vscc
2018-04-16 16:51:03.497 UTC [msp/identity] Sign -> DEBU 009 Sign: plaintext: 0A95070A6708031A0C08F7A8D3D60510...6D7963631A0A0A0571756572790A0161
2018-04-16 16:51:03.497 UTC [msp/identity] Sign -> DEBU 00a Sign: digest: 71796FF598D19E3901EE73B08DBF550D8EA6FBFE8FE087B60EDEEA819BAA9306
Query Result: 90
2018-04-16 16:51:25.547 UTC [main] main -> INFO 00b Exiting.....
===================== Query on PEER3 on channel 'mychannel' is successful =====================

========= All GOOD, BYFN execution completed ===========


_____ _ _ ____
| ____| | \ | | | _ \
| _| | \| | | | | |
| |___ | |\ | | |_| |
|_____| |_| \_| |____/
综上,启动网络主要事情如下所示:

(1)配置容器网络,创建各类容器

docker-compose 根据 docker-compose-cli.yaml 配置容器网络和相应的容器

(2)创建通道

script.sh执行createChannel函数创建一个通道

(3)将所有的节点加入到该通道中

script.sh执行joinChannel函数依次将4个节点加入到通道中

 

    (3-1)PEER0(org1的peer0)加入通道
    (3-2)PEER1(org1的peer1)加入通道
    (3-3)PEER2(org2的peer0)加入通道

 

    (3-4)PEER3(org2的peer1)加入通道

(4)配置锚节点 

scrip.sh脚本执行updateAnchorPeers函数依次为org1、Org2配置锚节点

 

    (4-1)为org1配置锚节点
    (4-2)为org2配置锚节点

 

(5)链码操作 

script.sh 脚本执行installChainCode、instantiateChainCode、chaincodeQuery、chaincodeInvoke等函数安装、实例化、查询、调用等操作

    (5-1)在PEER0上安装链码
    (5-2)在PEER2上安装链码
    (5-3)在PEER2上初始化链码
    (5-4)执行query操作
    (5-5)执行invoke操作
    (5-6)在PEER3上安装链码
    (5-7)执行query操作

 

3、byfn.sh -m down 分析
down的功能为关闭超级账本网络,具体包括删除容器和不必要的镜像文件,其主调函数为byfn.sh的networkDown,该函数会执行clearContainers、removeUnwantedImages函数,然后在删除generate产生的一系列文件和目录。

down的日志信息如下:

root@VM-0-17-ubuntu:/opt/gopath/src/github.com/hyperledger/fabric-samples/first-network# ./byfn.sh -m down
Stopping with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue (y/n)? y
proceeding ...(1)删除相关的容器
WARNING: The CHANNEL_NAME variable is not set. Defaulting to a blank string.
WARNING: The DELAY variable is not set. Defaulting to a blank string.
WARNING: The TIMEOUT variable is not set. Defaulting to a blank string.
Stopping peer0.org1.example.com ... done
Stopping peer1.org2.example.com ... done
Stopping orderer.example.com ... done
Stopping peer1.org1.example.com ... done
Stopping peer0.org2.example.com ... done
Removing cli ... done
Removing peer0.org1.example.com ... done
Removing peer1.org2.example.com ... done
Removing orderer.example.com ... done
Removing peer1.org1.example.com ... done
Removing peer0.org2.example.com ... done
Removing network net_byfn
WARNING: The CHANNEL_NAME variable is not set. Defaulting to a blank string.
WARNING: The DELAY variable is not set. Defaulting to a blank string.
WARNING: The TIMEOUT variable is not set. Defaulting to a blank string.
Removing network net_byfn
WARNING: Network net_byfn not found.
002e468cdba9
170f5d85d314
3b33620503ac
Untagged: dev-peer1.org2.example.com-mycc-1.0:latest(2)删除镜像
Deleted: sha256:7fad397db58136ffbf954e0a72f3c434a3950259326c138d97fc86a7296b6642
Deleted: sha256:ef2096acef7eae3d1ab6b0b20f7f7d8c759125d3626f24905cb593b55e8b85ed
Deleted: sha256:eb5e22f8804403158339edb3a54a35a6c0e8402f0aee43eab26e5873119920a4
Deleted: sha256:e15cafcb79a3ed9652d231da057d775a0d9fb29b9b1ea496ffe4c3ac6a6c0a66
Deleted: sha256:79ef483a25f7c37d74fb9818e42e19583827d92d9f4fbd4fc8e7d91db6d12599
Deleted: sha256:8697581945d43243c4f948ec9a2aaad2d1150be284872c7e179f87194e7b5667
Deleted: sha256:e2eeb15c5867c453f7d334ad367ad57a5c5f298b7cb0a4cc75a137ff82ba1aa5
Untagged: dev-peer0.org1.example.com-mycc-1.0:latest
Deleted: sha256:450a145d8868220dc42a60f9a767207df65bba76cb25428f3966724150df739a
Deleted: sha256:174485b27a3f841009e5163d2b272b513ec1c1827e51fed82aa1561ff5181004
Deleted: sha256:200f28cfe057c90071a556a593900a45b6467085735b450355371cc2523ba324
Deleted: sha256:f469bc994653b1c9d880180b4d60a29f892562c5fdc951735a549d8a90d3a0ac
Deleted: sha256:94746de84825fd293ea7fa6266b40758ce4f173a6768b95861a7c1c7346f1aa8
Deleted: sha256:021ad292a7d4976239e4e29a1fed4a3661540d75aa8df05fbe13ed51b5a41eab
Deleted: sha256:7342cd488424d969db765a86d61be699556274cd02b3b3290adc2916063a31f3
Untagged: dev-peer0.org2.example.com-mycc-1.0:latest
Deleted: sha256:5cefcfdaf561bce2f3221c3adf900de1d07b7d3d8a940d01d7fd7c1217832a7f
Deleted: sha256:161b4f823bee25a150e15c3400816c05f2f92e627909406f33710c386b29ff07
Deleted: sha256:2ef7d8c764baa7cbccce0f2f8dcdb51053f5894ffa4350869e028b5382013a6d
Deleted: sha256:49a379a5d3ae4fc848119e4e001fe1d6e59c2210582ad3572342a273113facb8
Deleted: sha256:ae022b203e0f13d0b8355a8843dd9a8260ee4e4f23d9fd2be4ab5a656c83efb1
Deleted: sha256:5d82c68f6c22af99c660898c4ca34b730fe68beddbc4e1c9cb425fd2bbd5c4a3
Deleted: sha256:fa449353db192aa55f4064dff52e0a8516ee8389ffb19a7c87ca4f798e076a71
root@VM-0-17-ubuntu:/opt/gopath/src/github.com/hyperledger/fabric-samples/first-network#
 

此处需要注意的是,clearContainers函数会执行,CONTAINER_IDS=${docker ps -aq} docker rm -f $CONTAINER_IDS操作,该操作会删除所有的容器,在测试环境下可以随便使用,在配置比较有用的docker 服务的环境下则会删除很多不必要的服务,因此需要更改该命令,配置好要保留的容器,然后删除出了该容器之外的所有容器即可,具体方法可参考笔者文章:HyperLedger Fabric笔记2--运行fabric测试网络

 

 

4、术语解释
4.1、MSP:成员管理服务提供者,成员管理服务是Peer节点、排序服务节点内置的服务,利用KPI体系颁发给成员的X.509数字证书,认证、授权和管理成员数字证书身份,提供授权的区块链操作;

4.2、PKI:公钥基础设施,一种遵循标准并且利用公钥加密技术为电子商务的开展提供一安全基础平台的技术和规范;

4.3、创世区块:Genesis Block,创世区块是初始化区块链网络或者通道的配置区块,也是连上的第一个区块;

4.4、链码:Chaincode,可独立运行的应用程序(Fabric中的智能合约),运行在基于docker的安全容器中,在启动的时候和背书节点建立gRPC连接,在运行过程中通过链码接口和背书节点进行通信,实现和账本的交互;

4.5、锚节点:Anchor Peer,是在通道配置中设置的,一个组织一般会设置一个或者多个锚节点,其它节点能够连接锚节点获取通道上存在的其它节点;

4.6、排序服务节点:Orderer,是接收交易进行排序并广播区块给Peer节点的节点,一般情况下为了避免单点问题,会部署多个排序服务节点;

4.7、通道:Channel,通道实现了数据的隔离和私密性,加入到通道中的所有Peer节点之间共享同一个账本;

原文链接:https://blog.csdn.net/u011127242/article/details/80038177

posted @ 2020-06-17 16:37  溶洞  阅读(1015)  评论(0编辑  收藏  举报