0

我尝试通过修改来自build your first networkchaincode_example02的 byfn 脚本在我提出的网络上安装和实例化链代码。我正在使用 2 个组织,每个组织有 1 个同伴。我重命名了组织。

对等容器即将出现,我能够在两个组织的对等设备上安装链代码。当我实例化时,链码容器出现了。该命令不返回任何错误。

但我无法查询链码。我无法在peer chaincode list --instantiated -C mychannel.

我尝试在不进行任何修改的情况下运行 byfn 脚本,并且能够完成端到端测试。

对等日志

2019-08-22 08:46:29.062 UTC [ConnProducer] NewConnection -> ERRO 038 Failed connecting to {localhost:7050 [OrdererMSP]} , error: context deadline exceeded
2019-08-22 08:46:29.063 UTC [ConnProducer] NewConnection -> ERRO 039 Could not connect to any of the endpoints: [{localhost:7050 [OrdererMSP]}]
2019-08-22 08:46:29.063 UTC [deliveryClient] connect -> ERRO 03a Failed obtaining connection: could not connect to any of the endpoints: [{localhost:7050 [OrdererMSP]}]
2019-08-22 08:46:29.064 UTC [deliveryClient] try -> WARN 03b Got error: could not connect to any of the endpoints: [{localhost:7050 [OrdererMSP]}] , at 1 attempt. Retrying in 1s
2019-08-22 08:46:30.099 UTC [endorser] callChaincode -> INFO 03c [][276fe51c] Entry chaincode: name:"lscc"
2019-08-22 08:46:30.103 UTC [lscc] executeInstall -> INFO 03d Installed Chaincode [mycc] Version [1.0] to peer
2019-08-22 08:46:30.103 UTC [endorser] callChaincode -> INFO 03e [][276fe51c] Exit chaincode: name:"lscc"  (4ms)
2019-08-22 08:46:30.103 UTC [comm.grpc.server] 1 -> INFO 03f unary call completed grpc.service=protos.Endorser grpc.method=ProcessProposal grpc.peer_address=192.168.0.5:54174 grpc.code=OK grpc.call_duration=5.100738ms
2019-08-22 08:46:30.200 UTC [endorser] callChaincode -> INFO 040 [ssidchannel][293c34bf] Entry chaincode: name:"lscc"
2019-08-22 08:46:30.220 UTC [chaincode.platform.golang] GenerateDockerBuild -> INFO 041 building chaincode with ldflagsOpt: '-ldflags "-linkmode external -extldflags '-static'"'
2019-08-22 08:46:33.066 UTC [ConnProducer] NewConnection -> ERRO 042 Failed connecting to {localhost:7050 [OrdererMSP]} , error: context deadline exceeded
2019-08-22 08:46:33.066 UTC [ConnProducer] NewConnection -> ERRO 043 Could not connect to any of the endpoints: [{localhost:7050 [OrdererMSP]}]
2019-08-22 08:46:33.066 UTC [deliveryClient] connect -> ERRO 044 Failed obtaining connection: could not connect to any of the endpoints: [{localhost:7050 [OrdererMSP]}]

订购者日志

2019-08-22 08:46:16.512 UTC [orderer.commmon.multichannel] newChain -> INFO 00b Created and starting new chain ssidchannel
2019-08-22 08:46:16.518 UTC [common.deliver] Handle -> WARN 00c Error reading from 192.168.0.5:47044: rpc error: code = Canceled desc = context canceled
2019-08-22 08:46:16.518 UTC [comm.grpc.server] 1 -> INFO 00d streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Deliver grpc.peer_address=192.168.0.5:47044 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=55.824801ms
2019-08-22 08:46:23.203 UTC [orderer.common.broadcast] Handle -> WARN 00e Error reading from 192.168.0.5:47060: rpc error: code = Canceled desc = context canceled
2019-08-22 08:46:23.203 UTC [comm.grpc.server] 1 -> INFO 00f streaming call completed grpc.service=orderer.AtomicBroadcast grpc.method=Broadcast grpc.peer_address=192.168.0.5:47060 error="rpc error: code = Canceled desc = context canceled" grpc.code=Canceled grpc.call_duration=22.774639ms

链码容器日志

Aval = 100, Bval = 200
2019-08-22 08:20:10.458 UTC [shim] chatWithPeer -> ERRO 001 Received error from server, ending chaincode stream: rpc error: code = Unavailable desc = transport is closing
receive failed
github.com/hyperledger/fabric/core/chaincode/shim.chatWithPeer
        /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:362
github.com/hyperledger/fabric/core/chaincode/shim.Start
        /opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:156
main.main
        /chaincode/input/src/fabric-samples/chaincode/chaincode_example02/go/chaincode_example02.go:195
runtime.main
        /opt/go/src/runtime/proc.go:201
runtime.goexit
        /opt/go/src/runtime/asm_amd64.s:1333
Error starting Simple chaincode: receive failed: rpc error: code = Unavailable desc = transport is closing

4

2 回答 2

1

生成后的链码容器连接到与对等节点和排序节点不同的网络。我更改了文件中的CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE属性peer-base.yaml以匹配文件中的网络docker-compose-cli.yaml以解决此问题。

于 2019-08-22T12:35:23.467 回答
0
ERRO 044 Failed obtaining connection: could not connect to any of the endpoints: [{localhost:7050 [OrdererMSP]}]

它清楚地表明对等方无法连接订购者

[OrdererMSP] >> 为什么它出现在 orderer 端点列表中?我假设你做错了什么

[{localhost:7050 [OrdererMSP]}]<<< 错误的表示

请在此处粘贴 peer manifest、orderer manifest 和 configtx.yaml

为了调查问题

于 2019-08-22T11:47:59.583 回答