Unable to find custom chaincode path Hyperledger Fabricv1.0 local network running on windows7

huangapple go评论82阅读模式
英文:

Unable to find custom chaincode path Hyperledger Fabricv1.0 local network running on windows7

问题

我正在尝试在本地的Hyperledger Fabric v1.0环境中安装我的自定义链码。

为此,我按照文档构建你的第一个网络进行操作,并使用GitHub项目中的第一个网络示例。现在,我已经通过运行./byfn.sh -m up命令使其运行起来,并通过运行script.sh文件执行所有的通道创建、链码安装和实例化脚本。

现在,我已经更改了以下内容以尝试我的自定义链码:

peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02>&log.txt

我将其更改为:

peer chaincode install -n mycc -v 1.0 -p github.com/myuserId/fabrcicV1_chaincodes/mychaincode >&log.txt

现在通过运行./byfn.sh -m up出现异常:

2017-08-22 11:01:17.048 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: Error getting chaincode code chaincode: path to chaincode does not exist: github.com/myuserId/fabrcicV1_chaincodes/mychaincode
Usage:
  peer chaincode install [flags]

Flags:
  -c, --ctor string      Constructor message for the chaincode in JSON format (default "{}")
  -l, --lang string      Language the chaincode is written in (default "golang")
  -n, --name string      Name of the chaincode
  -p, --path string      Path to chaincode
  -v, --version string   Version of the chaincode specified in install/instantiate/upgrade commands

Global Flags:
      --cafile string              Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoi
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string             Ordering service endpoint
      --test.coverprofile string   Done (default "coverage.cov")
      --tls                        Use TLS when communicating with the orderer endpoint

!!!!!!!!!!!!!!! Chaincode installation on remote peer PEER0 has Failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

我在GitHub上有这个存储库,为什么它显示不存在

我已经将其克隆Windows 7机器上的路径$GOPATH/src/github.com/,并给出了本地路径,但仍然出现相同的错误。我通过Windows 7的docker快速启动终端运行所有命令。

请建议我哪里出错了。

此外,在一些网络日志中,我发现了一个位置/opt/gopath/src/github.com/....,它指向哪里。在我的Windows路径中,gopath是/c/users/public/fabricv1

由于我对这个工具不太熟悉,请对此发表评论。

经过我自己的分析,似乎链码正在从一些预装的目录中读取sacc/、fabcar/、/marble02、chaincode_example_02、hyperledger/,这些目录位于路径***root@7785f8b27559:/opt/gopath/src/chaincodedev/chaincode#下,并且链码也在使用docker镜像时预加载。在这里,似乎将链码添加到Windows文件夹中没有效果***,它来自上述虚拟机路径。

那么现在我该怎么做才能继续我的工作呢?有没有办法将我的自定义链码安装到本地网络中。我尝试了我的GitHub路径和本地路径,但没有用。请有人帮忙 Unable to find custom chaincode path Hyperledger Fabricv1.0 local network running on windows7

英文:

I am trying to install my custom chain code in my local Hyperledger Fabric v1.0 environment.

For this I have followed the documentation build your first network and I am using first network sample with in the github project. No it is up and running with ./byfn.sh -m up and executing all the scripts for channel creating, chain code installation and instantiation and all by running script.sh file.

Now I have changed the following to tryout my custom chaincode

peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02>&log.txt

this I have changed to

peer chaincode install -n mycc -v 1.0 -p github.com/myuserId/fabrcicV1_chaincodes/mychaincode >&log.txt

Now by running ./byfn.sh -m up getting the exception

2017-08-22 11:01:17.048 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: Error getting chaincode code chaincode: path to chaincode does not exist: github.com/myuserId/fabrcicV1_chaincodes/mychaincode
Usage:
  peer chaincode install [flags]

Flags:
  -c, --ctor string      Constructor message for the chaincode in JSON format (default "{}")
  -l, --lang string      Language the chaincode is written in (default "golang")
  -n, --name string      Name of the chaincode
  -p, --path string      Path to chaincode
  -v, --version string   Version of the chaincode specified in install/instantiate/upgrade commands

Global Flags:
      --cafile string              Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoi
      --logging-level string       Default logging level and overrides, see core.yaml for full syntax
  -o, --orderer string             Ordering service endpoint
      --test.coverprofile string   Done (default "coverage.cov")
      --tls                        Use TLS when communicating with the orderer endpoint

!!!!!!!!!!!!!!! Chaincode installation on remote peer PEER0 has Failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========

I have the repository there in github, then why it is not showing does not exit?

I have cloned the same to Windows 7 machine under the path $GOPATH/src/github.com/ and given local path, then also I am getting the same error. I am running all the commands through docker quick start terminal for windows 7.

Please suggest where I am doing wrong.

Also in some of the network log I have found a location /opt/gopath/src/github.com/.... and where it is pointing to. In my windows path gopath is /c/users/public/fabricv1.

Since I am not much familiar with the tool, please comment on this also.
1: http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html
2: https://github.com/hyperledger/fabric-samples
3: https://github.com/

> After doing some analysis from my side, it seems like the chain code
> is reading from some pre-mounted directories sacc/, fabcar/, /marble02
> , chaincode_example_02, hyperledger/
under the path
> root@7785f8b27559:/opt/gopath/src/chaincodedev/chaincode# and
> chaincode also pre-loaded at the time of making the network up
> using docker image. There it seems no effect by adding chaincode in
> windows folder
and it is from the above said virtual machine path.
>
> So what can I do now to continue my work? is there any way to install
> my custom chaincode to the local network. I tried with my githhub path
> and local path but no use. please somebody help Unable to find custom chaincode path Hyperledger Fabricv1.0 local network running on windows7

答案1

得分: 7

似乎您的链码不在$GOPATH中,您需要运行以下命令:

go get github.com/myuserId/fabrcicV1_chaincodes/mychaincode

在尝试在对等节点上安装链码之前,您需要确保您的新链码位于fabric-samples/chaincode文件夹中。还要注意,您需要将包含链码的文件夹挂载到docker cli容器中,参见当前docker-compose-cli.yaml文件的示例:

volumes:
    - /var/run/:/host/var/run/
    - ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
    - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
    - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
    - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts

特别是,您可能需要将此处的路径替换为您的链码路径,或者确保在cli容器的$GOPATH中挂载一个额外的文件夹:

- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
英文:

It seems that you do not have your chaincode in the $GOPATH, you need to run:

go get github.com/myuserId/fabrcicV1_chaincodes/mychaincode

Before trying to install the chaincode on peer, in your case where you are using build your first network, you need to make sure your new chaincode inside fabric-samples/chaincode folder. And also note that you need to mount folder with your chaincode into docker cli container, see example of current docker-compose-cli.yaml file:

volumes:
    - /var/run/:/host/var/run/
    - ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
    - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
    - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
    - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts

In particular, you probably need to replace here with your chaincode or make sure to mount an additional folder within $GOPATH of cli container:

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

huangapple
  • 本文由 发表于 2017年8月22日 20:34:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/45817797.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定