为什么Chaincode实例化成功,但查询失败 [英] Why chaincode instantiate success, but query failed

查看:262
本文介绍了为什么Chaincode实例化成功,但查询失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

peer chaincode install -n simple-token -v 1.0 -l java -p /Users/friends/Documents/Virtual\ Machines.localized/share/projects/hsl-hsl-user-guide-examples-v14/simple-token/simple-token-chaincode

对等链代码实例化成功.

peer chaincode instantiate successed.

peer chaincode instantiate -o orderer:7050 -C helloch  -n simple-token -v 1.0 -l java -c "{\"Args\":[\"init\",\"{'id':'admin1','nick':'admin','type':'ADMIN','balance':100}\", \"{'id':'LiLei','nick':'LiLei','type':'ORDINARY','balance':100}\", \"{'id':'HanMeimei','nick':'HanMeimei','type':'ORDINARY','balance':100}\"]}"

但是在我的shell中不能在对等链码查询中失败,而不是cli docker,为什么? 实际上,

but failed in peer chaincode query in my shell not cli docker,Why? Actually ,

peer chaincode query -o 127.0.0.1:7050 -C helloch -n  hello -c "{\"Args\":[\"user.get\",\"\",\"LiLei\"]}"

错误:错误支持查询:rpc错误:code =未知desc =找不到名称为'simple-token'的链码-确保已成功实例化链码simple-token并重试-hy

Error: Error endorsing query: rpc error: code = Unknown desc = could not find chaincode with name 'simple-token' - make sure the chaincode simple-token has been successfully instantiated and try again - hy

推荐答案

描述的行为可能是由于对等方无法使用实例化命令获取该块的事实.实例化命令毕竟是必须被认可,排序和提交的事务.可能使您感到困惑的是,对等客户端cli成功地认可了实例化事务并将其提交给订购服务.尽管可能未提交,但是链码容器未启动,因此您无法查询链码.

Described behavior could be due to the fact that peer is not able to get the block with instantiate command. The instantiate command after all is a transaction which has to be endorsed, ordered and committed. What probably confuses you is the fact that peer cli succeeded to endorse instantiate transaction and submit it to the ordering service. While it might not be committed, hence chaincode container not started and as a result you are not able to query your chaincode.

这篇关于为什么Chaincode实例化成功,但查询失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆