Corda如何支持亲子关系 [英] How does Corda support parent-child relationship

查看:54
本文介绍了Corda如何支持亲子关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Corda如何支持州与州之间的父子关系(即,一个父州到多个服务于不同目的的子州)一对多关系.目前,我只是通过将父状态的参考数字(线性id)添加到每个子状态中来做到这一点.

How does Corda support parent-child relationship between states ( i.e. one parent state to many child states that serve different purposes ) One-To-Many Relationship. Currently I am only doing it by adding the reference number ( linear id ) of the parent state into each child states.

详细说明:

父状态包含每个子状态共享的公共信息,而子状态包含仅与自身相关的信息.每个孩子都会独立地进化或过渡到不同的生命周期,除非对父级状态采取任何措施(即取消,提前到期),则它将级联到与父级链接的所有子级状态.同样,如果所有孩子的状态都已发展到生命周期的尽头,即SETTLED,则父母双方也必须能够整理并过渡到SETTLED.

The parent states consist of common information shared by each child states, While the child states would consist of information that is only relevant to itself. Each child would evolve or transition to different lifecycles independently, unless if an action is taken upon the parent state, i.e cancellation, early expiration, it would cascade to all the children states linked to the parent. Likewise, if all children states have evolved to their end of lifecycle i.e SETTLED, the parent must be able to collate and transition itself to SETTLED as well.

一个示例场景是,买方将与卖方签发购买合同,该合同也由不同的项目组成.因此,在一份购买合同中,可能会有不同的产品,并且每种产品都将被运送到不同的位置.但是,一旦所有物品都已寄出并入账(已结算),则购买合同才已结算.

An example scenario would be a buyer who would issue a purchase contract with a seller, which also consists of different items. So in one purchase contract, there may be different products, and each to be shipped to different locations. But once all items have been shipped and accounted for (SETTLED), the purchase contract is only then SETTLED.

推荐答案

只需通过其 linearId 引用父状态中的子状态,反之亦然.

Just reference the child states in the parent state by their linearId, or vice-versa.

然后您可以在合同中强加规则-例如,您可以要求将购买合同标记为结算的交易还将所有商品从卖方转移到买方.

You can then impose rules in the contract - for example, you can require that a transaction marking a purchase contract as Settled is also transferring all the items from the seller to the buyer.

让我知道用例是否演变而该模型不再适用.

Let me know if the use-case evolves and this model is no longer appropriate.

这篇关于Corda如何支持亲子关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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