gpt4 book ai didi

go - 无法找到在 windows7 上运行的自定义链代码路径 Hyperledger Fabricv1.0 本地网络

转载 作者:IT王子 更新时间:2023-10-29 00:38:25 25 4
gpt4 key购买 nike

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

为此,我遵循了文档 build your first network我在 github 中使用第一个网络示例项目。不,它是通过 ./byfn.sh -m up 启动并运行的,并通过运行 script.sh 文件执行所有用于 channel 创建、链代码安装和实例化的脚本。

现在我更改了以下内容以试用我的自定义链码

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 中有存储库,那为什么不显示不退出呢?

我已经克隆到路径 $GOPATH/src/github.com/下的 Windows 7 机器并给定本地路径,然后我也得到相同的错误。我正在通过 windows 7 的 docker 快速启动终端运行所有命令。

请指出我哪里做错了。

我还在一些网络日志中找到了一个位置 /opt/gopath/src/github.com/.... 以及它指向的位置。在我的 Windows 路径中,gopath 是 /c/users/public/fabricv1

由于我对这个工具不是很熟悉,所以也请评论一下。

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 :(

最佳答案

$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

关于go - 无法找到在 windows7 上运行的自定义链代码路径 Hyperledger Fabricv1.0 本地网络,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45817797/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com