在 HyperLedger Fabric 中对等节点安装链码

Chaincode installation on peer in HyperLedger Fabric

我正在尝试在本地测试我的链码,为此我有一个 运行 的脚本,但是在安装链码(下面的代码)时出现链码路径不存在的错误?

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

在我看到的所有示例中都使用了以下命令

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

我的问题恰恰是如何更正我的路径以指向链码?

您需要在 GOPATH 中提供您的链代码,然后您应该能够安装它。只需将您的 bitbucket 文件夹添加到 GOPATH 或将您的链代码移动到 $GOPATH/src.

更新

以下命令

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

需要替换为

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

感谢您的回答。我的链码已经在 $GOPATH 中了。目录结构如下。目录结构如下

$GOPATH                                                                                                              ->src       
    --->bitbucket.org
    ------>FolderName
    --------->chaincodefolder
    ------------->chaincodenamefolder
    ----------------chaincode.go
    ---------->Middleware
    ---------->localfabricfolder
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