bitcoin-cli "error: couldn't connect to server"

2

I'm trying to connect to a Bitcoin Core on Windows 10. I start it with this command:

.\bitcoin-qt.exe --server --rest --rpcport=54352 --rpcuser=admin --rpcpassword=admin123

Using netstat -an I see that it indeed is listening on requested port

TCP    127.0.0.1:54352        0.0.0.0:0              LISTENING

However, trying to connect with bitcoin-cli using this command:

.\bitcoin-cli.exe getinfo --rpcport=54352 --rpcuser=admin --rpcpassword=admin123

results in this error:

error: couldn't connect to server

What am I doing wrong?

Humberd

Posted 2017-06-03T18:55:20.673

Reputation: 121

Answers

2

The --* arguments to bitcoin-cli should come before the RPC command. Those arguments are for bitcoin-cli itself. However the position you put them in are positions for the getinfo RPC command and not bitcoin-cli. You should instead be using the following command:

.\bitcoin-cli.exe --rpcport=54352 --rpcuser=admin --rpcpassword=admin123 getinfo

Andrew Chow

Posted 2017-06-03T18:55:20.673

Reputation: 40 910