Corda nodes: how to connect two independent pc as two nodes?

后端 未结 2 1151
耶瑟儿~
耶瑟儿~ 2020-12-20 08:29

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

相关标签:
2条回答
  • 2020-12-20 09:14

    Each of the nodes will have a node.conf file. To enable devMode add this line to the node.conf file.

    devMode=true

    0 讨论(0)
  • 2020-12-20 09:15

    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:

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

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

    • 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")

    • 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

    • 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:

      • Machine 1: Notary, PartyA, 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

    Warning

    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.

    0 讨论(0)
提交回复
热议问题