【问题标题】:Can we restrict an account in Corda to accept only one specific state?我们可以限制 Corda 中的帐户只接受一个特定的状态吗?
【发布时间】:2021-01-26 00:27:37
【问题描述】:

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

【问题讨论】:

    标签: blockchain corda


    【解决方案1】:

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

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

    例子:

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

    【讨论】:

      猜你喜欢
      • 2015-02-27
      • 2019-04-17
      • 1970-01-01
      • 1970-01-01
      • 2017-12-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多