Fabric 和 Composer 版本升级后启动 hyperledger-composer 网络时出错

Error starting hyperledger-composer network after Fabric and Composer version upgrade

我在启动 hyperledger-composer 网络时遇到了一个错误,composer-wiki 中没有回答这个错误。

✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers. 
Response from attempted peer comms was an error: Error: transaction returned with failure: can't find PEM header: undefined 
Command failed

检查先决条件,

在 运行 "composer network start" 命令之后,"docker ps" 显示名称为 docker 的新实例:

dev-peer0.org1.example.com-<<business-network-name>>-0.0.7

但是任何对此进行 ping 操作的尝试都会导致如下所示的失败:

Error: Error trying to ping. Error: make sure the chaincode <<business-network-name>> has been successfully instantiated and try again: getccdata composerchannel/<<business-network-name>> responded with error: could not find chaincode with name '<<business-network-name>>'

查看dev-peer0的日志,结尾如下:

2018-11-05T05:03:18.227Z [4264161f] ERROR    :Composer                 :Init()                    can't find PEM header: undefined
2018-11-05T05:03:18.227Z [4264161f] VERBOSE  :Composer                 :@PERF Init()              Total (ms) duration for txnID [4264161fc30a61c70884d4c7efb460fea6a755d07bc4852875c393346795227a]: 929.00
2018-11-05T05:03:18.228Z ERROR [lib/handler.js] [composerchannel-4264161f]Calling chaincode Init() returned error response [can't find PEM header: undefined]. Sending ERROR message back to peer 

peer0日志中对应的错误比较大:

2018-11-05 05:03:18.229 UTC [endorser] SimulateProposal -> ERRO 439d [composerchannel][4264161f] failed to invoke chaincode name:"lscc" , error: transaction returned with failure: can't find PEM header: undefined
github.com/hyperledger/fabric/core/chaincode.(*ChaincodeSupport).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/chaincode_support.go:202
github.com/hyperledger/fabric/core/endorser.(*SupportImpl).Execute
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/support.go:131
github.com/hyperledger/fabric/core/endorser.(*Endorser).callChaincode
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:173
github.com/hyperledger/fabric/core/endorser.(*Endorser).SimulateProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:287
github.com/hyperledger/fabric/core/endorser.(*Endorser).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/endorser/endorser.go:501
github.com/hyperledger/fabric/core/handlers/auth/filter.(*expirationCheckFilter).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/expiration.go:61
github.com/hyperledger/fabric/core/handlers/auth/filter.(*filter).ProcessProposal
    /opt/gopath/src/github.com/hyperledger/fabric/core/handlers/auth/filter/filter.go:31
github.com/hyperledger/fabric/protos/peer._Endorser_ProcessProposal_Handler
    /opt/gopath/src/github.com/hyperledger/fabric/protos/peer/peer.pb.go:112
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).processUnaryRPC
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:923
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).handleStream
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:1148
github.com/hyperledger/fabric/vendor/google.golang.org/grpc.(*Server).serveStreams.func1.1
    /opt/gopath/src/github.com/hyperledger/fabric/vendor/google.golang.org/grpc/server.go:637
runtime.goexit
    /opt/go/src/runtime/asm_amd64.s:2361
2018-11-05 05:03:18.229 UTC [endorser] SimulateProposal -> DEBU 439e [composerchannel][4264161f] Exit

自从上次成功以来,我已将 composer 从 0.19 更新到 0.20.4,并将 Fabric 从 1.1 更新到 1.2。

谷歌搜索表明这种错误 "can't find PEM header: undefined" 与密钥签名的更改有关。拆除 Fabric 后,我重新 运行 ./createPeerAdminCard.sh - 是否需要重新创建另一张卡或类似卡以适应最新版本?

感谢@R Thatcher 让我找到了正确的方向。这一切都是因为卡片不匹配,并通过清除所有内容并重新开始来解决。

具体来说,在 /fabric-dev-servers 中:

./stopFabric.sh 
./teardownFabric.sh
composer card list
composer card delete -c admin@<business-network-name>
composer card delete -c PeerAdmin@hlfv1
./startFabric.sh
./createPeerAdminCard.sh

然后进入composer/business-network-name目录:

composer network install --card PeerAdmin@hlfv1 --archiveFile business-network-name\@0.0.7.bna 
composer network start -c PeerAdmin@hlfv1 -n business-network-name -V 0.0.7 -A admin -S adminpw --file networkadmin.card
composer card import --file networkadmin.card --card admin@business-network-name
composer network ping -c admin@business-network-name

所以是的,这是关于不匹配的卡片,而不是将它们作为新部署的一部分进行清理。

虽然不是原始问题的一部分,但同样值得注意的是,composer network start 命令的 -A 和 -S 参数必须分别设置为 admin 和 adminpw。请参阅作曲家问题 #3781

回答@Capn Sparrow 的最后一句话

"the -A and -S parameters of the composer network start command HAD to be set to admin and adminpw respectively."

这是正确的预期行为:-)

使用 composer network start 命令,-A 和 -S 指定 CA 中的 现有用户 我们需要一组新的凭据(证书和密钥)然后绑定到 Composer System 参与者。

当您使用 'standard development fabric' 时,它配置了一个 CA,该 CA 配置了一个名为 'admin' 的用户,其密码为 'adminpw'。如果您从头开始构建自己的 Fabric,您可以选择第一个默认用户的名称和密码。或者,您可以使用 fabric-ca 客户端软件在 CA 中创建其他用户。