简体   繁体   English

HyperLedger Fabric中对等体上的Chaincode安装

[英]Chaincode installation on peer in HyperLedger Fabric

I am trying to test my chaincode locally, for this I have a script to run, but whilst installation of chaincode(code below) getting error that chaincode path does not exists? 我试图在本地测试我的链代码,为此我有一个脚本可以运行,但是在安装链代码(下面的代码)时会得到链代码路径不存在的错误?

peer chaincode install -n mycc -v 1.0 -p ./bitbucket.org/Foldername/testBlockchain/folder_name_for_chaincode

in all of the examples I have seen following command is used 在我看到的所有示例中都使用了以下命令

peer chaincode -n mycc -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02

My question precisely is that how can I correct my path to point to chaincode? 我的问题恰恰是我如何纠正指向链码的路径?

You need to have your chaincode available in the GOPATH, then you should be able to install it. 您需要在GOPATH中提供您的链代码,然后您应该能够安装它。 Just either add your bitbucket folder into GOPATH or move you chaincode into $GOPATH/src . 只需将您的bitbucket文件夹添加到GOPATH中或将链码移动到$GOPATH/src

Update 更新

The following command 以下命令

peer chaincode install -n mycc -v 1.0 -p ./bitbucket.org/Foldername/testBlockchain/folder_name_for_chaincode

need to be replaced with 需要更换

peer chaincode install -n mycc -v 1.0 -p bitbucket.org/Foldername/testBlockchain/folder_name_for_chaincode
Step a)
get the channel name using the following

peer channel list

step b)
get the chaincode version using this 

peer chaincode list --installed

在此输入图像描述

step c)
install the chaincode using this

CORE_PEER_ADDRESS=peer0.org1.example.com:7051 peer chaincode install -n mycc -p github.com/lc/go -v v3 


-n=name,
-v=version,
-p=path

Thanks for your answer. 感谢您的回答。 My chain code is already in $GOPATH. 我的链码已经在$ GOPATH。 Directory structure is as follows. 目录结构如下。 Directory structure is as follows 目录结构如下

$GOPATH                                                                                                              ->src       
    --->bitbucket.org
    ------>FolderName
    --------->chaincodefolder
    ------------->chaincodenamefolder
    ----------------chaincode.go
    ---------->Middleware
    ---------->localfabricfolder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM