Starting for channel ‘mychannel’ with CLI timeout of ‘10’ seconds and CLI delay of ‘3’ seconds
Continue? [Y/n] y
////////// byfn.sh line:119 /////////////////////////////////////////////////////
////////// 检查版本 //////////////////////////////////////////////////////
proceeding …
LOCAL_VERSION=2.0.0
DOCKER_IMAGE_VERSION=2.0.0
////////// byfn.sh line:297 generateCerts ///////////////////////////////////
////////// 如果存在目录crypto-config,则删除之 ////////////////////////////
/root/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/…/bin/cryptogen
##########################################################
##########################################################
////////// 调用cryptogen ///////////////////////////////////
////////// 在当前目录下创建子目录crypto-configls,分层生成各成员的公私钥 /////////
////////// crypto-config.yaml描述各成员构成 //////////////////////////////
Generate CCP files for Org1 and Org2
////////// byfn.sh line:321 调用ccp-generate.sh ///////////////////////
///////// ccp-generate.sh用ccp-template.json,ccp-template.yaml为模板,生成4个文件 /////
////////// connection-org1.json,connection-org1.yaml ////////////
////////// connection-org2.json, connection-org2.yaml ////////////
///////// 用于设置组织的各节点端口, 公钥证书 /////////////
///////// 如果有3个或更多组织,需修改ccp-generate.sh ////////
///////// 在byfn.sh里并没有用到上述产生的4个文件 ////////
/root/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network/…/bin/configtxgen
##########################################################
######### Generating Orderer Genesis block ##############
##########################################################
////////// byfn.sh line:375 ///////////////////////
////////// configtxgen产生创世纪块genesis.block,用到配置文件configtx.yaml ///////
//////// SampleMultiNodeEtcdRaft:为Raft排序服务创建创世纪块,在configtx.yaml中定义///
//////// configtx.yaml定义网络参数,例如背书策略,打包区块的时间,区块大小等 ///////
//////// channelID指定系统通道的ID /////////////////////
//////// configtx.yaml定义了不少参数,需要单独描述 ////////////
#################################################################
#################################################################
////////// configtxgen产生通道channel.tx,用到配置文件configtx.yaml ///////
////////// TwoOrgsChannel:在configtx.yaml定义,定义通道的共识、容量等 ////////////////
//////// channelID指定通道的ID,不是系统通道 /////////////////////
#################################################################
####### Generating anchor peer update for Org1MSP ##########
#################################################################
////////// configtxgen设置组织1的锚节点,用到配置文件configtx.yaml ///////
////////// 产生文件Org1MSPanchors.tx ////////////////
#################################################################
####### Generating anchor peer update for Org2MSP ##########
#################################################################
////////// configtxgen设置组织2的锚节点,用到配置文件configtx.yaml ///////
////////// 产生文件Org2MSPanchors.tx ////////////////
////////// byfn.sh line:167 ,执行如下命令,启动各节点的docker ///////////////////////
///// IMAGE_TAG=latest /////////////////////////////////
///// docker-compose -f docker-compose-cli.yaml -f docker-compose-etcdraft2.yaml up -d //
///// docker-compose-etcdraft2.yaml启动4个order(order2~order5)节点的docker /////
///// docker-compose-cli.yaml启动6个节点 (order,4个peer,cli)节点的docker /////
Creating network “net_byfn” with the default driver
Creating volume “net_orderer.example.com” with default driver
Creating volume “net_peer0.org1.example.com” with default driver
Creating volume “net_peer1.org1.example.com” with default driver
Creating volume “net_peer0.org2.example.com” with default driver
Creating volume “net_peer1.org2.example.com” with default driver
Creating volume “net_orderer2.example.com” with default driver
Creating volume “net_orderer3.example.com” with default driver
Creating volume “net_orderer4.example.com” with default driver
Creating volume “net_orderer5.example.com” with default driver
Creating orderer.example.com … done
Creating peer1.org2.example.com … done
Creating orderer4.example.com … done
Creating orderer5.example.com … done
Creating peer0.org1.example.com … done
Creating peer1.org1.example.com … done
Creating peer0.org2.example.com … done
Creating orderer3.example.com … done
Creating orderer2.example.com … done
Creating cli … done
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
83c79cc4449b hyperledger/fabric-tools:latest “/bin/bash” 3 seconds ago Up Less than a second cli
b252e866db77 hyperledger/fabric-orderer:latest “orderer” 8 seconds ago Up 2 seconds 7050/tcp, 0.0.0.0:8050->8050/tcp orderer2.example.com
a4593529e3c4 hyperledger/fabric-peer:latest “peer node start” 8 seconds ago Up 3 seconds 7051/tcp, 0.0.0.0:9051->9051/tcp peer0.org2.example.com
da8fc277ffc4 hyperledger/fabric-peer:latest “peer node start” 8 seconds ago Up 3 seconds 0.0.0.0:7051->7051/tcp peer0.org1.example.com
1f2df772275e hyperledger/fabric-orderer:latest “orderer” 8 seconds ago Up 2 seconds 7050/tcp, 0.0.0.0:9050->9050/tcp orderer3.example.com
523cd6e05c01 hyperledger/fabric-orderer:latest “orderer” 8 seconds ago Up 3 seconds 7050/tcp, 0.0.0.0:11050->11050/tcp orderer5.example.com
1dbae684457c hyperledger/fabric-peer:latest “peer node start” 8 seconds ago Up 2 seconds 7051/tcp, 0.0.0.0:8051->8051/tcp peer1.org1.example.com
387057e05649 hyperledger/fabric-orderer:latest “orderer” 8 seconds ago Up 3 seconds 7050/tcp, 0.0.0.0:10050->10050/tcp orderer4.example.com
bb17140ee7d6 hyperledger/fabric-peer:latest “peer node start” 8 seconds ago Up 2 seconds 7051/tcp, 0.0.0.0:10051->10051/tcp peer1.org2.example.com
f422e2d45ee5 hyperledger/fabric-orderer:latest “orderer” 8 seconds ago Up 3 seconds 0.0.0.0:7050->7050/tcp orderer.example.com
c9bea8330020 hyperledger/fabric-tools:amd64-1.4.2 “//bin/bash -c 'FABR…” 16 minutes ago Exited (0) 16 minutes ago heuristic_euler
b1fa5fd87acc hyperledger/fabric-tools:amd64-1.4.2 “//bin/bash -c 'FABR…” 16 minutes ago Exited (0) 16 minutes ago strange_mahavira
f09fe7b6e68c bf68857e10c3 “/bin/sh -c 'bash /t…” 17 minutes ago Exited (1) 16 minutes ago cocky_lalande
7d23774ee827 515ff2fd27cc “/bin/sh -c 'bash /t…” 25 minutes ago Exited (1) 23 minutes ago hopeful_raman
9cd87922b2ed hyperledger/fabric-tools:amd64-1.4.2 “//bin/bash -c 'FABR…” 25 minutes ago Exited (0) 25 minutes ago dreamy_shannon
b707ff006624 hyperledger/fabric-tools:amd64-1.4.2 “//bin/bash -c 'FABR…” 25 minutes ago Exited (0) 25 minutes ago quirky_shannon
953e091b9583 98ff39fde1c7 “/bin/sh -c 'bash /t…” 33 minutes ago Exited (1) 25 minutes ago cocky_moore
a2789aa5ac5b hyperledger/fabric-tools:amd64-1.4.2 “//bin/bash -c 'FABR…” 3 days ago Exited (0) 3 days ago quizzical_thompson
667f70baabe0 hyperledger/fabric-tools:amd64-1.4.2 “//bin/bash -c 'FABR…” 3 days ago Exited (0) 3 days ago charming_lichterman
805216a77308 1d016c34e9f6 “/bin/sh -c 'bash /t…” 3 days ago Exited (1) 3 days ago nifty_wiles
b97772fe2542 fa953080b404 “/bin/sh -c 'bash /t…” 3 days ago Exited (1) 3 days ago optimistic_jepsen
Sleeping 15s to allow Raft cluster to complete booting
Vendoring Go dependencies …
~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/chaincode/abstore/go ~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network
~/go/src/github.com/hyperledger/fabric/scripts/fabric-samples/first-network
Finished vendoring Go dependencies
////////// byfn.sh line:186 ///////////////////////
////////// 到这里时,共启动了10个docker(4 peers, 5 orderers,1 cli ) //////////////
////////// 下面将在cli docker里执行脚本 /////////////////////////////////////
////////// docker exec cli scripts/script.sh mychannel 3 go 10 false ///////////////
///////// script.sh在一个单独的docker里设置网络(例如将节点添加到通道中) /////
//////// script.sh还将在peer节点上安装、测试链码 ////////////////////////////////
//////// script.sh完成后,将新启动3个docker,与链码有关 /////////////////////
/ | | | / \ | _ \ | |
_ \ | | / _ \ | |) | | |
) | | | / ___ \ | _ < | |
|/ || // _\ || _\ |_|
Build your first network (BYFN) end-to-end test
Channel name : mychannel
Creating channel…
Having all peers join the channel…
peer channel join -b mychannel.block
res=0
set +x
2020-04-10 00:40:07.298 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-10 00:40:07.343 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org1 joined channel ‘mychannel’ =====================
peer channel join -b mychannel.block
res=0
set +x
2020-04-10 00:40:10.453 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-10 00:40:10.481 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org1 joined channel ‘mychannel’ =====================
peer channel join -b mychannel.block
res=0
set +x
2020-04-10 00:40:13.580 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-10 00:40:13.607 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org2 joined channel ‘mychannel’ =====================
peer channel join -b mychannel.block
res=0
set +x
2020-04-10 00:40:16.713 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-10 00:40:16.740 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org2 joined channel ‘mychannel’ =====================
Updating anchor peers for org1…
Updating anchor peers for org2…
peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org2MSPanchors.tx --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
res=0
set +x
2020-04-10 00:40:22.952 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-10 00:40:22.967 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org ‘Org2MSP’ on channel ‘mychannel’ =====================
peer lifecycle chaincode package mycc.tar.gz --path github.com/hyperledger/fabric-samples/chaincode/abstore/go/ --lang golang --label mycc_1
res=0
set +x
===================== Chaincode is packaged on peer0.org1 =====================
Installing chaincode on peer0.org1…
Install chaincode on peer0.org2…
peer lifecycle chaincode install mycc.tar.gz
res=0
set +x
2020-04-10 00:40:57.744 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 001 Installed remotely: response:
2020-04-10 00:40:57.744 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode code package identifier: mycc_1:4622fb602aa60c6368716a70474dc9d9ba2776200f70eccca07a4df4360eaff3
===================== Chaincode is installed on peer0.org2 =====================
peer lifecycle chaincode queryinstalled
res=0
set +x
Installed chaincodes on peer:
Package ID: mycc_1:4622fb602aa60c6368716a70474dc9d9ba2776200f70eccca07a4df4360eaff3, Label: mycc_1
PackageID is mycc_1:4622fb602aa60c6368716a70474dc9d9ba2776200f70eccca07a4df4360eaff3
===================== Query installed successful on peer0.org1 on channel =====================
peer lifecycle chaincode approveformyorg --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 --channelID mychannel --name mycc --version 1 --init-required --package-id mycc_1:4622fb602aa60c6368716a70474dc9d9ba2776200f70eccca07a4df4360eaff3 --sequence 1 --waitForEvent
set +x
2020-04-10 00:40:57.905 UTC [cli.lifecycle.chaincode] setOrdererClient -> INFO 001 Retrieved channel (mychannel) orderer endpoint: orderer.example.com:7050
2020-04-10 00:40:59.978 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [a503f15489e81e78918bc91c6e333f8f9a88f2671341ba6fe6f489514a3a5996] committed with status (VALID) at
===================== Chaincode definition approved on peer0.org1 on channel ‘mychannel’ =====================
===================== Checking the commit readiness of the chaincode definition on peer0.org1 on channel ‘mychannel’… =====================
Attempting to check the commit readiness of the chaincode definition on peer0.org1 …3 secs
{
“approvals”: {
“Org1MSP”: true,
“Org2MSP”: false
}
}
===================== Checking the commit readiness of the chaincode definition successful on peer0.org1 on channel ‘mychannel’ =====================
===================== Checking the commit readiness of the chaincode definition on peer0.org2 on channel ‘mychannel’… =====================
{
“approvals”: {
“Org1MSP”: true,
“Org2MSP”: false
}
}
===================== Checking the commit readiness of the chaincode definition successful on peer0.org2 on channel ‘mychannel’ =====================
===================== Checking the commit readiness of the chaincode definition on peer0.org1 on channel ‘mychannel’… =====================
{
“approvals”: {
“Org1MSP”: true,
“Org2MSP”: true
}
}
===================== Checking the commit readiness of the chaincode definition successful on peer0.org1 on channel ‘mychannel’ =====================
===================== Checking the commit readiness of the chaincode definition on peer0.org2 on channel ‘mychannel’… =====================
Attempting to check the commit readiness of the chaincode definition on peer0.org2 …3 secs
{
“approvals”: {
“Org1MSP”: true,
“Org2MSP”: true
}
}
===================== Checking the commit readiness of the chaincode definition successful on peer0.org2 on channel ‘mychannel’ =====================
===================== Querying chaincode definition on peer0.org1 on channel ‘mychannel’… =====================
Attempting to Query committed status on peer0.org1 …3 secs
Committed chaincode definition for chaincode ‘mycc’ on channel ‘mychannel’:
Version: 1, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
===================== Query chaincode definition successful on peer0.org1 on channel ‘mychannel’ =====================
===================== Querying chaincode definition on peer0.org2 on channel ‘mychannel’… =====================
Attempting to Query committed status on peer0.org2 …3 secs
Committed chaincode definition for chaincode ‘mycc’ on channel ‘mychannel’:
Version: 1, Sequence: 1, Endorsement Plugin: escc, Validation Plugin: vscc, Approvals: [Org1MSP: true, Org2MSP: true]
===================== Query chaincode definition successful on peer0.org2 on channel ‘mychannel’ =====================
Querying chaincode on peer0.org1…
===================== Querying on peer0.org1 on channel ‘mychannel’… =====================
Attempting to Query peer0.org1 …3 secs
100
===================== Query successful on peer0.org1 on channel ‘mychannel’ =====================
Sending invoke transaction on peer0.org1 peer0.org2…
Querying chaincode on peer0.org1…
===================== Querying on peer0.org1 on channel ‘mychannel’… =====================
90
===================== Query successful on peer0.org1 on channel ‘mychannel’ =====================
Installing chaincode on peer1.org2…
Querying chaincode on peer1.org2…
===================== Querying on peer1.org2 on channel ‘mychannel’… =====================
90
===================== Query successful on peer1.org2 on channel ‘mychannel’ =====================
========= All GOOD, BYFN execution completed ===========
| | | \ | | | _ \
| | | | | | | | |
| | | |\ | | || |
|_____| || _| |____/
//// 完成上述步骤后,将产生一些区块 ///////////
//// docker exec cli peer channel getinfo -c mychannel 获取指定通道上的区块信息
2020-04-11 01:59:17.429 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
Blockchain info: {“height”:8,“currentBlockHash”:“1A+7SUu4crYK6eprW9ZBmmkSvHISCMiSBA2O5RnfRtE=”,“previousBlockHash”:“5rxU3ntHIEtbKIfUT58lkSQ5NvLGD1DuXAQ39lbF8NQ=”}
//// docker exec cli peer channel fetch 7 -c mychannel
//// 获取指定高度(区块号)的区块,存储在docker里
2020-04-11 02:01:10.668 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2020-04-11 02:01:10.670 UTC [cli.common] readBlock -> INFO 002 Received block: 7
//// docker cp cli:/opt/gopath/src/github.com/hyperledger/fabric/peer/mychannel_7.block .
//// 从docker里复制区块7的文件到本地
//// configtxgen -inspectBlock mychannel_7.block 将区块文件转换成json格式