在Corda中,如何为节点分配公共角色? [英] In Corda, how can nodes be assigned public roles?

查看:59
本文介绍了在Corda中,如何为节点分配公共角色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个CorDapp,我想根据其角色来区别交易对手节点。

I have written a CorDapp where I want to treat counterparty nodes differently based on their "role".

例如,我可能想检查交易对手节点在要求向他们发行现金之前,先担任现金发行人角色。

For example, I may want to check that a counterparty node has the "cash issuer" role before requesting cash issuance from them.

以这种方式定义公共节点角色的最佳方法是什么?

What's the best way to define public node roles in this way?

推荐答案

从Corda 3开始,该功能没有内置支持。

As of Corda 3, there isn't built-in support for this feature. Support is expected to be added in a future release.

同时,有几种解决方法:

In the meantime, there are several workarounds:


  • 使用一个oracle,就像Kid101在上面提到的那样。 oracle将存储可由节点查询的角色信息

  • 可以通过流中的HTTP调用来检索角色-请参见流HTTP示例

  • 角色可以存储在节点的数据库中并在流中进行检索-请参见< a href = https://github.com/corda/flow-db rel = nofollow noreferrer>流数据库示例

  • 每个节点可以有一个流对返回节点的角色

  • 可以将角色硬编码在每个节点上安装的配置文件中-请参见如何在Corda中为CorDapp提供自定义配置?

  • 可以对角色进行硬编码在CorDapp的流程中

  • Using an oracle, as Kid101 mentions above. The oracle would store role information that could be queried by nodes
  • The roles could be retrieved via a HTTP call within the flow - see the Flow HTTP sample
  • The roles could be stored in the node's database and retrieved within the flow - see the Flow DB sample
  • Each node could have a flow pair that returns the node's role
  • The roles could be hardcoded in a configuration file installed on each node - see How to provide a CorDapp with custom config in Corda?
  • The roles could be hardcoded in the CorDapp's flows

这篇关于在Corda中,如何为节点分配公共角色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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