fabric添加组织

参考https://hyperledger-fabric.readthedocs.io/en/release-1.1/channel_update_tutorial.html,在fabric1.4.2 的fabric-samples中使用eyfn.sh脚本进行添加组织,先执行byfn.sh -m up再执行eyfn.sh up,以下为执行记录。

wang@wang:~/go/src/github.com/hyperledger/fabric-samples/first-network$ ./byfn.sh -m up
Starting for channel 'mychannel' with CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] 
proceeding ...
LOCAL_VERSION=1.4.2
DOCKER_IMAGE_VERSION=1.4.2
Creating network "net_byfn" with the 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_peer1.org1.example.com" with default driver
Creating volume "net_peer0.org1.example.com" with default driver
Creating volume "net_orderer.example.com" with default driver
Creating peer0.org1.example.com
Creating peer1.org1.example.com
Creating peer0.org2.example.com
Creating orderer.example.com
Creating peer1.org2.example.com
Creating cli
CONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS                    PORTS                                            NAMES
72a2c2564751        hyperledger/fabric-tools:latest     "/bin/bash"              1 second ago        Up Less than a second                                                      cli
452ae2ca7ad6        hyperledger/fabric-peer:latest      "peer node start"        5 seconds ago       Up 2 seconds              0.0.0.0:10051->10051/tcp                         peer1.org2.example.com
de7cf8d92df1        hyperledger/fabric-orderer:latest   "orderer"                5 seconds ago       Up 1 second               0.0.0.0:7050->7050/tcp                           orderer.example.com
9cfd6e2803ad        hyperledger/fabric-peer:latest      "peer node start"        5 seconds ago       Up 2 seconds              0.0.0.0:8051->8051/tcp                           peer1.org1.example.com
2de083e22717        hyperledger/fabric-peer:latest      "peer node start"        5 seconds ago       Up 2 seconds              0.0.0.0:9051->9051/tcp                           peer0.org2.example.com
6f4a1ea89f8b        hyperledger/fabric-peer:latest      "peer node start"        5 seconds ago       Up 2 seconds              0.0.0.0:7051->7051/tcp, 0.0.0.0:9999->9999/tcp   peer0.org1.example.com
aa54de8cc32d        hyperledger/fabric-ca               "sh -c 'fabric-ca-se…"   7 days ago          Exited (137) 7 days ago                                                    fabric-ca-server

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

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

Channel name : mychannel
Creating channel...
+ peer channel create -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/channel.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
2019-08-19 07:20:03.322 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:20:03.379 UTC [cli.common] readBlock -> INFO 002 Received block: 0
===================== Channel 'mychannel' created ===================== 

Having all peers join the channel...
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2019-08-19 07:20:03.490 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:20:03.555 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
2019-08-19 07:20:06.687 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:20:06.803 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
2019-08-19 07:20:09.924 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:20:09.995 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
2019-08-19 07:20:13.125 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:20:13.199 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org2 joined channel 'mychannel' ===================== 

Updating anchor peers for org1...
+ peer channel update -o orderer.example.com:7050 -c mychannel -f ./channel-artifacts/Org1MSPanchors.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
2019-08-19 07:20:16.327 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:20:16.360 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org1MSP' on channel 'mychannel' ===================== 

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
2019-08-19 07:20:19.481 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:20:19.504 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update
===================== Anchor peers updated for org 'Org2MSP' on channel 'mychannel' ===================== 

Installing chaincode on peer0.org1...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2019-08-19 07:20:22.639 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:20:22.639 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-08-19 07:20:23.187 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org1 ===================== 

Install chaincode on peer0.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
+ peer chaincode instantiate -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 -l golang -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P 'AND ('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'')'
2019-08-19 07:20:23.311 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:20:23.311 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-08-19 07:20:23.702 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org2 ===================== 

Instantiating chaincode on peer0.org2...
+ res=0
+ set +x
2019-08-19 07:20:23.824 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:20:23.824 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
===================== Chaincode is instantiated on peer0.org2 on channel 'mychannel' ===================== 

Querying chaincode on peer0.org1...
===================== Querying on peer0.org1 on channel 'mychannel'... ===================== 
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer0.org1 ...3 secs
+ res=0
+ set +x

100
===================== Query successful on peer0.org1 on channel 'mychannel' ===================== 
Sending invoke transaction on peer0.org1 peer0.org2...
+ 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 --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","10"]}'
+ res=0
+ set +x
2019-08-19 07:21:13.178 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 
===================== Invoke transaction successful on peer0.org1 peer0.org2 on channel 'mychannel' ===================== 

Installing chaincode on peer1.org2...
+ peer chaincode install -n mycc -v 1.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2019-08-19 07:21:13.314 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:21:13.314 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-08-19 07:21:13.709 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer1.org2 ===================== 

Querying chaincode on peer1.org2...
===================== Querying on peer1.org2 on channel 'mychannel'... ===================== 
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer1.org2 ...3 secs
+ res=0
+ set +x

90
===================== Query successful on peer1.org2 on channel 'mychannel' ===================== 

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


 _____   _   _   ____   
| ____| | \ | | |  _ \  
|  _|   |  \| | | | | | 
| |___  | |\  | | |_| | 
|_____| |_| \_| |____/  





wang@wang:~/go/src/github.com/hyperledger/fabric-samples/first-network$ ./eyfn.sh up
Starting with channel 'mychannel' and CLI timeout of '10' seconds and CLI delay of '3' seconds
Continue? [Y/n] 
proceeding ...
/home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/../bin/cryptogen

###############################################################
##### Generate Org3 certificates using cryptogen tool #########
###############################################################
+ cryptogen generate --config=./org3-crypto.yaml
org3.example.com
+ res=0
+ set +x

/home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/../bin/configtxgen
##########################################################
#########  Generating Org3 config material ###############
##########################################################
+ configtxgen -printOrg Org3MSP
2019-08-19 15:22:20.797 CST [common.tools.configtxgen] main -> INFO 001 Loading configuration
2019-08-19 15:22:20.833 CST [common.tools.configtxgen.localconfig] LoadTopLevel -> INFO 002 Loaded configuration: /home/wang/go/src/github.com/hyperledger/fabric-samples/first-network/org3-artifacts/configtx.yaml
2019-08-19 15:22:20.834 CST [common.tools.configtxgen.encoder] NewConsortiumOrgGroup -> WARN 003 Default policy emission is deprecated, please include policy specifications for the orderer org group Org3MSP in configtx.yaml
+ res=0
+ set +x


###############################################################
####### Generate and submit config tx to add Org3 #############
###############################################################

========= Creating config transaction to add org3 to network =========== 

Installing jq
Ign:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Ign:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Ign:3 http://security.ubuntu.com/ubuntu xenial-security Release
Ign:4 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Ign:5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages.diff/Index
Ign:6 http://security.ubuntu.com/ubuntu xenial-security/main all Packages
Ign:7 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Ign:8 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages.diff/Index
Ign:9 http://archive.ubuntu.com/ubuntu xenial Release
Ign:10 http://security.ubuntu.com/ubuntu xenial-security/restricted all Packages
Ign:11 http://archive.ubuntu.com/ubuntu xenial-updates Release
Ign:12 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages.diff/Index
Ign:13 http://archive.ubuntu.com/ubuntu xenial-backports Release
Ign:14 http://security.ubuntu.com/ubuntu xenial-security/universe all Packages
Ign:15 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages.diff/Index
Ign:16 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages.diff/Index
Ign:17 http://archive.ubuntu.com/ubuntu xenial/main all Packages
Ign:18 http://security.ubuntu.com/ubuntu xenial-security/multiverse all Packages
Ign:19 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages.diff/Index
Ign:20 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
Ign:6 http://security.ubuntu.com/ubuntu xenial-security/main all Packages
Ign:21 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
Ign:22 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
Ign:23 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages.diff/Index
Ign:10 http://security.ubuntu.com/ubuntu xenial-security/restricted all Packages
Ign:24 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
Ign:25 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages.diff/Index
Ign:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
Ign:27 http://archive.ubuntu.com/ubuntu xenial/multiverse all Packages
Ign:14 http://security.ubuntu.com/ubuntu xenial-security/universe all Packages
Ign:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages
Ign:29 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages.diff/Index
Ign:18 http://security.ubuntu.com/ubuntu xenial-security/multiverse all Packages
Ign:30 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
Ign:31 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages.diff/Index
Ign:20 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
Ign:32 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
Ign:6 http://security.ubuntu.com/ubuntu xenial-security/main all Packages
Ign:33 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages.diff/Index
Ign:34 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
Ign:35 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages.diff/Index
Ign:22 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
Ign:10 http://security.ubuntu.com/ubuntu xenial-security/restricted all Packages
Ign:36 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse all Packages
Ign:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
Ign:37 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages.diff/Index
Ign:14 http://security.ubuntu.com/ubuntu xenial-security/universe all Packages
Ign:38 http://archive.ubuntu.com/ubuntu xenial-backports/main all Packages
Ign:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages
Ign:39 http://archive.ubuntu.com/ubuntu xenial-backports/restricted amd64 Packages
Ign:18 http://security.ubuntu.com/ubuntu xenial-security/multiverse all Packages
Ign:40 http://archive.ubuntu.com/ubuntu xenial-backports/restricted all Packages
Ign:20 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
Ign:41 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages.diff/Index
Ign:6 http://security.ubuntu.com/ubuntu xenial-security/main all Packages
Ign:42 http://archive.ubuntu.com/ubuntu xenial-backports/universe all Packages
Ign:22 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
Ign:43 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse amd64 Packages
Ign:44 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse all Packages
Ign:45 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Ign:10 http://security.ubuntu.com/ubuntu xenial-security/restricted all Packages
Ign:17 http://archive.ubuntu.com/ubuntu xenial/main all Packages
Ign:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
Ign:46 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
Ign:14 http://security.ubuntu.com/ubuntu xenial-security/universe all Packages
Ign:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages
Ign:21 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
Ign:47 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Ign:18 http://security.ubuntu.com/ubuntu xenial-security/multiverse all Packages
Ign:24 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
Ign:20 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
Ign:6 http://security.ubuntu.com/ubuntu xenial-security/main all Packages
Ign:48 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages
Ign:22 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
Ign:27 http://archive.ubuntu.com/ubuntu xenial/multiverse all Packages
Ign:10 http://security.ubuntu.com/ubuntu xenial-security/restricted all Packages
Ign:49 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
Ign:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
Ign:30 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
Ign:14 http://security.ubuntu.com/ubuntu xenial-security/universe all Packages
Ign:50 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Ign:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages
Ign:32 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
Ign:18 http://security.ubuntu.com/ubuntu xenial-security/multiverse all Packages
Ign:51 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
Ign:20 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
Ign:34 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
Ign:6 http://security.ubuntu.com/ubuntu xenial-security/main all Packages
Ign:52 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages
Ign:22 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
Ign:36 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse all Packages
Ign:10 http://security.ubuntu.com/ubuntu xenial-security/restricted all Packages
Ign:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
Ign:14 http://security.ubuntu.com/ubuntu xenial-security/universe all Packages
Ign:53 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
Ign:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages
Ign:38 http://archive.ubuntu.com/ubuntu xenial-backports/main all Packages
Ign:39 http://archive.ubuntu.com/ubuntu xenial-backports/restricted amd64 Packages
Ign:18 http://security.ubuntu.com/ubuntu xenial-security/multiverse all Packages
Ign:40 http://archive.ubuntu.com/ubuntu xenial-backports/restricted all Packages
Ign:54 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages
Ign:42 http://archive.ubuntu.com/ubuntu xenial-backports/universe all Packages
Ign:43 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse amd64 Packages
Ign:44 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse all Packages
Ign:45 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Ign:17 http://archive.ubuntu.com/ubuntu xenial/main all Packages
Ign:46 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
Ign:21 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
Err:20 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
  Connection failed [IP: 91.189.88.149 80]
Ign:47 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Ign:22 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages
Ign:24 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
Ign:48 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages
Ign:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages
Ign:28 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages
Ign:27 http://archive.ubuntu.com/ubuntu xenial/multiverse all Packages
Ign:49 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
Ign:30 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
Ign:50 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Ign:32 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
Ign:51 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
Ign:34 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
Ign:52 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages
Ign:36 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse all Packages
Ign:53 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
Ign:38 http://archive.ubuntu.com/ubuntu xenial-backports/main all Packages
Ign:39 http://archive.ubuntu.com/ubuntu xenial-backports/restricted amd64 Packages
Ign:40 http://archive.ubuntu.com/ubuntu xenial-backports/restricted all Packages
Ign:54 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages
Ign:42 http://archive.ubuntu.com/ubuntu xenial-backports/universe all Packages
Ign:43 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse amd64 Packages
Ign:44 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse all Packages
Ign:45 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Ign:17 http://archive.ubuntu.com/ubuntu xenial/main all Packages
Ign:46 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
Ign:21 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
Ign:47 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Ign:24 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
Ign:48 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages
Ign:27 http://archive.ubuntu.com/ubuntu xenial/multiverse all Packages
Ign:49 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
Ign:30 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
Ign:50 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Ign:32 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
Ign:51 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
Ign:34 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
Ign:52 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages
Ign:36 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse all Packages
Ign:53 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
Ign:38 http://archive.ubuntu.com/ubuntu xenial-backports/main all Packages
Ign:39 http://archive.ubuntu.com/ubuntu xenial-backports/restricted amd64 Packages
Ign:40 http://archive.ubuntu.com/ubuntu xenial-backports/restricted all Packages
Ign:54 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages
Ign:42 http://archive.ubuntu.com/ubuntu xenial-backports/universe all Packages
Ign:43 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse amd64 Packages
Ign:44 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse all Packages
Ign:45 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Ign:17 http://archive.ubuntu.com/ubuntu xenial/main all Packages
Ign:46 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
Ign:21 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
Ign:47 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Ign:24 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
Ign:48 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages
Ign:27 http://archive.ubuntu.com/ubuntu xenial/multiverse all Packages
Ign:49 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
Ign:30 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
Ign:50 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Ign:32 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
Ign:51 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
Ign:34 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
Ign:52 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages
Ign:36 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse all Packages
Ign:53 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
Ign:38 http://archive.ubuntu.com/ubuntu xenial-backports/main all Packages
Ign:39 http://archive.ubuntu.com/ubuntu xenial-backports/restricted amd64 Packages
Ign:40 http://archive.ubuntu.com/ubuntu xenial-backports/restricted all Packages
Ign:54 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages
Ign:42 http://archive.ubuntu.com/ubuntu xenial-backports/universe all Packages
Ign:43 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse amd64 Packages
Ign:44 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse all Packages
Ign:45 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Ign:17 http://archive.ubuntu.com/ubuntu xenial/main all Packages
Ign:46 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
Ign:21 http://archive.ubuntu.com/ubuntu xenial/restricted all Packages
Ign:47 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Ign:24 http://archive.ubuntu.com/ubuntu xenial/universe all Packages
Ign:48 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages
Ign:27 http://archive.ubuntu.com/ubuntu xenial/multiverse all Packages
Ign:49 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
Ign:30 http://archive.ubuntu.com/ubuntu xenial-updates/main all Packages
Ign:50 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Ign:32 http://archive.ubuntu.com/ubuntu xenial-updates/restricted all Packages
Ign:51 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
Ign:34 http://archive.ubuntu.com/ubuntu xenial-updates/universe all Packages
Ign:52 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages
Ign:36 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse all Packages
Ign:53 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages
Ign:38 http://archive.ubuntu.com/ubuntu xenial-backports/main all Packages
Err:39 http://archive.ubuntu.com/ubuntu xenial-backports/restricted amd64 Packages
  Connection failed [IP: 91.189.88.31 80]
Ign:40 http://archive.ubuntu.com/ubuntu xenial-backports/restricted all Packages
Ign:54 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages
Ign:42 http://archive.ubuntu.com/ubuntu xenial-backports/universe all Packages
Ign:43 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse amd64 Packages
Ign:44 http://archive.ubuntu.com/ubuntu xenial-backports/multiverse all Packages
Err:45 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
  Connection failed [IP: 91.189.88.31 80]
Ign:46 http://archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
Ign:47 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
Ign:48 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages
Err:49 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
  Connection failed [IP: 91.189.88.31 80]
Ign:50 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages
Ign:51 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages
Ign:52 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages
Reading package lists...
W: The repository 'http://security.ubuntu.com/ubuntu xenial-security Release' does not have a Release file.
W: The repository 'http://archive.ubuntu.com/ubuntu xenial Release' does not have a Release file.
W: The repository 'http://archive.ubuntu.com/ubuntu xenial-updates Release' does not have a Release file.
W: The repository 'http://archive.ubuntu.com/ubuntu xenial-backports Release' does not have a Release file.
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/main/binary-amd64/Packages  Connection failed [IP: 91.189.88.149 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/restricted/binary-amd64/Packages  Connection failed [IP: 91.189.88.31 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/main/binary-amd64/Packages  Connection failed [IP: 91.189.88.31 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/binary-amd64/Packages  Connection failed [IP: 91.189.88.31 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
Fetching the most recent configuration block for the channel
+ peer channel fetch config config_block.pb -o orderer.example.com:7050 -c mychannel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2019-08-19 07:27:15.225 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:27:15.230 UTC [cli.common] readBlock -> INFO 002 Received block: 4
2019-08-19 07:27:15.233 UTC [cli.common] readBlock -> INFO 003 Received block: 2
+ set +x
Decoding config block to JSON and isolating config to config.json
+ jq '.data.data[0].payload.data.config'
+ configtxlator proto_decode --input config_block.pb --type common.Block
+ set +x
+ jq -s '.[0] * {"channel_group":{"groups":{"Application":{"groups": {"Org3MSP":.[1]}}}}}' config.json ./channel-artifacts/org3.json
+ set +x
+ configtxlator proto_encode --input config.json --type common.Config
+ configtxlator proto_encode --input modified_config.json --type common.Config
+ configtxlator compute_update --channel_id mychannel --original original_config.pb --updated modified_config.pb
+ configtxlator proto_decode --input config_update.pb --type common.ConfigUpdate
+ jq .
++ cat config_update.json
+ echo '{"payload":{"header":{"channel_header":{"channel_id":"mychannel", "type":2}},"data":{"config_update":{' '"channel_id":' '"mychannel",' '"isolated_data":' '{},' '"read_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '},' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"Capabilities":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"1"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '},' '"write_set":' '{' '"groups":' '{' '"Application":' '{' '"groups":' '{' '"Org1MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '},' '"Org2MSP":' '{' '"groups":' '{},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"1"' '},' '"Org3MSP":' '{' '"groups":' '{},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"Admins",' '"policy":' '{' '"type":' 1, '"value":' '{' '"identities":' '[' '{' '"principal":' '{' '"msp_identifier":' '"Org3MSP",' '"role":' '"ADMIN"' '},' '"principal_classification":' '"ROLE"' '}' '],' '"rule":' '{' '"n_out_of":' '{' '"n":' 1, '"rules":' '[' '{' '"signed_by":' 0 '}' ']' '}' '},' '"version":' 0 '}' '},' '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"Admins",' '"policy":' '{' '"type":' 1, '"value":' '{' '"identities":' '[' '{' '"principal":' '{' '"msp_identifier":' '"Org3MSP",' '"role":' '"MEMBER"' '},' '"principal_classification":' '"ROLE"' '}' '],' '"rule":' '{' '"n_out_of":' '{' '"n":' 1, '"rules":' '[' '{' '"signed_by":' 0 '}' ']' '}' '},' '"version":' 0 '}' '},' '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"Admins",' '"policy":' '{' '"type":' 1, '"value":' '{' '"identities":' '[' '{' '"principal":' '{' '"msp_identifier":' '"Org3MSP",' '"role":' '"MEMBER"' '},' '"principal_classification":' '"ROLE"' '}' '],' '"rule":' '{' '"n_out_of":' '{' '"n":' 1, '"rules":' '[' '{' '"signed_by":' 0 '}' ']' '}' '},' '"version":' 0 '}' '},' '"version":' '"0"' '}' '},' '"values":' '{' '"MSP":' '{' '"mod_policy":' '"Admins",' '"value":' '{' '"config":' '{' '"admins":' '[' '"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNLVENDQWR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FHCkNDc0dBUVVGQndNQ0JnZ3JCZ0VGQlFjREFUQVBCZ05WSFJNQkFmOEVCVEFEQVFIL01Da0dBMVVkRGdRaUJDQloKRXlBMWFkb3NiUmZ2S3lGajJFY3NwMmxXUHlMRm41T1RRdWZxVE4vMFNqQUtCZ2dxaGtqT1BRUURBZ05JQURCRgpBaUVBMVAxSkE3bXowNkFibmhkSEZ2UVpJTFJtZlFVTlQ5RnZzU2wzS0JNRWFnTUNJRVFjTHhFdjdNcy8zTllYCmVha2Y3Y0dmRFh2TjZWenZNdHVpVFUwZmN2LzEKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=",' '"organizational_unit_identifier":' '"peer"' '}' '},' '"intermediate_certs":' '[],' '"name":' '"Org3MSP",' '"organizational_unit_identifiers":' '[],' '"revocation_list":' '[],' '"root_certs":' '[' '"LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNVVENDQWZlZ0F3SUJBZ0lRV0hNWkFMMTZ1aFJZaW1OOWJrV0JOREFLQmdncWhrak9QUVFEQWpCek1Rc3cKQ1FZRFZRUUdFd0pWVXpFVE1CRUdBMVVFQ0JNS1EyRnNhV1p2Y201cFlURVdNQlFHQTFVRUJ4TU5VMkZ1SUVaeQpZVzVqYVhOamJ6RVpNQmNHQTFVRUNoTVFiM0puTXk1bGVHRnRjR3hsTG1OdmJURWNNQm9HQTFVRUF4TVRZMkV1CmIzSm5NeTVsZUdGdGNHeGxMbU52YlRBZUZ3MHhPVEE0TVRrd056RTNNREJhRncweU9UQTRNVFl3TnpFM01EQmEKTUhNeEN6QUpCZ05WQkFZVEFsVlRNUk13RVFZRFZRUUlFd3BEWVd4cFptOXlibWxoTVJZd0ZBWURWUVFIRXcxVApZVzRnUm5KaGJtTnBjMk52TVJrd0Z3WURWUVFLRXhCdmNtY3pMbVY0WVcxd2JHVXVZMjl0TVJ3d0dnWURWUVFECkV4TmpZUzV2Y21jekxtVjRZVzF3YkdVdVkyOXRNRmt3R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5Ym1saE1SWXdGQVlEVlFRSApFdzFUWVc0Z1JuSmhibU5wYzJOdk1Sa3dGd1lEVlFRS0V4QnZjbWN6TG1WNFlXMXdiR1V1WTI5dE1SOHdIUVlEClZRUURFeFowYkhOallTNXZjbWN6TG1WNFlXMXdiR1V1WTI5dE1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMEQKQVFjRFFnQUVHVGovaFROdXZTMnhXTHBQdHJycGszYnZTVEc0Tkg0VjBudDVPdUdINXBoM1pjcW1uMzI2ZC9PMAplV0g5ODRxWjBBNVhuaERJZkE0VitJSXBRRTB0VEtOdE1Hc3dEZ1lEVlIwUEFRSC9CQVFEQWdHbU1CMEdBMVVkCkpRUVdNQlFHQ0NzR0FRVUZCd01DQmdnckJnRUZCUWNEQVRBUEJnTlZIUk1CQWY4RUJUQURBUUgvTUNrR0ExVWQKRGdRaUJDQUVzVDRtaUpOSFJKcit5MnBXSGNoaU1RTTNCWStMc1Z5RjRVYUh0b3RZc2pBS0JnZ3Foa2pPUFFRRApBZ05JQURCRkFpRUFtczlhTldoTlh2K2RxYXg1UTFiM1JoVnNvdGRRaUE0enZVMDF5Mk1adTJzQ0lDOXdqS0llCjl4ZXBGWERkcTY5TVh0WVhxWG5qRFhGQ1pZNm5KQ1BUekk1SAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg=="' ']' '},' '"type":' 0 '},' '"version":' '"0"' '}' '},' '"version":' '"0"' '}' '},' '"mod_policy":' '"Admins",' '"policies":' '{' '"Admins":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Readers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '},' '"Writers":' '{' '"mod_policy":' '"",' '"policy":' null, '"version":' '"0"' '}' '},' '"values":' '{' '"Capabilities":' '{' '"mod_policy":' '"",' '"value":' null, '"version":' '"0"' '}' '},' '"version":' '"2"' '}' '},' '"mod_policy":' '"",' '"policies":' '{},' '"values":' '{},' '"version":' '"0"' '}' '}}}}'
+ configtxlator proto_encode --input config_update_in_envelope.json --type common.Envelope

========= Config transaction to add org3 to network created ===== 
+ set +x

Signing config transaction

+ peer channel signconfigtx -f org3_update_in_envelope.pb
2019-08-19 07:27:16.780 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
+ set +x

========= Submitting transaction from a different peer (peer0.org2) which also signs it ========= 

+ peer channel update -f org3_update_in_envelope.pb -c mychannel -o orderer.example.com:7050 --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2019-08-19 07:27:16.910 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:27:16.964 UTC [channelCmd] update -> INFO 002 Successfully submitted channel update

========= Config transaction to add org3 to network submitted! =========== 

+ set +x
Creating volume "net_peer0.org3.example.com" with default driver
Creating volume "net_peer1.org3.example.com" with default driver
WARNING: Found orphan containers (cli, peer1.org2.example.com, orderer.example.com, peer1.org1.example.com, peer0.org2.example.com, peer0.org1.example.com) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Creating peer0.org3.example.com
Creating peer1.org3.example.com
Creating Org3cli

###############################################################
############### Have Org3 peers join network ##################
###############################################################

========= Getting Org3 on to your first network ========= 

+ peer channel fetch 0 mychannel.block -o orderer.example.com:7050 -c mychannel --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
Fetching channel config block from orderer...
+ res=0
+ set +x
2019-08-19 07:27:22.505 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:27:22.513 UTC [cli.common] readBlock -> INFO 002 Received block: 0
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2019-08-19 07:27:22.637 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:27:22.702 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer0.org3 joined channel 'mychannel' ===================== 
+ peer channel join -b mychannel.block
+ res=0
+ set +x
2019-08-19 07:27:22.834 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2019-08-19 07:27:22.900 UTC [channelCmd] executeJoin -> INFO 002 Successfully submitted proposal to join channel
===================== peer1.org3 joined channel 'mychannel' ===================== 
Installing chaincode 2.0 on peer0.org3...
+ peer chaincode install -n mycc -v 2.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2019-08-19 07:27:23.049 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:27:23.049 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-08-19 07:27:23.541 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org3 ===================== 


========= Org3 is now halfway onto your first network ========= 


###############################################################
##### Upgrade chaincode to have Org3 peers on the network #####
###############################################################

========= Finish adding Org3 to your first network ========= 

===================== Installing chaincode 2.0 on peer0.org1 ===================== 
+ peer chaincode install -n mycc -v 2.0 -l golang -p github.com/chaincode/chaincode_example02/go/
+ res=0
+ set +x
2019-08-19 07:27:24.378 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:27:24.378 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-08-19 07:27:24.842 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org1 ===================== 

+ peer chaincode install -n mycc -v 2.0 -l golang -p github.com/chaincode/chaincode_example02/go/
===================== Installing chaincode 2.0 on peer0.org2 ===================== 
+ res=0
+ set +x
2019-08-19 07:27:24.993 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:27:24.993 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-08-19 07:27:25.490 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is installed on peer0.org2 ===================== 

===================== Upgrading chaincode on peer0.org1 ===================== 
+ peer chaincode upgrade -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 -v 2.0 -c '{"Args":["init","a","90","b","210"]}' -P 'AND ('\''Org1MSP.peer'\'','\''Org2MSP.peer'\'','\''Org3MSP.peer'\'')'
2019-08-19 07:27:25.644 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:27:25.644 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
+ res=0
+ set +x
2019-08-19 07:27:24.993 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-08-19 07:27:24.993 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2019-08-19 07:27:25.490 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" > 
===================== Chaincode is upgraded on peer0.org1 on channel 'mychannel' ===================== 


========= Finished adding Org3 to your first network! ========= 


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

Extend your first network (EYFN) test

Channel name : mychannel
Querying chaincode on peer0.org3...
===================== Querying on peer0.org3 on channel 'mychannel'... ===================== 
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer0.org3 ...3 secs
+ res=0
+ set +x

90
===================== Query successful on peer0.org3 on channel 'mychannel' ===================== 
Sending invoke transaction on peer0.org1 peer0.org2 peer0.org3...
+ 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 --peerAddresses peer0.org1.example.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt --peerAddresses peer0.org3.example.com:11051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/tls/ca.crt -c '{"Args":["invoke","a","b","10"]}'
+ res=0
+ set +x
2019-08-19 07:29:36.323 UTC [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 
===================== Invoke transaction successful on peer0.org1 peer0.org2 peer0.org3 on channel 'mychannel' ===================== 

Querying chaincode on peer0.org3...
===================== Querying on peer0.org3 on channel 'mychannel'... ===================== 
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer0.org3 ...3 secs
+ res=0
+ set +x

80
===================== Query successful on peer0.org3 on channel 'mychannel' ===================== 
Querying chaincode on peer0.org2...
===================== Querying on peer0.org2 on channel 'mychannel'... ===================== 
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
Attempting to Query peer0.org2 ...3 secs
+ res=0
+ set +x

80
===================== Query 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
+ peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
+ res=0
+ set +x

80
===================== Query successful on peer0.org1 on channel 'mychannel' ===================== 

========= All GOOD, EYFN test execution completed =========== 


 _____   _   _   ____   
| ____| | \ | | |  _ \  
|  _|   |  \| | | | | | 
| |___  | |\  | | |_| | 
|_____| |_| \_| |____/  

wang@wang:~/go/src/github.com/hyperledger/fabric-samples/first-network$ 

wang@wang:~/go/src/github.com/hyperledger/fabric-samples/first-network/org3-artifacts$ docker exec -it cli bash
root@4a8106ea8d61:/opt/gopath/src/github.com/hyperledger/fabric/peer# ls
channel-artifacts  config_update.json              crypto                modified_config.pb          original_config.pb
config.json        config_update.pb                log.txt               mychannel.block             scripts
config_block.pb    config_update_in_envelope.json  modified_config.json  org3_update_in_envelope.pb
root@4a8106ea8d61:/opt/gopath/src/github.com/hyperledger/fabric/peer# jq . config.json 
{
  "channel_group": {
    "groups": {
      "Application": {
        "groups": {
...
...

对上述步骤总结:
1,根据配置文件生成对应配置:通过cryptogen和configtxgen工具生成org3的证书和org3配置信息的json文件org3.json,并且把orderer组织的MSP信息拷贝到org3的crypto-config目录中,因为要安全通信所以只关心TLS证书;

2,获取原有网络的配置文件进入cli容器安装jq工具并设置ORDERER_CA以及CHANNEL_NAME 环境变量之后,获取通道的最新配置块(pb文件),因为配置块是版本话的。通过configtxlator将此pb文件转码为json格式,使用jq工具删除与我们想要进行的更改无关的所有标头,元数据,创建者签名等最后生成config.json文件。

3,在原有的配置文件添加org3的配置:将org3的json和channel详细进行合并(org3.json 和config.json),转码成最新的字节pb即modified_config.pb。

计算新老pb(老pb即将config.json转成config.pb,新pb即modified_config.pb)两种配置之间的增量数据,获得将要修改的配置信息pb(这个增量包含了org3的定义以及org1和org2的高级别指针,并且org1和org2的msp信息以及更改策略已经在通道的创世块中了),再将其转码为json。

将转码后的json进行格式化,包装成一个envelope,用configtxlator工具将其转化为可被fabric解析的数据结构即pb,protobuf格式,即做成一个交易。

4,操纵网络并添加org3:更改策略(mod_police)设置的是“MAJORITY”,两个组织的大多数即需要两个组织的签名。没有两个签名,orderer拒绝此交易。将现存的几个组织(原channel参与的组织),对其进行签名(org1的admin管理员签名后切换org2 MSP的四个环节变量实现切换org2 admin用户再进行peer channel update会附带签名操作)

提交到orderer,进行配置化修改。会返回一个新的block 5:
block 0: genesis block
block 1: Org1 anchor peer update
block 2: Org2 anchor peer update
block 3: instantiation of the mycc chaincode
block 4: invocation of the mycc chaincode
block 5: the most recent channel configuration with Org3 now defined on the channel

新加入的peers也是使用genesis block进行引导的,但是genesis block不包含加入通道的组织更新的信息。所以新的peers是不能够使用gossip的,因为他们无法验证从其他peers转发过来的块,直到他们获取到添加组织的配置交易。所以新加入的peers需要进行配置让他们能够从orderer获取区块。peer-base.yaml

到目前为止,通道配置已经被更更新成包含org3的情况,意味着与之相关联的可以加入该通道了。将org3,jion到目标channel,并安装、升级合约;就开始同步数据。
5,升级Chaincode,配置org3的节点加入背书策略中
加入通道:包括使用docker-compose启动容器,进入到org3的cli容器设置ORDERER_CA 和 CHANNEL_NAME环境变量,获取genesis block—mychannel.block,因为账本都是从genesis block开始的。然后加入通道即peer channel join -b mychannel.block。

升级链码版本和包含org3的背书策略:
org3的cli中可以直接安装version 2的链码,做背书节点必须安装链码。没有安装链码的peer会仍然执行验证逻辑以及作为一个committer。
org1的cli中由于前面的一个提交的命令是以org2 admin 的身份提交的channel update,所以容器目前还是peer0.org2:安装version2的链码,转到peer0.org1的身份安装version 2 的链码。

upgrade:upgrade的时候传递背书策略,传递版本,构造请求。同时会向账本中写入一个新的block 6。upgrade之后org3cli中可以做交易了。

需要注意的是:
1 此次新增的组织只对这个channel有效,若想其对其他channel也生效,就需要重复上述的操作;对新的channel进行配置化修改。
2.动态添加组织过程还是比较复杂的,涉及到文件的多次转换,多重签名等步骤
3.更新交易需要多个组织进行签名,而在实际运用过程中,一个组织不可能获取所有组织的私钥,因此需要将产生的增量数据在各个组织间进行审核、流转,这个过程也是非常繁琐的。因此,未来需要开发在线审核流转工具,协助对数据签名。

猜你喜欢

转载自blog.csdn.net/u010931295/article/details/99728396