更新时间:2023-02-01 22:46:25
在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
文件,并将其p2pAddress
的localhost
部分更改为将运行该节点的计算机的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密钥).重要的是,所有节点(包括公证人)都不得出现在多台计算机上.每台计算机还应具有runnodes
和runnodes.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:公证人,甲方,runnodes
,runnodes.bat
机器2:PartyB,PartyC,runnodes
,runnodes.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.