简体   繁体   English

Hyperledger Fabric 链码升级

[英]Hyperledger fabric chaincode upgrade

I have setup the hyper-ledger fabric network with 2 organisation, and have install the fabcar chain-code with version v1.1 on peer and i am keeping the storage of blockchain.我已经设置了具有 2 个组织的超级账本结构网络,并在对等节点上安装了 v1.1 版的 fabcar 链代码,并且我正在保留区块链的存储。

Next i added more methods on fabcar, Trying to upgrade the exist fabcar to v1.2, but i am facing the error.接下来我在 fabcar 上添加了更多方法,尝试将现有的 fabcar 升级到 v1.2,但我面临错误。

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg cannot get package for chaincode (fabcar:1.2)错误:无法组装交易,错误提议响应不成功,错误代码 500,msg 无法获取链码的包 (fabcar:1.2)

I am using the below command to upgrade the chaincode我正在使用以下命令升级链码

peer chaincode upgrade -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n fabcar -v 1.2 -c '{"Args":[""]}' -P "OR('Org1MSP.peer','Org2MSP.peer')"

You first have to install the upgraded version of the chaincode by installing it as version 1.2.您首先必须通过将链码安装为 1.2 版来安装链码的升级版本。 Then upgrade it as you were doing earlier.然后像之前一样升级它。

Error: could not assemble transaction, err proposal response was not successful, error code 500, msg cannot get package for chaincode (fabcar:1.2)错误:无法组装交易,错误提议响应不成功,错误代码 500,msg 无法获取链码的包 (fabcar:1.2)

Means your upgraded chaincode was not installed on peers.意味着你升级的链码没有安装在对等点上。

Check Your chanincode installed on peers or not?检查您的 chanincode 是否安装在同行上?

peer chaincode list --installed

In the output, You saw the only previous installed chaincode.在输出中,您看到了之前安装的唯一链码。 So you have to first package a chaincode and then upgrade a chaincode.所以你必须先打包一个链码,然后升级一个链码。

 peer chaincode package ccpack.out -n fabcar -p github.com/hyperledger/fabric/examples/chaincode/go/fabcar -v 1.2 -s -S

peer chaincode signpackage example对等链码签名包示例

 peer chaincode signpackage ccwith1sig.pak ccwith2sig.pak

Upgrade chaincode升级链码

peer chaincode upgrade -o orderer.example.com:7050 --tls --cafile $ORDERER_CA -C mychannel -n fabcar -v 1.2 -c '{"Args":[""]}' -P "OR('Org1MSP.peer','Org2MSP.peer')"

I recommend this link to upgrade your fabric chaincode.我推荐这个链接来升级你的结构链码。

Note: replace chaincode path with your chaincode path.注意:用您的链码路径替换链码路径。

Hope it will help you :)希望它会帮助你:)

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

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