繁体   English   中英

我们可以限制 Corda 中的帐户只接受一个特定的 state 吗?

[英]Can we restrict an account in Corda to accept only one specific state?

在我的 Corda 项目中,我想创建一个特殊帐户,该帐户只能具有一种特定类型的 state,并且如果与它共享任何其他 state,则不接受。 而同一节点上的其他帐户也可以接受其他状态。 在 Corda 有可能吗? 如果是,那么如何?

你可以用很多不同的方式来做到这一点。

也许最简单的方法是在流程中? 您只想创建一个规则,以确保只有某个帐户可以运行或让流程运行涉及它。

例子:

// 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)

查看源文档的此链接。 祝你好运!

https://github.com/corda/accounts/blob/master/docs.md

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM