I have bitcoin testnet3, mainnet, regtest both running in the same server, I can interactive with them by curl, because the ports are different, but when comes to bitcoin-cli how can I specific the network I want interactive with?

I get below error:

$ bitcoin-cli -regtest setgenerate true 101  # I want use regtest
Error: Invalid combination of -regtest and -testnet.
  • 1
    Does your bitcoin.conf file contain a line testnet=1 ? Nov 12, 2018 at 8:47
  • yes, for testnet testnet=1 is on
    – Shiming
    Nov 14, 2018 at 14:13
  • So bitcoin-cli is combining the options from the command line and the config file, and sees both which are in conflict with eachother. Nov 14, 2018 at 17:31

1 Answer 1


You can pass the -rpcport flag to bitcoin-cli to specify which node to connect to when running multiple on the same machine.

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.