如何在 Hyperledger Composer 查询中显示交易输入数据
How to show transaction input data in a Hyperledger Composer query
我正在尝试构建一个允许我查看交易(及其原始输入)的 Historian 查询。我正在尝试基于这个问题 https://github.com/hyperledger/composer/issues/1850 的想法,但它已在 Composer Playground 中修复。所以现在我想知道如何在 REST API 中实现这一点而不依赖于事件来保存交易输入信息。
我根据查询文档使用的查询是:
query HistorianRecords {
description: "Select from HistorianRecords"
statement: SELECT org.hyperledger.composer.system.HistorianRecord
}
那个returns我这样的信息
{
"$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显示的交易输入信息
我想了解 Online Playground 如何显示它的信息,其中基本上包括交易输入,即。在您输入 asset 和 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"
}
我的网络涉及从参与者向参与者发送付款,无法看到谁向谁传递了多少基本上使区块链变得毫无意义。
如何使用查询来执行此操作?
所以实际上,我没有费心向 Historian 查询,而是使用这个查询来实现它
query myTransactions{
description: "return all transactions made (not system transactions)"
statement: SELECT org.acme.sample.NAME_OF_TRANSACTION_CLASS
}
正确,这会起作用,因为它直接查询事务注册表(或注册表)。最终,您也应该能够通过 Historian Registry 进行查询——也就是说,交易的输入也应该完整地显示在 Historian 中。历史交易记录与(从 Txn 注册表)调用的交易有关系,以找出 'what the change to the asset (say) was' 即 la Playground。查询意味着将 'value' 作为 'the' 历史记录添加到 Historian - 例如"query the history of transactions (and what was it that changed) of type x for the period 1 to period 2"。关于 Historian 功能中的 REST 支持——我们计划也为 Historian 提供 REST 支持,并且正在筹备中(将在稍后发布时更新答案)。
我正在尝试构建一个允许我查看交易(及其原始输入)的 Historian 查询。我正在尝试基于这个问题 https://github.com/hyperledger/composer/issues/1850 的想法,但它已在 Composer Playground 中修复。所以现在我想知道如何在 REST API 中实现这一点而不依赖于事件来保存交易输入信息。
我根据查询文档使用的查询是:
query HistorianRecords {
description: "Select from HistorianRecords"
statement: SELECT org.hyperledger.composer.system.HistorianRecord
}
那个returns我这样的信息
{
"$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显示的交易输入信息
我想了解 Online Playground 如何显示它的信息,其中基本上包括交易输入,即。在您输入 asset 和 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"
}
我的网络涉及从参与者向参与者发送付款,无法看到谁向谁传递了多少基本上使区块链变得毫无意义。
如何使用查询来执行此操作?
所以实际上,我没有费心向 Historian 查询,而是使用这个查询来实现它
query myTransactions{
description: "return all transactions made (not system transactions)"
statement: SELECT org.acme.sample.NAME_OF_TRANSACTION_CLASS
}
正确,这会起作用,因为它直接查询事务注册表(或注册表)。最终,您也应该能够通过 Historian Registry 进行查询——也就是说,交易的输入也应该完整地显示在 Historian 中。历史交易记录与(从 Txn 注册表)调用的交易有关系,以找出 'what the change to the asset (say) was' 即 la Playground。查询意味着将 'value' 作为 'the' 历史记录添加到 Historian - 例如"query the history of transactions (and what was it that changed) of type x for the period 1 to period 2"。关于 Historian 功能中的 REST 支持——我们计划也为 Historian 提供 REST 支持,并且正在筹备中(将在稍后发布时更新答案)。