Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: madmadmax on April 16, 2013, 01:04:25 PM



Title: How to run 2 bitcoin-qts?
Post by: madmadmax on April 16, 2013, 01:04:25 PM
How can I run two separate bitcoin servers that accept json-rcp commands on a single machine?


Title: Re: How to run 2 bitcoin-qts?
Post by: DarkHyudrA on April 16, 2013, 01:11:52 PM
A VM inside the machine :P
Srsly, Idk, but at least having a VM would work...

And I'm wondering: y u want 2 clients open?


Title: Re: How to run 2 bitcoin-qts?
Post by: grue on April 16, 2013, 02:09:25 PM
set bitcoin.conf so they use different data directories, and listen on different ports.


Title: Re: How to run 2 bitcoin-qts?
Post by: kjj on April 16, 2013, 03:13:26 PM
A VM inside the machine :P
Srsly, Idk, but at least having a VM would work...

And I'm wondering: y u want 2 clients open?

I run two nodes on one machine.  One node is a hub and accepts a ton of incoming connections from around the world.  The other node is only connected to that hub, and has a wallet.

I mostly did it because I have a cron job that detaches the wallet node and copies the block files out for distribution to my RAMdisk mining nodes, to speed their reboots.  I wanted to keep a well connected node running, despite shutting down the client every day, so I've been running two for quite a while now.  Turns out that there are nice privacy and security benefits from running them split like this too.

And grue has it exactly right, as usual.  You need two sets of data directories, two configuration files, and two sets of 2 ports.  You can even talk to both nodes using the bitcoind command line by specifying -conf= along with your commands.


Title: Re: How to run 2 bitcoin-qts?
Post by: madmadmax on April 16, 2013, 06:28:14 PM
A VM inside the machine :P
Srsly, Idk, but at least having a VM would work...

And I'm wondering: y u want 2 clients open?

Heard you like VM's so we put a VM in your VM so you can VM while you VM.

Seriously though, could I perhaps run two bitcoin "headless" daemons? If so is there any guide? Maybe we could use a different wallet and listen on different ports while using the same blockchain?


Title: Re: How to run 2 bitcoin-qts?
Post by: deadweasel on April 16, 2013, 06:29:50 PM
A VM inside the machine :P
Srsly, Idk, but at least having a VM would work...

And I'm wondering: y u want 2 clients open?

Heard you like VM's so we put a VM in your VM so you can VM while you VM.

Seriously though, could I perhaps run two bitcoin "headless" daemons? If so is there any guide? Maybe we could use a different wallet and listen on different ports while using the same blockchain?

you can do it in unix by running one under a different user and specifying the -datadir.

edit: oops, answered by kjj:
And grue has it exactly right, as usual.  You need two sets of data directories, two configuration files, and two sets of 2 ports.  You can even talk to both nodes using the bitcoind command line by specifying -conf= along with your commands.


Title: Re: How to run 2 bitcoin-qts?
Post by: Dabs on April 16, 2013, 10:26:44 PM
Every node that runs is another copy of the block chain. (or make some sort of symbolic links maybe.)


Title: Re: How to run 2 bitcoin-qts?
Post by: kjj on April 17, 2013, 12:17:00 AM
Every node that runs has different block files.  If you really need to save space, there are ways to partially synchronize them, at least with the old BDB index.  I haven't played with 0.8+ enough to know if the same trick would work there or not.


Title: Re: How to run 2 bitcoin-qts?
Post by: madmadmax on April 17, 2013, 06:16:17 AM
Is there any step by step guide on how to configure more than one bitcoin server that  accepts bitcoin-rpc commands?


Title: Re: How to run 2 bitcoin-qts?
Post by: grue on April 17, 2013, 04:36:03 PM
Is there any step by step guide on how to configure more than one bitcoin server that  accepts bitcoin-rpc commands?
windows:

1. go to %appdata% (or wherever it's located for your OS)
2. make a copy of bitcoin folder, and rename it something like "bitcoin2"
3. put this in bitcoin.conf (create if it doesn't exist).
%appdata%\bitcoin:
Code:
rpcuser=user1
rpcpassword=mypassword1

%appdata%\bitcoin2
Code:
rpcuser=user2
rpcpassword=mypassword2
port=8335
rpcport=8334
4. open the folder where bitcoind.exe is installed, shift-right click the folder, "open command window here"
5. start bitcoind.exe
6. bitcoind.exe -datadir=%appdata%\bitcoin2

congratulations. now you have 2 servers running. rpc port for server 1 is 8332, server 2 is 8334


Title: Re: How to run 2 bitcoin-qts?
Post by: madmadmax on April 17, 2013, 05:34:23 PM
Is there any step by step guide on how to configure more than one bitcoin server that  accepts bitcoin-rpc commands?
windows:

1. go to %appdata% (or wherever it's located for your OS)
2. make a copy of bitcoin folder, and rename it something like "bitcoin2"
3. put this in bitcoin.conf (create if it doesn't exist).
%appdata%\bitcoin:
Code:
rpcuser=user1
rpcpassword=mypassword1

%appdata%\bitcoin2
Code:
rpcuser=user2
rpcpassword=mypassword2
port=8335
rpcport=8334
4. open the folder where bitcoind.exe is installed, shift-right click the folder, "open command window here"
5. start bitcoind.exe
6. bitcoind.exe -datadir=%appdata%\bitcoin2

congratulations. now you have 2 servers running. rpc port for server 1 is 8332, server 2 is 8334

Thanks, incredibly detailed and you all were very patient.