doujiao3016 2017-08-22 12:34
浏览 164
已采纳

找不到在Windows 7上运行的自定义链码路径Hyperledger Fabric V1.0本地网络

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.

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

  • 写回答

1条回答 默认 最新

  • dongmieqiao3152 2017-08-22 20:09
    关注

    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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 metadata提取的PDF元数据,如何转换为一个Excel
  • ¥15 关于arduino编程toCharArray()函数的使用
  • ¥100 vc++混合CEF采用CLR方式编译报错
  • ¥15 coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?
  • ¥15 vite+vue3+plyr播放本地public文件夹下视频无法加载
  • ¥15 c#逐行读取txt文本,但是每一行里面数据之间空格数量不同
  • ¥50 如何openEuler 22.03上安装配置drbd
  • ¥20 ING91680C BLE5.3 芯片怎么实现串口收发数据
  • ¥15 无线连接树莓派,无法执行update,如何解决?(相关搜索:软件下载)
  • ¥15 Windows11, backspace, enter, space键失灵