fabric-sample1.1新增组织Org3

fabric-sample1.1自带新增组织脚本,但是入门者还是会遇到或多或少的坑。作者在此文中记录了一些常见的坑,希望可以帮助到大家,接下来进入正题开始爬坑。

新增组织脚本所在目录 fabric-samples/first-network/scripts 新增组织操作步骤: 第一步:执行step1org3.sh脚本 第二步:执行step2org3.sh脚本 第三步:执行step3org3.sh脚本 第四步:执行testorg3.sh脚本 第一次执行时可能会遇到下面这样的报错。 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 2018-07-06 02:33:11.265 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized 2018-07-06 02:33:11.338 UTC [main] main -> INFO 002 Exiting..... + 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 jq: error: Could not open file ./channel-artifacts/org3.json: No such file or directory + set +x + configtxlator proto_encode --input config.json --type common.Config + configtxlator proto_encode --input modified_config.json --type common.Config 'panic: runtime error: invalid memory address or nil pointer dereference' [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x8bd6c5] goroutine 1 [running]: github.com/hyperledger/fabric/common/tools/protolator.(*mapField).PopulateFrom(0xc4202b5810, 0xa89700, 0xc42024e630, 0x6, 0xc4201ad460) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/json.go:119 +0x365 github.com/hyperledger/fabric/common/tools/protolator.recursivelyPopulateMessageFromTree(0xc42024e600, 0x1103900, 0xc420150760, 0x0, 0x0) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/json.go:423 +0x463 github.com/hyperledger/fabric/common/tools/protolator.dynamicFrom(0xc4201ad590, 0xa89700, 0xc42024e600, 0x110cb80, 0xb062c0, 0x700000000a87d20, 0xffffffffffffffff, 0x0, 0x0, 0xc420287ca8) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/dynamic.go:32 +0x109 github.com/hyperledger/fabric/common/tools/protolator.dynamicMapFieldFactory.NewProtoField.func1(0xc420153460, 0xb, 0xa89700, 0xc42024e600, 0x110cb80, 0xb062c0, 0xb062c0, 0xc420293260, 0x16, 0x0, ...) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/dynamic.go:104 +0xe6 github.com/hyperledger/fabric/common/tools/protolator.(*mapField).PopulateFrom(0xc420241260, 0xa89700, 0xc42024e5d0, 0x6, 0xc4201ad9a0) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/json.go:122 +0x3ff github.com/hyperledger/fabric/common/tools/protolator.recursivelyPopulateMessageFromTree(0xc42024e5a0, 0x1102440, 0xc420150488, 0x0, 0x0) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/json.go:423 +0x463 github.com/hyperledger/fabric/common/tools/protolator.dynamicFrom(0xc4201adad0, 0xa89700, 0xc42024e5a0, 0x110cb80, 0xb062c0, 0xc4201adb10, 0x8b5832, 0xc4201adba7, 0xad6d80, 0xc4201f1720) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/dynamic.go:32 +0x109 github.com/hyperledger/fabric/common/tools/protolator.dynamicFieldFactory.NewProtoField.func1(0xa89700, 0xc42024e5a0, 0x110cb80, 0xb062c0, 0xc420226380, 0x1102100, 0xc4201f1720, 0x0, 0x0) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/dynamic.go:69 +0xc3 github.com/hyperledger/fabric/common/tools/protolator.(*plainField).PopulateFrom(0xc4202411f0, 0xa89700, 0xc42024e5a0, 0xd, 0xc4201add78) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/json.go:85 +0x20f github.com/hyperledger/fabric/common/tools/protolator.recursivelyPopulateMessageFromTree(0xc42024e540, 0x1102100, 0xc4201f1720, 0x0, 0x0) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/json.go:423 +0x463 github.com/hyperledger/fabric/common/tools/protolator.DeepUnmarshalJSON(0x10fb840, 0xc420150420, 0x1102100, 0xc4201f1720, 0xc4201f1720, 0x4296a9) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/protolator/json.go:444 +0xaf main.encodeProto(0x7fff9579a57f, 0xd, 0xc420150420, 0xc420150418, 0xb53601, 0xc) /opt/gopath/src/github.com/hyperledger/fabric/common/tools/configtxlator/main.go:121 +0x183 main.main() /opt/gopath/src/github.com/hyperledger/fabric/common/tools/configtxlator/main.go:77 +0x5c9 原因:未初始化yaml文件 正确的操作步骤如下: 1.==初始化org3的yaml文件(很多朋友把这一步丢掉了)== 1. cryptogen generate –config=./org3-crypto.yaml 2. configtxgen -printOrg Org3MSP > ../channel-artifacts/org3.json 2.将生成的证书目录copy到原crypto-config目录中 cp -r org3-artifacts/crypto-config/peerOrganizations/ crypto-config/ 3.生成org3的peer容器 docker-compose -f docker-compose-org3.yaml up -d 4.==进入cli容器中(一定要进入cli容器内部)== docker exec -it cli bash 5.分布执行操作步骤 1. ./scripts/step1org3.sh 2. ./scripts/step2org3.sh 3. ./scripts/step3org3.sh 4. ./scripts/testorg3.sh

Bingo,Org3已经成功添加到网络中

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zwfsjz.html