how to run datadir in multichain

+4 votes
can anybody give one example command for using datadir to have two nodes in a single machine
asked Sep 29, 2016 by userven

1 Answer

+8 votes
 
Best answer

This assumes you are in your home directory - if not, type cd ~ before starting.

First create the chain in the default directory  (~/.multichain/) in the normal way:

multichain-util create chaintest

multichaind chaintest -daemon

For this example let's say the node address output was chaintest@12.34.56.78:9255

Now create the second node as follows, using a different datadir, port and rpcport:

mkdir .multichain-other

multichaind -datadir=.multichain-other -port=10255 -rpcport=10254 chaintest@12.34.56.78:9255

You will see the usual message about needing connect permissions, so assign these via the regular node:

multichain-cli chaintest grant [address-shown] connect

Now you can start up the second node again:

multichaind -datadir=.multichain-other -port=10255 -rpcport=10254 chaintest -daemon

You can send commands to the second node as follows:

multichain-cli -datadir=.multichain-other -rpcport=10254 chaintest

To make shorter command lines in future you can add the following lines to the configuration file .multichain-other/chaintest/multichain.conf for the second chain:

port=10255

rpcport=10254

Then in future you can just start up this chain using:

multichaind -datadir=.multichain-other chaintest -daemon

And access its command line using:

multichain-cli -datadir=.multichain-other chaintest

answered Oct 2, 2016 by MultiChain
edited Dec 15, 2016 by MultiChain
Yes, you can run MultiChain with parameters -port=X -rpcport=Y – see this page for more information on runtime parameters: https://www.multichain.com/developers/runtime-parameters/
That's what I've been doing so far. My question was referring to adding the -port and -rcpport numbers in the .multichain-other/chaintest/multichain.conf file. I'm unable to add/change anything in the file because I do not have permissions to edit it. I wanted to know if there was another way to add the port and rpcport numbers to the file so I can reduce the length of the command line when starting up a node.
I have setup similar to this.
But if i login to the cli of node 2 and try to check the address,
I still see only the addresses of the 1st node.

Also even when i try to publish to a stream in the 1nd node cli still i see the strem publisher as Node 1 address.

Please let me know if anyone has come across the same issue and found some way.!!

Happy Multichaining :)
When I try this, I never get the usual message about needing connect permissions on the second node. Running multichain-cli -datadir=.multichain-other -rpcport=10254 chaintest1 gives me a "no credentials" error and recommends I add them to .multichain-other/chaintest1/multichain.conf, which does contain some credentials (but not the same as .multichain/chaintest1/multichain.conf.

MultiChain 2.0 beta 1 on Ubuntu 18.10.

Update: And the reason would be: anyone-can-connect = true
...