[英]Can we restrict an account in Corda to accept only one specific state?
In My Corda project, I want to create a special account which can have only one specific type of state and do not accept if any other state is shared with it.在我的 Corda 项目中,我想创建一个特殊帐户,该帐户只能具有一种特定类型的 state,并且如果与它共享任何其他 state,则不接受。 While other accounts on the same node can accept other states too.
而同一节点上的其他帐户也可以接受其他状态。 Is that possible in Corda.
在 Corda 有可能吗? If yes, then How?
如果是,那么如何?
you could do this a bunch of different ways.你可以用很多不同的方式来做到这一点。
Maybe the easiest way would be in the flow?也许最简单的方法是在流程中? You just want to create a rule that ensures only a certain account can run or have a flow run involving it.
您只想创建一个规则,以确保只有某个帐户可以运行或让流程运行涉及它。
Example:例子:
// Create account by using sub flow (from inside a flow).
val accountInfo: StateAndRef<AccountInfo> = subFlow(CreateAccount("Roger's account"))
// Then look up the account by account ID and name.
accountService.accountInfo(accountInfo.state.data.name)
accountService.accountInfo(accountInfo.state.data.identifier.id)
Take a look at this link for the source docs.查看源文档的此链接。 Good luck!
祝你好运!
https://github.com/corda/accounts/blob/master/docs.md https://github.com/corda/accounts/blob/master/docs.md
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.