错误:错误支持链代码:rpc错误:代码=未知desc =超时启动链代码fabcar

时间:2018-05-03 18:52:03

标签: docker-compose hyperledger-fabric

我按照此处给出的教程 - http://hyperledger-fabric.readthedocs.io/en/latest/write_first_app.html

我在Mac OS上工作:High Sierra。

我收到如下错误:

  

错误:错误支持链码:rpc错误:code = Unknown desc =   启动chaincode时超时到期   fabcar:1.0(NETWORKID:开发,的peerID:peer0.org1.example.com,TX:c51ca82792bd8823a60edf9c31a550836fc8932a90a2a4cec8b9c37ba24c46ea)

感谢您的帮助。

命令:./startFabric.sh node

完整日志:

# don't rewrite paths for Windows Git Bash users
   export MSYS_NO_PATHCONV=1

   docker-compose -f docker-compose.yml down
   Stopping peer0.org1.example.com ... done
   Stopping orderer.example.com    ... done
   Stopping ca.example.com         ... done
   Stopping couchdb                ... done
   Removing peer0.org1.example.com ... done
   Removing orderer.example.com    ... done
   Removing ca.example.com         ... done
   Removing couchdb                ... done
   Removing network net_basic

   docker-compose -f docker-compose.yml up -d ca.example.com orderer.example.com 
   peer0.org1.example.com couchdb
   Creating network "net_basic" with the default driver
   Creating orderer.example.com ... done
   Creating ca.example.com      ... done
   Creating couchdb             ... done
   Creating peer0.org1.example.com ... done

   # wait for Hyperledger Fabric to start
   # incase of errors when running later commands, issue export 
   FABRIC_START_TIMEOUT=<larger number>
   export FABRIC_START_TIMEOUT=10
   #echo ${FABRIC_START_TIMEOUT}
   sleep ${FABRIC_START_TIMEOUT}

   # Create the channel
   docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e 
   "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" 
   peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c 
   mychannel -f /etc/hyperledger/configtx/channel.tx
   2018-05-03 17:56:04.275 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser 
   and orderer connections initialized
   2018-05-03 17:56:04.392 UTC [channelCmd] InitCmdFactory -> INFO 002 Endorser 
   and orderer connections initialized
   2018-05-03 17:56:04.621 UTC [main] main -> INFO 003 Exiting.....
   # Join peer0.org1.example.com to the channel.
   docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e 
   "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" 
   peer0.org1.example.com peer channel join -b mychannel.block
   2018-05-03 17:56:04.861 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser 
   and orderer connections initialized
   2018-05-03 17:56:05.018 UTC [channelCmd] executeJoin -> INFO 002 Successfully 
   submitted proposal to join channel
   2018-05-03 17:56:05.018 UTC [main] main -> INFO 003 Exiting.....
   Creating cli ... done
   2018-05-03 17:56:06.745 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing 
   local MSP
   2018-05-03 17:56:06.745 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 
   Obtaining default signing identity
   2018-05-03 17:56:06.746 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 
   Using default escc
   2018-05-03 17:56:06.746 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 
   Using default vscc
   2018-05-03 17:56:06.746 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java 
   chaincode disabled
   2018-05-03 17:56:06.749 UTC [node-platform] GetDeploymentPayload -> DEBU 006 
   Packaging node.js project from path /opt/gopath/src/github.com/fabcar/node
   2018-05-03 17:56:06.749 UTC [container] WriteFolderToTarPackage -> INFO 007 
   rootDirectory = /opt/gopath/src/github.com/fabcar/node
   2018-05-03 17:56:06.752 UTC [container] WriteFileToPackage -> DEBU 008 Writing 
   file to tarball: src/fabcar.js
   2018-05-03 17:56:06.762 UTC [container] WriteFileToPackage -> DEBU 009 Writing 
   file to tarball: src/package.json
   2018-05-03 17:56:06.765 UTC [msp/identity] Sign -> DEBU 00a Sign: plaintext: 
   0A9C070A5C08031A0C08B69AADD70510...C1F84F000000FFFF22CB6E3A001E0000 
   2018-05-03 17:56:06.765 UTC [msp/identity] Sign -> DEBU 00b Sign: digest: 
   CAD5821E4354EA410ED3567BE82D12813B469783B96FB8EEE2A1B4416A323B76 
   2018-05-03 17:56:06.816 UTC [chaincodeCmd] install -> DEBU 00c Installed 
   remotely response:<status:200 payload:"OK" > 
   2018-05-03 17:56:06.816 UTC [main] main -> INFO 00d Exiting.....
   2018-05-03 17:56:07.116 UTC [msp] GetLocalMSP -> DEBU 001 Returning existing 
   local MSP
   2018-05-03 17:56:07.116 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 
   Obtaining default signing identity
   2018-05-03 17:56:07.121 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 
   Using default escc
   2018-05-03 17:56:07.121 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 
   Using default vscc
   2018-05-03 17:56:07.123 UTC [chaincodeCmd] getChaincodeSpec -> DEBU 005 java 
   chaincode disabled
   2018-05-03 17:56:07.125 UTC [msp/identity] Sign -> DEBU 006 Sign: plaintext: 
   0AA6070A6608031A0B08B79AADD70510...324D53500A04657363630A0476736363 
   2018-05-03 17:56:07.126 UTC [msp/identity] Sign -> DEBU 007 Sign: digest: 
   7574A79A053907A7CD90E656B612CE20AA80E95067403F097B3F6185EC25D329 
   Error: Error endorsing chaincode: rpc error: code = Unknown desc = timeout 
   expired while starting chaincode fabcar:1.0(networkid:dev,peerid:peer0.org1.example.com,tx:c51ca82792bd8823a60edf9c31a550836fc8932a90a2a4cec8b9c37ba24c46ea)
   Usage:
     peer chaincode instantiate [flags]

     Flags:
      -C, --channelID string            The channel on which this command should be executed
      --collections-config string   The file containing the configuration for the chaincode's collection
      -c, --ctor string                 Constructor message for the chaincode in JSON format (default "{}")
      -E, --escc string                 The name of the endorsement system chaincode to be used for this chaincode
      -l, --lang string                 Language the chaincode is written in (default "golang")
      -n, --name string                 Name of the chaincode
      -P, --policy string               The endorsement policy associated to this chaincode
      -v, --version string              Version of the chaincode specified in install/instantiate/upgrade commands
      -V, --vscc string                 The name of the verification system chaincode to be used for this chaincode

   Global Flags:
      --cafile string                       Path to file containing PEM-encoded 
   trusted certificate(s) for the ordering endpoint
      --certfile string                     Path to file containing PEM-encoded 
   X509 public key to use for mutual TLS communication with the orderer endpoint
      --clientauth                          Use mutual TLS when communicating with 
   the orderer endpoint
      --keyfile string                      Path to file containing PEM-encoded 
   private key to use for mutual TLS communication with the orderer endpoint
      --logging-level string                Default logging level and overrides, 
   see core.yaml for full syntax
      -o, --orderer string                      Ordering service endpoint
          --ordererTLSHostnameOverride string   The hostname override to use when 
   validating the TLS connection to the orderer.
      --tls                                 Use TLS when communicating with the 
   orderer endpoint
      --transient string                    Transient map of arguments in JSON 
   encoding

3 个答案:

答案 0 :(得分:0)

超时问题是在实例化链代码期间发生的常见问题。在发布

之后,可以帮到你的是什么
peer chaincode instantiate 

命令或当日志达到此状态时

[chaincodeCmd] install -> DEBU 00c Installed remotely response:<status:200 payload:"OK" >

,在单独的终端中,使用

列出docker容器
docker ps

你会注意到一个你以前从未听过的随机名称的容器,它的图像(fabric-ccenv)显示它是一个安全的docker容器,它是为建立链代码环境而启动的。记下容器的名称并使用

拖尾其日志
docker logs -f <container-name-here>

现在你会在日志中看到它实际上解析了chaincode的package.json中列出的npm依赖项。依赖项解析有时会比预期时间稍微大一些,因此结构运行时会因超时问题而退出。如果结构脚本以超时问题退出,那么您必须执行到对等的docker容器并执行

peer chaincode instantiate [flags]

命令手动提供必要的标志和参数。如果完全解析了依赖关系,链码将在几秒钟内开始。

答案 1 :(得分:0)

我遇到了类似的问题。我通过确保docker容器以正确的顺序启动来解决此问题。例如,订购者容器应在对等方启动之前启动。如果容器的启动顺序不正确,则在创建通道(SERVICE_UNAVAILABLE)或实例化链码时会遇到问题(超时错误)。

答案 2 :(得分:0)

我遇到了同样的错误。在我的情况下,问题是项目文件夹的名称与网络名称不同,这些名称以某种方式相关并且必须相同。我重命名了文件夹,问题消失了。