如何在Corda中仅存储特定于节点的分类帐自定义数据? [英] How to store only node specific off-ledger custom data in corda?

查看:62
本文介绍了如何在Corda中仅存储特定于节点的分类帐自定义数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用QueryableState在Corda中创建了自定义表。例如IOUStates表。
我可以看到自定义信息存储在这种表中。
,但我观察到,如果甲方和乙方进行交易,则
的自定义信息会存储在两个地方,例如IOUStates的
表是在nodeA分类帐以及nodeB的分类帐中创建的。
和自定义信息存储在甲方和乙方的分类帐中。

I created custom table in corda using QueryableState. e.g. IOUStates table. I can able to see the custom information getting stored in this kind of table. but i observed that if party A and Party B is doing the transaction then this custom information gets stored at both the places , e.g. IOUStates table getting created at nodeA ledger as well as nodeB's ledger. and custom information is stored in partyA's and PartyB's ledger.

我的问题是:-

如果正在从PartyA的节点处理某些交易,则
我只想存储交易的部分数据,即自定义数据仅在partyA的Ledger。* 级别。

If some Transaction is getting processed from PartyA's node , then I want to store part of the transaction's data i.e. custom data ONLY at partyA's Ledger.* level . i.e. off-Ledger of partA only.

不应与甲方B共享。

在简单情况下,如何存储仅特定于节点的分类账自定义数据?

In simple case , how to store Only node specific off ledger custom data ?

等待一些答复...

谢谢。

推荐答案

有多种方法可以实现:


  1. 根本不使用Corda!如果数据确实不在账本,那么为什么要使用Corda?而是将其存储在单独的数据库中。当然,如果需要,您可以将其与账本上的数据联接,因为账本上的数据存储在SQL数据库中。

  2. 类似地指向一个,但可以使用< ServiceHub 的code> jdbcSession()功能在节点数据库中创建自定义表。可以轻松地从您的流程中访问此表。

  3. 创建一个只有一个参与者的 ContractState 对象:想要存储数据。我称这种状态为单边状态,即只有一个方存储的状态。

  1. Don't use Corda at all! If the data is truly off-ledger then why are you using Corda? Instead, store it in a separate database. Of course you can "JOIN" it with on-ledger data if required, as the on-ledger data is stored in a SQL database.
  2. Similar to point one except you can use the jdbcSession() functionality of the ServiceHub to create a custom table in the node's database. This table can easily be accessed from within your flows.
  3. Create a ContractState object that only has one participant: the node that wants to store the data. I call this a "unilateral" state, i.e. a state that only one party ever stores.

最重要的是,如果您不这样做想要与对方共享一些数据,则永远不要在另一方可能看到的Corda状态对象或附件中披露这些数据。相反:

Most importantly, if you don't want to share some data with a counter-party then it should never be disclosed inside a corda state object or attachment that another party might see. Instead:


  • 在流中,您可以使用封装在共享状态对象(例如IOU)中的数据来导出私有数据

  • 或者,如果在流开始时提供了数据,则使用上述方法之一在本地存储私有数据

这篇关于如何在Corda中仅存储特定于节点的分类帐自定义数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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