Bitcoin and Bitcoind will send an error if it is launched multiple times. I'm assuming this is because they share the same database and wallet.

Is it possible to run two instances of Bitcoin QT / bitcoind with one listening on Production and the other on Test? (on the same computer)

Is this advisable or not advisable?

3 Answers 3


You can run a mainnet and testnet bitcoind next to eachother without problems. They do not share the same database (one will use the testnet3/ subdirectory).

What will conflict is the RPC port, as they will both try to bind to port 8332 for receiving RPC connections. Use -rpcport=N on one of them to use a different port.

  • Thanks! My goal is to help out with testnet replication. Will running on an alternate port cause issues with other clients discovering me? Dec 9, 2012 at 2:32
  • 1
    Communication with other nodes is done using the P2P port, which is 8333 for mainnet and 18333 for testnet by default. The RPC port is only used for locally sending commands to bitcoind. Dec 9, 2012 at 14:34
  • I just launched testnet on the same computer as production. I saw that the following directory is being used: Default data directory C:\Users\Administrator\AppData\Roaming\Bitcoin Specifically will debug.log, peers.dat, or wallet.dat be altered? Will bitcoin.conf be read? It appears that after running testnet, my debug.log was truncated. ( I did have a large debug log running in production) Dec 9, 2012 at 14:50

As of Bitcoin Core 0.7.1 (19 October 2012), you can run both mainnet and testnet by simply starting Bitcoin Core with the appropriate flags:

bitcoind -daemon           # mainnet, -daemon will cause it to fork into the background
bitcoind -daemon -testnet  # testnet

As of Bitcoin Core 0.9.0 (19 March 2014), you can easily use bitcoin-cli to send commands to both nodes:

bitcoin-cli getinfo           # mainnet, uses port  8332 for RPC-JSON
bitcoin-cli -testnet getinfo  # testnet, uses port 18332 for RPC-JSON

Also as of Bitcoin Core 0.9.0, there is a regression test mode ("regtest") that can speed up development and testing of apps by nearly instantly generating an alternative block chain with super-low difficulty.

By default, regtest mode runs on the same ports as testnet (18333 for Bitcoin P2P, 18332 for RPC-JSON/HTTP REST), although it does use a different data directory from testnet. That means the two commands below will both address a default testnet or regtest node:

bitcoin-cli -testnet getinfo  ## sends command to port 18332
bitcoin-cli -regtest getinfo  ## also sends command to port 18332

This answer has some basic sample code showing running two regtest nodes on the same machine, but you can also do something similar if you want to run a testnet node and regtest node at the same time.

Post script: Pieter Wuille's accepted answer confuses me. It says he wrote it on 9 December 2012, but this merge by Pieter says he added code (written by @kjj2) changing the testnet port to 18332 on 28 September 2012---over two months earlier. Also, that code was included in Bitcoin Core 0.7.1 released in October 2012, still almost two months earlier than Pieter's answer.

Shrug. I guess maybe he just forgot about the change.


Maybe you should try using different directories through the datadir argument. That way the production data and test net data would be stored in different folders.

REF: https://bitcointalk.org/index.php?topic=771930.0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.