简体   繁体   English

使用超级账本结构 2.0 提交链代码调用/查询时出错

[英]Error in committed chaincode invoke/query with hyperledger fabric 2.0

I have successfully committed the chaincode with command:我已经使用命令成功提交了链码:

./peer lifecycle chaincode commit -o orderer.example.org:7050 --channelID mychannel --name emp_chaincode --version v1 --sequence 1 --init-required --tls --cafile ./crypto-config/ordererOrganizations/example.org/orderers/orderer.example.org/msp/tlscacerts/tlsca.example.org-cert.pem

Now when I try to invoke/query a the chaincode, I get this error:现在,当我尝试调用/查询链码时,出现此错误:

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction f490a9e7bca41ad10f68306decae2fdd73e09a9d5f81da7c9ee5cdc3811b3f27: invalid invocation: chaincode 'emp_chaincode' has not been initialized for this version, must call as init first"

and in chaincode container logs, it shows:在链码容器日志中,它显示:

+ CHAINCODE_DIR=/usr/local/src

+ cd /usr/local/src

+ npm start -- --peer.address peer0.org1.example.org:7052


> employee@1.0.0 start /usr/local/src

> node emp_chaincode.js "--peer.address" "peer0.org1.example.org:7052"

2020-02-25T09:28:16.743Z info [c-api:lib/chaincode.js] Registering with peer peer0.org1.example.org:7052 as chaincode "emp_chaincodev1:5bcbed31afc58894912eb4c66d63adcec7eab029e2b911887412b119ef5cf319"

2020-02-25T09:28:16.761Z error [c-api:lib/handler.js] Chat stream with peer - on error: %j "Error: 14 UNAVAILABLE: failed to connect to all addresses\n at Object.exports.createStatusError (/usr/local/src/node_modules/grpc/src/common.js:91:15)\n at ClientDuplexStream._emitStatusIfDone (/usr/local/src/node_modules/grpc/src/client.js:233:26)\n at ClientDuplexStream._receiveStatus (/usr/local/src/node_modules/grpc/src/client.js:211:8)\n at Object.onReceiveStatus (/usr/local/src/node_modules/grpc/src/client_interceptors.js:1311:15)\n at InterceptingListener._callNext (/usr/local/src/node_modules/grpc/src/client_interceptors.js:568:42)\n at InterceptingListener.onReceiveStatus (/usr/local/src/node_modules/grpc/src/client_interceptors.js:618:8)\n at /usr/local/src/node_modules/grpc/src/client_interceptors.js:1127:18"

Please let me know how can I fix it.请让我知道我该如何解决它。

UPDATE:更新:

After R Thatcher suggested flag addition, error I get now is:在 R Thatcher 建议添加标志之后,我现在得到的错误是:

Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction 038b5c303dfdd98db2c2fc0d2eac6146d7221691cbbed7a78227f5a76a31a240: could not launch chaincode emp_chaincodev1:5bcbed31afc58894912eb4c66d63adcec7eab029e2b911887412b119ef5cf319: chaincode registration failed: container exited with 0"

Right at the end of your error you have must call as init first .在错误结束时,您必须首先调用 init

I would think that you have used the peer chaincode lifecycle approveformyorg command with the flag --init-required .我认为您已经使用了带有--init-required标志的peer chaincode lifecycle approveformyorg命令。 This means that the first invoke of the new chaincode must use the --isInit flag eg peer chaincode invoke -C tradechannel -n trade --isInit ... .这意味着新链码的第一次调用必须使用--isInit标志,例如peer chaincode invoke -C tradechannel -n trade --isInit ... After this first "special" invoke, other invokes and querys will be fine.在第一次“特殊”调用之后,其他调用和查询就可以了。

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

相关问题 Hyperledger Fabric Chaincode开发人员模式连接错误 - hyperledger fabric chaincode dev mode connection error Hyperledger Fabric 2.3.3 install TypeScript 尽管安装了链码,但无法调用链码问题? - Hyperledger Fabric 2.3.3 install TypeScript chaincode issue can't invoke despite chaincode being installed? Hyperledger Fabric-商业用纸教程-链码实例化错误 - Hyperledger Fabric - Commercial Paper tutorial - chaincode instantiate error Windows 10 上的 Hyperledger Fabric 测试网络链码安装错误 500 - Hyperledger Fabric test network chaincode installation Error 500 on windows 10 在超级账本结构上安装我的链码时,docker 构建被禁用错误 - docker build is disabled error when installing my chaincode on hyperledger fabric Hyperledger Fabric 网络中的链码问题 - Chaincode problem in Hyperledger fabric network 如何更新Hyperledger Fabric中的链码? - How to update the chaincode in Hyperledger Fabric? 在 Hyperledger Fabric 上部署链码失败 - Chaincode deploying fails on Hyperledger Fabric 无法通过 NodeJS 查询/调用 Hyperledger Fabric Peers(在 docker swarm 网络中) - GRPC/S 截止日期错误 - Failed to query/invoke Hyperledger Fabric Peers(in a docker swarm network) via NodeJS - GRPC/S deadline Error Hyperledger Fabric byfn 实例化失败 - 链码存在 - Hyperledger Fabric byfn instantiate fails - chaincode exists
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM