In Corda, how can nodes be assigned public roles?

空扰寡人 提交于 2019-12-06 09:37:13

问题


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?


回答1:


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:

  • 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


来源:https://stackoverflow.com/questions/50139648/in-corda-how-can-nodes-be-assigned-public-roles

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!