Corda – 避免发行重复状态

huangapple go评论139阅读模式
英文:

Corda - Avoid issuing duplicated states

问题

我对 Corda 还不太了解,所以可能有些遗漏。避免参与方(或不同参与方)发布重复状态的最佳方法是什么?例如,我想阻止使用之前已发布的具有相同卖方、买方、日期和金额的 IOU。

英文:

I am pretty new to Corda, so I might have missed something.
What would be the best way to avoid a party(or different parties) issuing duplicated states?
For example, I want to block issuing an IOU with a seller, buyer,
date and value that was previously issued.

答案1

得分: 1

  • 在 Corda 中,交易状态是根据需要分布的;这意味着如果一方是状态的 "参与方",它将在其存储库中存储该状态。
  • 考虑到这一点,你只能确保某个特定状态在 "发行方" 层面上不会重复。
  • 所以假设在你的 IOU 中总是 "借款人" 发行新的 IOU;因此,你的流程(由 "借款人" 发起)应首先查询 "借款人" 的存储库,查看是否有匹配的 IOU,并在存在时引发异常,否则发行新的 IOU。
  • 因此,如果你有一个 "借款人 = PartyA" 且 "借款人 = PartyB" 的 IOU;PartyC 无法知道提到的 IOU 的存在(因为它不是该状态的 "参与方")。
  • 这并不是一个问题,因为你应该以这样的方式编写流程,使流程的发起者成为 IOU 的 "借款人";这样你就可以确保事情被限制在控制之下。
  • 每个 "借款人" 在发行类似 IOU 之前都会检查他们的存储库。
英文:
  • In Corda, states are distributed on a need to know basis; meaning if a party is a participant in the state, it will store that state in its vault.
  • With that in mind, you can only insure that a certain state is not duplicated on an "issuer" level.
  • So let's say in your IOU it's always the lender that issues new IOUs; so your flow (which is initiated by the lender) should first query the vault of the lender to see if there is a matching IOU and throw an exception if it does, otherwise issue the new IOU.
  • So if you had an IOU with lender = PartyA and borrower = PartyB; there's no way for PartyC to know that the mentioned IOU exists (because it's not a participant in that state).
  • Which isn't a problem, because you should write your flow in a way that the initiator of the flow becomes the lender of the IOU; and this way you have things locked down.
  • Every lender checks their vault before issuing an IOU for similar ones.

huangapple
  • 本文由 发表于 2020年10月27日 17:39:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/64551672.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定