cannot call rpc api from other machine in same local network

There is a regtest node in my local network , I can call rpc api only from the node's machine,not my local machine.

I know rpcallowip is changed in recent release https://bitcoin.org/en/release/v0.18.0#configuration-option-changes

http clinet httpie

my local machine's ip:

btc node's ip:

the port 8332 is opened sudo ufw allow 8332.

bitcoind version

$ bitcoind -version                 
# Bitcoin Core Daemon version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65

command start bitcoind

I start regtest , and my ip is

bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip= -rpcbind=  -server -rpcport=8332

client request

# request from btc node's machine
http POST http://user:[email protected]:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# successed

# request from my local machine
http POST http://user:[email protected]:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# http: error: ConnectionError: HTTPConnectionPool(host='', port=8332): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd6e288f438>: Failed to establish a new connection: [Errno 111] Connection refused',)) while doing POST request to URL: http://user:[email protected]:8332/
  • rpcbind should probably be Commented Oct 14, 2019 at 7:42
  • @RaghavSood bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip= -rpcbind= -server -rpcport=8332 still return Failed to establish a new connection. Commented Oct 14, 2019 at 8:03
  • Try changing rpcallowip to, I believe some (all?) of the RPC options don't accept netmasks Commented Oct 14, 2019 at 8:31
  • @RaghavSood It still doesn't work. What's your bitcoind versiosn? Commented Oct 14, 2019 at 8:53
  • @ToknsitToknsit I had a simil problem and the problem was the local network, and the example you use more modem to connect? Commented Oct 27, 2019 at 21:48

3 Answers 3


The problem is that you apply wrong options values for -rpcallowip and -rpcbind.


This one tells bitcoind to bind RCP server to That means it will be available from the same host only.

-rpcallowip= means Class C network with IP address range -

The correct options in your case are:

-rpcallowip= -rpcbind=

or even more secure:

-rpcallowip= -rpcbind=

Finally,I create a proxy to solve it. I am not sure if there is a risk of this code.


var httpProxy = require('http-proxy');
const rpcPort = process.env.RPC_PORT;
const exportPort = process.env.EXPORT_PORT;

httpProxy.createProxyServer({ target: `${rpcPort}` }).listen(exportPort);

To expand on the answer from @Slavik Svyrydiuk : it only worked for me when starting the daemon with those options (-rpcbind= -rpcallowip=

If I set those in the conf and just started it like normal (sudo bitcoind -daemon) then it WOULD NOT open the port to external connections. It works only if I start the daemon with those settings like this:

sudo bitcoind -daemon -rpcbind= -rpcallowip=

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.