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: 192.168.1.155
btc node's ip: 192.168.1.132
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 192.168.1.155
bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip=0.0.0.0/24 -rpcbind=127.0.0.1 -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 192.168.1.155
http POST http://user:[email protected]:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# http: error: ConnectionError: HTTPConnectionPool(host='192.168.1.132', 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 be0.0.0.0
bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip=0.0.0.0/24 -rpcbind=0.0.0.0 -server -rpcport=8332
still returnFailed to establish a new connection
.192.168.1.155
, I believe some (all?) of the RPC options don't accept netmasks