Author

Topic: How to run testnet and bitcoind on same server (Read 2109 times)

legendary
Activity: 1512
Merit: 1036
September 14, 2014, 10:40:38 AM
#5
Bitcoin mainnet and testnet are unfortunately woven so they will access the same config file. The best way to keep track of what's running:

1. Make a separate copy of the program directory for testnet, and rename the bitcoind executable there to testnetd or such, so you will be able to monitor and identify which process is running.
2. Start both with an explicit and independent -datadir option so there is no chance of misconfiguration. I would put the start command line in a shell script for each so you don't have to remember it when you restart one. Also you can put arguments in a script so you don't have to type out the datadir for issuing RPC commands:
Code:
#!/bin/bash
/home/username/testnet/testnetd -datadir /home/username/testnetdata -testnet $1 $2 $3 $4 $5

full member
Activity: 178
Merit: 100
September 12, 2014, 03:38:04 PM
#4
Thanks for the great feedback.

One question regarding

Quote
2) the arguments processing is somewhat convoluted and the "testnet" daemon will look into "mainnet" .conf file, therefore it is better to have single such file and set the "testnet" (and others that you want to differ) through the command line. You can leave "port" and "rpcport" at the defaults.

You are talking about setting either testnet or bitcoin ports at something other than default right? And not about how I would start the two servers correct? So I would just install bitcoin core, add "testnet=1" to the bitcoin.conf file and then, when I start bitcoind from the command line both are running? I didn't notice that behavior before? After I first installed and ran testnet it looked like it only downloaded the blockchain for the testnet. So It was also downloading the regular blockchain in the background and I couldn't see it?
staff
Activity: 4284
Merit: 8808
September 07, 2014, 08:42:59 PM
#3
So if you are e.g. running sshd on the default port on the same IP address prepare to have serious CPU load from failed ssh login attempts.
Off-topic, I know, but a useful tip: Switch to ssh key auth only, the brute forcing tools detect that its hopeless and give up.
legendary
Activity: 2128
Merit: 1073
September 06, 2014, 08:36:58 PM
#2
So in order to run both bitcoind and testnet at the same time do I make two bitcoin.conf files and place one in the .bitcoin directory and one in testnet3 directory with different port settings?
It works just fine (and for more than one coin) provided:

1) don't change the coin's default P2P port, you'll get de-prioritized and will get less connections
2) the arguments processing is somewhat convoluted and the "testnet" daemon will look into "mainnet" .conf file, therefore it is better to have single such file and set the "testnet" (and others that you want to differ) through the command line. You can leave "port" and "rpcport" at the defaults.

I've been running 4 coin daemons on a single computer with a single hard-linked *.conf file for many years now.

Edit: I forgot about one thing:

3) it seems like some hackers monitor coins P2P networks for IP addresses running multiple daemons and do extremely aggressive scans for hackable services on those addresses. Maybe they think that they discovered a coin exchange or some such high-value target? Don't know the real reason, but observed this effect multiple times. So if you are e.g. running sshd on the default port on the same IP address prepare to have serious CPU load from failed ssh login attempts.
full member
Activity: 178
Merit: 100
September 06, 2014, 06:16:24 PM
#1
Hi all,

If understand correctly, bitcoind and testnet can be run on the same server at the same time provided they are configured to use different ports. I know bitcoind uses 8332 and 8333 while testnet is usually set to 18332 and 18333. I understand that the ports that are to be used can be configured in the bitcoin.conf file. So in order to run both bitcoind and testnet at the same time do I make two bitcoin.conf files and place one in the .bitcoin directory and one in testnet3 directory with different port settings?

Basically I'm running these on two separate VPS and would like to combine them to save costs.

Thanks
Jump to: