<p>I have setup a bitcoin node in regtest mode with custom config and datadir.</p>

<p>I start bittcoind with command:</p>

<pre><code> bitcoind -conf=bitcoin-demo.conf  -regtest  -datadir="testdatabtc" -daemon
</code></pre>

<p>My bitcoin-demo.conf looks like:</p>

<pre><code>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
</code></pre>

<p>I am able to connect access my node using curl command</p>

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

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

<pre><code>bitcoin-cli -conf="bitcoin-demo.conf"  getblockchaininfo
</code></pre>

<p>This command produces error:</p>

<blockquote>
  <p>error: Could not connect to the server 127.0.0.1:8332</p>
</blockquote>

<p>This works if I specify the port and auth as command line argument:</p>

<pre><code>bitcoin-cli -conf="bitcoin-demo.conf" -rpcport="3133" -rpcuser="alice" -rpcpassword="hello"  getblockchaininfo
</code></pre>

<p>Above command works fine. But the question is</p>

<p><strong>Why bitcoin-cli does not read these arguments from the config file?</strong></p>

CC BY-SA 4.0
2019-11-01T04:47:18.170Z
Did you try just `port=3133`
Michael
CC BY-SA 4.0
2021-11-23T09:50:28.523Z
Maybe, try to generate rpcauth with https://github.com/bitcoin/bitcoin/tree/master/share/rpcauth
jzavisek
<bitcoin-cli><regtest>
bitcoin-cli is not using port specified in config
Prashant Prabhakar Singh
# bitcoin-cli is not using port specified in config

(Asked by: username_0 on 2019-07-10)

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?

**Tags:** bitcoin-cli, regtest

> **Comments:**
> **username_1**: Did you try just `port=3133`  
> **username_2**: Maybe, try to generate rpcauth with https://github.com/bitcoin/bitcoin/tree/master/share/rpcauth  

---

## 0 answers

