how to differentiate bitcoin-cli command when have testnet & mainnet both running

0

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.

huahuayu

Posted 2018-11-12T08:22:40.180

Reputation: 11

1Does your bitcoin.conf file contain a line testnet=1 ?Pieter Wuille 2018-11-12T08:47:25.517

yes, for testnet testnet=1 is onhuahuayu 2018-11-14T14:13:16.183

So bitcoin-cli is combining the options from the command line and the config file, and sees both which are in conflict with eachother.Pieter Wuille 2018-11-14T17:31:57.160

Answers

1

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

Raghav Sood

Posted 2018-11-12T08:22:40.180

Reputation: 10 897