1

I have setup a bitcoin node in regtest mode with custom config and datadir.

I start bittcoind with command:

 bitcoind -conf=bitcoin-demo.conf  -regtest  -datadir="testdatabtc" -daemon

My bitcoin-demo.conf looks like:

regtest=1
server=1
rpcuser=alice
rpcpassword=hello
rpcallowip=0.0.0.0/0
rpcconnect=127.0.0.1
# Options only for regtest
[regtest]
rpcport=3133

I am able to connect access my node using curl command

curl --user alice:hello --data '{"method":"getblockchaininfo","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST http://localhost:3133

But when I try to access the same commands using bitcoin-cli, it tries to connect to port 8332, even when I specify the config file.

bitcoin-cli -conf="bitcoin-demo.conf"  getblockchaininfo

This command produces error:

error: Could not connect to the server 127.0.0.1:8332

This works if I specify the port and auth as command line argument:

bitcoin-cli -conf="bitcoin-demo.conf" -rpcport="3133" -rpcuser="alice" -rpcpassword="hello"  getblockchaininfo

Above command works fine. But the question is

Why bitcoin-cli does not read these arguments from the config file?

  • Did you try just port=3133 – Michael Nov 1 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.