问题描述
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\"]}"
推荐答案
描述的行为可能是由于对等方无法使用实例化命令获取该块的事实.实例化命令毕竟是必须被认可,排序和提交的事务.可能使您感到困惑的是,对等客户端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实例化成功,但查询失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!