4

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]
datadir=/mnt/volume-nyc1-03/Bitcoin
dbcache=2000
txindex=1

# [rpc]
# Accept command line and JSON-RPC commands.
server=1
# Username for JSON-RPC connections
rpcuser=bitcoin
# Password for JSON-RPC connections
rpcpassword=sayblockchainonemoretime
rpcport=8332
rpcallowip=x.x.x.x/x (ip masked) 
# [wallet]
# Do not load the wallet and disable wallet RPC calls.
disablewallet=0
Sonic Soul
  • 171
  • 3
  • 9

2 Answers2

10

You can run both at the same time:

$ bitcoind -daemon
$ bitcoind -testnet -daemon

Then you can issue commands on either using:

$ bitcoin-cli <commmand>

or

$ 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:

main.uacomment=bitcoin
test.uacomment=bitcoin-testnet
regtest.uacomment=regtest

For more information, see the 0.17.0 Release Notes

JBaczuk
  • 7,388
  • 1
  • 13
  • 34
0

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

Haddar Macdasi
  • 978
  • 2
  • 14
  • 22