问题
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