微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 Chaincode 部署到 Hyperledger Fabric 不起作用

如何解决将 Chaincode 部署到 Hyperledger Fabric 不起作用

所以我尝试将自定义链码部署到我的超级账本测试网络。因此,我使用了 https://www.youtube.com/watch?v=KFf1qzYP-bA&t=1380shttps://hyperledger-fabric.readthedocs.io/en/release-2.3/deploy_chaincode.html 中的教程。 按照教程,起初我认为这个过程是成功的,但最后我遇到了错误。以下是我所做的步骤:

peer lifecycle chaincode install newchaincode.tar.gz

得到了

2021年6月20日16:41:18.750 UTC [cli.lifecycle.chaincode] submitInstallProposal - > INFO 001安装远程:响应: 2021-06-20 16:41:18.750 UTC [cli.lifecycle.chaincode] submitInstallProposal -> INFO 002 Chaincode 包标识符:newchaincode:a52b26224459812b50d72da7fc0644ff2b2c5652b5b5ca57b5b5dca

还检查是否安装了链码:

peer lifecycle chaincode queryinstalled

包 ID:newchaincode:a52b26224459812b50d72da7fc0644ff2b2c540bd656bbf457a235bca15b3a57,标签:newchaincode

之后我导出了 CC_Package_ID 并为两个组织设置了批准表单

peer lifecycle chaincode approveformyorg -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID newchannel --name newchaincode --version 1.0 --package-id $CC_PACKAGE_ID --sequence 1 --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

ClientWait -> INFO 001 txid [e2dfcfc6b5218423878132af6f34ebbef25cd793b258581900b21e1fcca98b63] 在 localhost:7051 提交状态(有效)

然后检查提交准备:

peer lifecycle chaincode checkcommitreadiness --channelID newchannel --name newchaincode --version 1.0 --sequence 1 --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --output json

{ “批准”:{ "Org1MSP": 真,“Org2MSP”:真 } }

然后我提交了我的链码:

peer lifecycle chaincode commit -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --channelID newchannel --name newchaincode --version 1.0 --sequence 1 --tls --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem --peerAddresses localhost:7051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${PWD}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt

2021-06-20 16:48:24.990 UTC [chaincodeCmd] ClientWait -> INFO 001 txid [9336b174e344fb5fd977778e7365da0841b3285eff8c03f43f7778e7365da0841b3285eff8c03f43f68c03f43f884000000000000001 txid] 2021-06-20 16:48:24.993 UTC [chaincodeCmd] ClientWait -> INFO 002 txid [9336b174e344fb5fd977778e7365da0841b3285eff8c0fa1032658c0fa103265] localhost 提交状态002 txid

最后,检查我是否正确提交:

peer lifecycle chaincode querycommitted --channelID newchannel --name newchaincode --cafile ${PWD}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem

在通道“newchannel”上提交链码“newchaincode”的链码定义: 版本:1.0,序列:1,背书插件:escc,验证插件:vscc,审批:[Org1MSP:true,Org2MSP:true]

所以 - 我认为链码安装成功,但是当我尝试调用 CC 时,我得到了这个:

错误调用期间背书失败。响应:状态:500 消息:“确保已在通道 newchannel 上成功定义链码 newchaincode 并重试:未找到链码 newchaincode”

此外,当我调用 docker ps 时,没有链码在运行。 目前我非常沮丧,但也许你们中的一些人可以看到我的错误! :)

先谢谢你!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。