如何创建自定义广告服务

How to create a custom advertisedServices

我正在查看 Corda Demobench,我想知道如何在 Cordapps 中创建自定义广告服务

Demobench 为节点提供了很多服务,例如:

corda.notary.simple --> (simple notary)  
corda.notary.validating --> (validating notary)  
corda.intrest_rates --> (oracle service)  
corda.issuer.CURRENCY  
corda.cash

我认为后两项服务是自定义服务,使节点能够提供特殊服务,如发行现金和使用现金。

如有错误请指正!

节点可以通过在 extraAdvertisedServiceIds 下的节点配置文件中列出服务来宣传服务 - 请参阅 https://docs.corda.net/corda-configuration-file.html. You can also list the name of the service you wish to offer in the deployNodes task - see https://github.com/corda/corda/blob/release-V2/samples/irs-demo/build.gradle#L56

但是,Corda 正在远离根据节点提供的服务查找节点。在 V2 中,没有根据节点提供的服务检索节点的方法。在 V3 中,服务的概念将被完全删除。

如果您查看 Oracle 示例 here,您会发现我们是按名称查找 oracle,而不是基于它们提供特定服务这一事实。