如何在Hyperledger Composer查询中显示交易输入数据 [英] How to show transaction input data in a Hyperledger Composer query

查看:62
本文介绍了如何在Hyperledger Composer查询中显示交易输入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个Historian查询,使我能够查看事务"(及其原始输入).我有点根据这个问题尝试一个想法 https://github.com/hyperledger/composer/issues/1850 ,但这已在Composer Playground中修复.因此,现在我想知道如何在REST API中实现该功能,而又不依赖于事件来保存事务输入信息.

I'm trying to build a Historian Query that will allow me to see Transactions (and their original inputs). I was kind of trying out an idea based on this issue https://github.com/hyperledger/composer/issues/1850, but that was fixed in the Composer Playground. So now I'm wondering how I can achieve this in the REST API without relying on events to hold the transaction input information.

根据查询文档,我正在使用的查询是:

The query I'm using from following the documentation on queries is:

query HistorianRecords {
  description: "Select from HistorianRecords"
  statement: SELECT org.hyperledger.composer.system.HistorianRecord

}

这会给我返回这样的信息

That returns me information like this

  {
    "$class": "org.hyperledger.composer.system.HistorianRecord",
    "transactionId": "c1bcd961-41bb-43a3-b5ee-c1c3694f7736",
    "transactionType": "Transfer",
    "transactionInvoked": "resource:org.hyperledger.composer.system.Transaction#c1bcd961-41bb-43a3-b5ee-c1c3694f7736",
    "eventsEmitted": [],
    "transactionTimestamp": "2017-09-04T07:55:54.405Z"
  }

未显示交易的任何输入信息.

None of the input information for the transaction displayed.

我想获取诸如在线游乐场如何显示之类的信息,该信息基本上包括交易输入,即.在示例网络中,您输入资产 newValue

I'd like to get the information like how the Online Playground displays it, which basically includes the transaction inputs, ie. in the sample network where you input asset and newValue

{
 "$class": "org.acme.sample.SampleTransaction",
 "asset": "resource:org.acme.sample.SampleAsset#a",
 "newValue": "123",
 "transactionId": "0b7aa7b5-ffed-4fe7-9a60-c883085b88e8",
 "timestamp": "2017-09-04T08:50:53.346Z"
}

我的网络涉及从参与者到参与者的付款发送,而无法看到谁将多少钱传递给了谁,基本上使区块链变得毫无意义.

My network involves the sending of payments from participant to participant, not being able to see who passed how much to who basically renders the blockchain pointless.

如何使用查询执行此操作?

How can I do this using the queries?

推荐答案

实际上,我不用费心去查询Historian,而是使用此查询来工作

So actually, instead of bothering with a query to the Historian, I got this to work using this query

query myTransactions{
  description: "return all transactions made (not system transactions)"
  statement: SELECT org.acme.sample.NAME_OF_TRANSACTION_CLASS

}

这篇关于如何在Hyperledger Composer查询中显示交易输入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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