分布式设置的链码实例化问题

时间:2018-11-13 13:53:21

标签: hyperledger-fabric hyperledger-fabric-ca

我正在使用Fabric版本1.2。在同一个组织ORG1MSP中运行具有一个订购者和一个对等点的网络。我关注了this博客,但是我试图在不同的VM上运行订购者和同级物品。

Orderer IP: 192.168.1.5
Peer0 IP: 192.168.1.22

在第一个VM上启动了Orderer和CA容器,在第二个VM上运行了peer0,couchdb和cli。 Peer0能够创建频道,获取频道配置并加入频道。

现在,我正在尝试在fabric / examples / chaincode / go / example02路径中部署可用的chaincode。我将卷装入所有容器,如下所示:

- /root/gopath/src/github.com/hyperledger/fabric/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples

我从CLI容器运行命令。安装命令: CORE_PEER_ADDRESS=peer0.org1.example.com:7051 peer chaincode install -n example02 -p github.com/hyperledger/fabric/examples/chaincode/go/example02 -v v0

它显示以下日志:

2018-11-13 11:13:34.112 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-11-13 11:13:34.112 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
2018-11-13 11:13:34.336 UTC [chaincodeCmd] install -> INFO 003 Installed remotely response:<status:200 payload:"OK" >

然后,我尝试按以下方式实例化链码:

root@fa36d48915d7:/opt/gopath/src/github.com/hyperledger/fabric# CORE_PEER_ADDRESS=peer0.org1.example.com:7051 peer chaincode instantiate -o 192.168.1.5:7050 -C mychannel -n example02 -v v0 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member')"
2018-11-13 11:21:46.383 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2018-11-13 11:21:46.383 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: could not assemble transaction, err Proposal response was not successful, error code 500, msg failed to execute transaction 81b57fb4635092074d3585cec328e4c54f8f1d45028664795a56cfbc7f5a4c80: error starting container: error starting container: API error (400): OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"chaincode\": executable file not found in $PATH": unknown

请提供适当的解决方案。

3 个答案:

答案 0 :(得分:3)

我有一个类似的问题。我发现,如果软件包的名称不是主要的,那么就会产生此错误。

检查example02.go文件,第一行是程序包名称。 将软件包名称替换为main(如果还有其他名称),然后再次尝试安装。

安装-v v1并启动

CORE_PEER_ADDRESS=peer0.org1.example.com:7051 peer chaincode install -n example02 -p github.com/hyperledger/fabric/examples/chaincode/go/example02 -v v1

CORE_PEER_ADDRESS=peer0.org1.example.com:7051 peer chaincode instantiate -o 192.168.1.5:7050 -C mychannel -n example02 -v v1 -c '{"Args":["init","a","100","b","200"]}' -P "OR ('Org1MSP.member','Org2MSP.member')"

答案 1 :(得分:2)

最近遇到了这个问题,并花费了大量时间进行谷歌搜索。 我通过将CC_SRC_PATH路径变量设置到docker容器中安装链码的目录中,然后在安装和实例化链码时引用它来修复了它。参考链接:

  1. https://jira.hyperledger.org/browse/FAB-10019
  2. https://www.edureka.co/community/23994/how-to-define-the-path-to-hyperledger-fabric-chaincode

在多个论坛上人们如何解决此问题的讨论中,由于各种原因,可能会出现这种情况。以下是链接列表,可快速参考所有链接:

  1. OCI runtime error when sending Hyperledger Fabric's chaincode instantiation request to peers
  2. https://github.com/davidkhala/fabric-common#notes
  3. https://github.com/cloudhuang/fabric-vagrant-env#troubleshooting

答案 2 :(得分:0)

错误

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg error starting container: error starting container: API error (400): OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"chaincode\": executable file not found in $PATH": unknown

程序包名称应为主

package main
相关问题