问题
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?
We have a corda.jar and the nodea.conf, but the part I don't really understand from the documentation is:
"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."
What is intended as working directory?
I've read this documentation : Corda Nodes
Thank to all, I think I will be asking a lot of question in the near future :D
回答1:
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 thelocalhost
part of itsp2pAddress
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
andrunnodes.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.
回答2:
Each of the nodes will have a node.conf file. To enable devMode add this line to the node.conf file.
devMode=true
来源:https://stackoverflow.com/questions/45241773/corda-nodes-how-to-connect-two-independent-pc-as-two-nodes