I have created one full node bitcoind
on my VPS, that one is serving application A.
Now I want to create application B that has another node but on same VPS.
is that possible to install multiple bitcoind
on one server using different wallet?
let's asume that I want application A connect to wallet.dat, application B to wallet_new.dat, with different bitcoin.conf configuration.
3 Answers
We can run 2 bitcoind nodes on a single server without installing it multiple times. We just have to create 2 data directory with a different configuration file (bitcoin.conf) for the 2 nodes. This configuration file should have different port numbers, user name and password specified.
Node1:
bitcoind -regtest -datadir=./bitcoinNode1/ -conf=./bitcoinNode1/bitcoin.conf -rpcport=19001 -port=19000
Node2:
bitcoind -regtest -datadir=./bitcoinNode2/ -conf=./bitcoinNode2/bitcoin.conf -rpcport=19011 -port=19010
You can also make the 2 nodes to connect each other by specifying the connect command while starting node2 as mentioned below.
bitcoind -regtest -datadir=./bitcoinNode2/ -conf=./bitcoinNode2/bitcoin.conf -rpcport=19011 -port=19010 -listen=0 -connect=127.0.0.1:19000
All you need to do is update the bitcoin.conf
for the second port to point to a different datadir, and use a different RPC port.
Do keep in mind that this will result in double the resource use for everything. Additionally, depending on your VPS, running multiple nodes on a single machine might not be feasible.
Usually, multiple applications should be able to use a single node, and differentiate addresses etc. at an application level.
-
how about wallet ? how to point that port a (e.g 8331) is for wallet a, and port b (e.g 8332) is for wallet b ? The point is I just want using different wallet for different app, in case something bad happed to one wallet doesn't affect another app .. Apr 4, 2018 at 8:31
-
1The wallet is controlled via the rpc, so simply changing the rpc port is enough. Changing the datadir ensures the second node will use a separate wallet file. Apr 4, 2018 at 8:37
Yes it's possible, you must run each bitcoind in different port and different datadir, take a look here https://en.bitcoin.it/wiki/Running_Bitcoin