it took me 4 days to fully synchronize my node, but its finally running and i can create wallets etc..

I wanted to experiment with some transactions on testnet, so need to either change my config or create a separate instance.

But I don't want to lose my synchronized live node, so what's the best strategy to switch to testnet while still being able to switch back?

# [core]

# [rpc]
# Accept command line and JSON-RPC commands.
# Username for JSON-RPC connections
# Password for JSON-RPC connections
rpcallowip=x.x.x.x/x (ip masked) 
# [wallet]
# Do not load the wallet and disable wallet RPC calls.

2 Answers 2


You can run both at the same time:

$ bitcoind -daemon
$ bitcoind -testnet -daemon

Then you can issue commands on either using:

$ bitcoin-cli <commmand>


$ bitcoin-cli -testnet <command>

The blockchains are stored in ./bitcoin/blocks for mainnet and /bitcoin/testnet3/blocks for testnet.

Update: With the bitcoin.conf updated in the question remove rpcport=8332, so it doesn't try to use the same port for mainnet and testnet RPC.

Update 2: With 0.17 release, it is now possible for a single configuration file to set different options for different networks in bitcoin.conf:


For more information, see the 0.17.0 Release Notes

  • $ bitcoin-cli getblockcount: 538439
    – Sonic Soul
    Commented Aug 25, 2018 at 21:02
  • $ bitcoin-cli -testnet getblockcount: 538439
    – Sonic Soul
    Commented Aug 25, 2018 at 21:03
  • looks like its going against main
    – Sonic Soul
    Commented Aug 25, 2018 at 21:03
  • hmm i do see the testnet3 folder under bitcoin now ..
    – Sonic Soul
    Commented Aug 25, 2018 at 21:13
  • 1
    Clear that line. If you only put the flag in the command line you can run both.
    – JBaczuk
    Commented Aug 26, 2018 at 15:26

Run bitcoin.exe with conf and datadir params And set the configuration file with testnet=1

  • i saw the config and am aware of these settings. but not sure how to ensure that my live blockchain stays untouched
    – Sonic Soul
    Commented Aug 25, 2018 at 14:19
  • By default the two networks will operate in different directories. Commented Aug 25, 2018 at 16:58

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.