进行交易时,催眠型织物链码,奇怪的行为
我的行为非常奇怪,所以基本上我进行了交易,交易在资源管理器中可见,资产仅添加一次。但是可以像资产传输基础链代码一样更新,因此,如果交易在那里,我检查了该交易。
我没有结果,再次添加了资产,但是什么也没有,我看到了Explorer上的交易,但是我无法添加,而资产管理员返回false,这意味着尚未创建资产?
你们有任何类似的行为吗?
提前致谢。
peer chaincode query -C assets -n basicasset -c '{"Args":["AddAsset","112233","asset01","123","[email protected]","+32323232323","adress 54","24","male","0","yes"]}'
peer chaincode query -C assets -n basicasset -c '{"Args":["GetAllAssets"]}'
而且我的日志已完成交易
2022-05-03T16:43:23.249Z info [c-api:lib/handler.js] [users-1c1d1d2f] Calling chaincode Invoke() succeeded. Sending COMPLETED message back to peer
2022-05-03T16:43:32.914Z info [c-api:lib/handler.js] [users-03399546] Calling chaincode Invoke() succeeded. Sending COMPLETED message back to peer
2022-05-03T16:45:17.563Z info [c-api:lib/handler.js] [users-da06502d] Calling chaincode Invoke() succeeded. Sending COMPLETED message back to peer
I have a really weird behavior, so basically I make a transaction, the transaction is visible in explorer, the asset is added only once. But can be updated just like the asset-transfer-basic chain code, so I checked the transaction if it is there.
I got no result, added the asset again, but nothing, I see the transaction on explorer, but I can't add, and the AssetExist return false, meaning the asset has not been created?
Any similar behavior you guys have?
thanks in advance.
peer chaincode query -C assets -n basicasset -c '{"Args":["AddAsset","112233","asset01","123","[email protected]","+32323232323","adress 54","24","male","0","yes"]}'
peer chaincode query -C assets -n basicasset -c '{"Args":["GetAllAssets"]}'
And i have the log with completed transaction
2022-05-03T16:43:23.249Z info [c-api:lib/handler.js] [users-1c1d1d2f] Calling chaincode Invoke() succeeded. Sending COMPLETED message back to peer
2022-05-03T16:43:32.914Z info [c-api:lib/handler.js] [users-03399546] Calling chaincode Invoke() succeeded. Sending COMPLETED message back to peer
2022-05-03T16:45:17.563Z info [c-api:lib/handler.js] [users-da06502d] Calling chaincode Invoke() succeeded. Sending COMPLETED message back to peer
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在执行查询(或“评估”交易)。在这里,您的客户正在发送一个由智能合约执行的交易建议,并返回提案响应。除其他方面,此提案响应包含交易中的返回值,因此您可以看到执行交易的结果,但 均未写给分类帐。
以更新您需要调用交易(或“提交”交易)的分类帐。这将向同行发送建议,并获得(认可)提案响应,类似于您评估交易时。但是,然后将此认可的事务发送给订单者,将其投入到一个块中,然后将其分配给同行,然后他们(假设交易通过验证)将事务更新应用于分类帐。
总而言之,您没有看到任何分类帐更新,因为您没有更新分类帐。您只是在查询分类帐状态。
You are executing a query (or "evaluating" a transaction). Here your client is sending a transaction proposal, which is executed by the smart contract, and a proposal response is returned. Amongst other things, this proposal response contains the return value from the transaction, so you can see the result of executing the transaction but nothing has been written to the ledger.
To update the ledger you need to invoke the transaction (or "submit" the transaction). This sends proposals to peers and obtains (endorsed) proposal responses, similar to when you evaluate a transaction. However, this endorsed transaction is then sent to the orderers to be committed into a block, which is then distributed to peers, and they (assuming the transaction passes validation) apply the transaction updates to the ledger.
In summary, you are not seeing any ledger updates because you are not updating the ledger. You are only querying ledger state.