在CORDA中添加多个公证人(Add multiple notaries in CORDA)

编程入门 行业动态 更新时间:2024-10-24 08:27:26
在CORDA中添加多个公证人(Add multiple notaries in CORDA)

我正在尝试创建一个包含4个节点和2个公证人的DLT,其中每个公证人负责与2个节点通信。

示例Gradle配置

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" networkMap "O=Controller,L=London,C=GB" node { name "O=Controller,L=London,C=GB" advertisedServices = ["corda.notary.validating"] p2pPort 10002 rpcPort 10003 cordapps = ["net.corda:corda-finance:$corda_release_version"] } node { name "O=ControllerNY,L=New York,C=US" advertisedServices = ["corda.notary.validating"] p2pPort 10004 rpcPort 10005 cordapps = ["net.corda:corda-finance:$corda_release_version"] } node { name "O=PartyA,L=London,C=GB" advertisedServices = [] p2pPort 10006 rpcPort 10007 webPort 10008 cordapps = ["net.corda:corda-finance:$corda_release_version"] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] } node { name "O=PartyB,L=London,C=GB" advertisedServices = [] p2pPort 10009 rpcPort 10010 webPort 10011 cordapps = ["net.corda:corda-finance:$corda_release_version"] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] } node { name "O=PartyC,L=New York,C=US" advertisedServices = [] p2pPort 10012 rpcPort 10013 webPort 10014 cordapps = ["net.corda:corda-finance:$corda_release_version"] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] } node { name "O=PartyD,L=New York,C=US" advertisedServices = [] p2pPort 10015 rpcPort 10016 webPort 10017 cordapps = ["net.corda:corda-finance:$corda_release_version"] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] }

}

如何将controller , controllerNY添加到网络,以便它选择它作为公证人而不是正常节点

I am trying to create a DLT with 4 nodes and 2 notaries where each notary is responsible for communicating with 2 nodes.

Sample Gradle config

task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" networkMap "O=Controller,L=London,C=GB" node { name "O=Controller,L=London,C=GB" advertisedServices = ["corda.notary.validating"] p2pPort 10002 rpcPort 10003 cordapps = ["net.corda:corda-finance:$corda_release_version"] } node { name "O=ControllerNY,L=New York,C=US" advertisedServices = ["corda.notary.validating"] p2pPort 10004 rpcPort 10005 cordapps = ["net.corda:corda-finance:$corda_release_version"] } node { name "O=PartyA,L=London,C=GB" advertisedServices = [] p2pPort 10006 rpcPort 10007 webPort 10008 cordapps = ["net.corda:corda-finance:$corda_release_version"] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] } node { name "O=PartyB,L=London,C=GB" advertisedServices = [] p2pPort 10009 rpcPort 10010 webPort 10011 cordapps = ["net.corda:corda-finance:$corda_release_version"] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] } node { name "O=PartyC,L=New York,C=US" advertisedServices = [] p2pPort 10012 rpcPort 10013 webPort 10014 cordapps = ["net.corda:corda-finance:$corda_release_version"] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] } node { name "O=PartyD,L=New York,C=US" advertisedServices = [] p2pPort 10015 rpcPort 10016 webPort 10017 cordapps = ["net.corda:corda-finance:$corda_release_version"] rpcUsers = [[ user: "user1", "password": "test", "permissions": []]] }

}

how can i add both controller, controllerNY to network so that it picks it as notary and not as a normal node

最满意答案

在这种情况下, Controller和ControllerNY都将作为公证人添加到您的网络中,因为他们都宣传公证服务。

然后,每个节点可以自由地使用公证的给定事务。 您可以使用以下内容在流程中选择公证人:

serviceHub.networkMapCache.getNotary(notaryToUse)

要么

serviceHub.networkMapCache.notaryIdentities.single { it.name.organisation == notaryToUse }

Both Controller and ControllerNY will be added to your network as notaries in this case, because they both advertise a notary service.

Each node is then free to use either notary for a given transaction. You pick your notary within the flow using something like:

serviceHub.networkMapCache.getNotary(notaryToUse)

Or

serviceHub.networkMapCache.notaryIdentities.single { it.name.organisation == notaryToUse }

更多推荐

本文发布于:2023-04-29 10:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336394.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:公证人   多个   CORDA   notaries   multiple

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!