Corda节点:如何将两个独立的PC连接为两个节点? [英] Corda nodes: how to connect two independent pc as two nodes?

查看:181
本文介绍了Corda节点:如何将两个独立的PC连接为两个节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的一个朋友和我正在尝试为财务用例开发CorDapp,我可以运行cordapp-tutorial和演示,但是它们只能在localhost上运行. 我们想创建两个真实"节点,并且我理解正确,我们应该构建两个Corda节点,我的PC作为一个节点服务器,而他的PC作为另一个节点服务器,但是如何才能有效地通过Internet连接?在闲置状态下,我被告知启用开发模式,但是如何启用呢?

One friend of mine and I are trying to develop a CorDapp for a financial use case, I can run the cordapp-tutorial and the demos, however they only run on localhost. We would like to create two "real" nodes and I understood correctly we should build two Corda nodes, my pc as one node server and his pc as another node server, but how can we effectively connect over the internet? On slack I have been told to enable dev-mode, but how do you enable it?

我们有一个corda.jar和nodea.conf,但是我从文档中真正不了解的部分是:

We have a corda.jar and the nodea.conf, but the part I don't really understand from the documentation is:

默认情况下,每个节点服务器在当前工作目录中都必须具有一个node.conf文件.在首次执行该节点服务器之后,将在此工作空间目录中创建许多其他配置和持久性文件. --base-directory =命令行参数."

"Each node server by default must have a node.conf file in the current working directory. After first execution of the node server there will be many other configuration and persistence files created in this workspace directory. The directory can be overridden by the --base-directory= command line argument."

什么是工作目录?

我已阅读此文档 : Corda节点

谢谢大家,我想我会在不久的将来提出很多问题:D

Thank to all, I think I will be asking a lot of question in the near future :D

推荐答案

在Corda 3.1中,您可以使用网络引导程序来创建由运行在两台不同计算机上的节点组成的dev-mode网络,如下所示:

In Corda 3.1, you can use the network bootstrapper to create a dev-mode network of nodes running on two separate machines as follows:

  • 按照此处的说明创建节点(例如通过使用gradlew deployNodes)

  • Create the nodes by following the instructions here (e.g. by using gradlew deployNodes)

导航到创建节点的文件夹(例如build/nodes)

Navigate to the folder where the nodes were created (e.g. build/nodes)

打开每个节点的node.conf文件,并将其p2pAddresslocalhost部分更改为将运行该节点的计算机的IP地址(例如p2pAddress="10.18.0.166:10007")

Open the node.conf file of each node and change the localhost part of its p2pAddress to the IP address of the machine where the node will be run (e.g. p2pAddress="10.18.0.166:10007")

进行了这些更改之后,我们需要将更新的nodeInfo文件重新分发到每个节点,以便它们具有每个节点的更新的IP地址.使用网络引导程序工具来自动更新文件并将其分发到每个节点:

After making these changes, we need to redistribute the updated nodeInfo files to each node, so that they have the updated IP addresses for each node. Use the network bootstrapper tool to automatically update the files and have them distributed to each node:

java -jar network-bootstrapper.jar kotlin-source/build/nodes

将节点文件夹移动到其各自的计算机上(例如,使用USB密钥).重要的是,所有节点(包括公证人)都不得出现在多台计算机上.每台计算机还应具有runnodesrunnodes.bat的副本.

Move the node folders to their individual machines (e.g. using a USB key). It is important that none of the nodes - including the notary - end up on more than one machine. Each computer should also have a copy of runnodes and runnodes.bat.

例如,您可能会得到以下布局:

For example, you may end up with the following layout:

  • 机器1:公证人,甲方,runnodesrunnodes.bat

机器2:PartyB,PartyC,runnodesrunnodes.bat

Machine 2: PartyB, PartyC, runnodes, runnodes.bat

在启动每个节点之后,这些节点将能够彼此看到并同意彼此之间的分类帐更新

After starting each node, the nodes will be able to see one another and agree ledger updates among themselves

警告

必须在修改node.conf文件后之后运行引导程序,但是之前节点必须在计算机之间分布.否则,节点将没有每个节点的更新IP地址,并且将无法通信.

The bootstrapper must be run after the node.conf files have been modified, but before the nodes are distributed across machines. Otherwise, the nodes will not have the updated IP addresses for each node and will not be able to communicate.

这篇关于Corda节点:如何将两个独立的PC连接为两个节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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