## Unable to bind any endpoint for RPC server

3

I recently updated my bitcoin docker image to bitcoing v0.18.0 version and can't allow external rpc connections to it now. It binds to localhost if I set rpcallowip=X.X.X.X, then I tried to used rpcbind parameter also, but couldn't set my docker container to allow external rpc connetions.

This is what I get:

bitcoin_1       | 2019-05-23T13:39:34Z Bitcoin Core version v0.18.0 (release build)
bitcoin_1       | 2019-05-23T13:39:34Z Assuming ancestors of block 0000000000000000000f1c54590ee18d15ec70e68c8cd4cfbadb1b4f11697eee have valid signatures.
bitcoin_1       | 2019-05-23T13:39:34Z Setting nMinimumChainWork=0000000000000000000000000000000000000000051dc8b82f450202ecb3d471
bitcoin_1       | 2019-05-23T13:39:34Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
bitcoin_1       | 2019-05-23T13:39:34Z Using RdSeed as additional entropy source
bitcoin_1       | 2019-05-23T13:39:34Z Using RdRand as an additional entropy source
bitcoin_1       | 2019-05-23T13:39:34Z Default data directory /root/.bitcoin
bitcoin_1       | 2019-05-23T13:39:34Z Using data directory /home/BTC
bitcoin_1       | 2019-05-23T13:39:34Z Config file: /home/BTC/bitcoin.conf
bitcoin_1       | 2019-05-23T13:39:34Z Using at most 125 automatic connections (1048576 file descriptors available)
bitcoin_1       | 2019-05-23T13:39:34Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
bitcoin_1       | 2019-05-23T13:39:34Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
bitcoin_1       | 2019-05-23T13:39:34Z Using 0 threads for script verification
bitcoin_1       | 2019-05-23T13:39:34Z Binding RPC on address X.X.X.X port XXXX failed.
bitcoin_1       | 2019-05-23T13:39:34Z Unable to bind any endpoint for RPC server
bitcoin_1       | 2019-05-23T13:39:34Z Error: Unable to start HTTP server. See debug log for details.
bitcoin_1       | Error: Unable to start HTTP server. See debug log for details.
bitcoin_1       | 2019-05-23T13:39:34Z Shutdown: In progress...
bitcoin_1       | 2019-05-23T13:39:34Z scheduler thread start
bitcoin_1       | 2019-05-23T13:39:34Z scheduler thread interrupt
bitcoin_1       | 2019-05-23T13:39:34Z Shutdown: done


My bitcoin.conf file looks like this:

server=1
rpcbind=X.X.X.X
rpcallowip=0.0.0.0/0
rpcport=XXXX
port=XXXX
rpcuser=user


2

Here's how you fix the rpcbind issue with the latest change in version 0.18.0.

Before 0.18, if you put rpcallowip=0.0.0.0/0, the value of rpcbind didn't need to be set as it defaulted to all interfaces.

Now that is no longer the case. Here's my setup, for running bitcoind in a container through Docker compose:

rpcallowip=0.0.0.0/0
rpcbind=127.0.0.1
# local DNS name (container name used in my Docker Compose file)
rpcbind=bitcoind


The first rpcbind is so I can make RPC calls from inside the container. The second is so other containers can reach the bitcoind container.

I think this does what you want:

1. I can RPC from inside the bitcoind container
2. I can RPC from another container on the same network (as specified in the compose file) to the bitcoind container
3. I can RPC from my localhost outside the container.

For the last, I exposed port 8332 to my localhost in the compose file and I can curl to the container:

\$ curl --user user --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getbestblockhash", "params": [] }'  -H 'content-type: text/plain;' 127.0.0.1:8332/
Enter host password for user 'user':


The full details of my container setup are here, in case there's something I missed in writing up my answer.

0

If you take a look of the release note, you will find that:

The rpcallowip option can no longer be used to automatically listen on all network interfaces. Instead, the rpcbind parameter must be used to specify the IP addresses to listen on. Listening for RPC commands over a public network connection is insecure and should be disabled, so a warning is now printed if a user selects such a configuration. If you need to expose RPC in order to use a tool like Docker, ensure you only bind RPC to your localhost, e.g. docker run [...] -p 127.0.0.1:8332:8332 (this is an extra :8332 over the normal Docker port specification).

You said in comment

because I need to control my node remotely

I'm afraid for any version >= 18 this would not be doable but rightfully given rpc connection are no encrypted which mean plain-text login/password that's why it is not recommended/possible anymore see. Using one of both interface remotely RPC or REST looks like not recommended so you could still do it but has to know it is insecure.

My guess is that rpcbind should be an internal IP on the computer running bitcoin core and you should route external RPC call from the router of your internal network to the rpcbind's one.

So basically you cannot allow external ip to accept rpc calls? You can accept only local rpc calls? But is there any workaround, because I need to control my node remotely. – Igoris Skinderis – 2019-05-24T07:23:03.977

@IgorisSkinderis update my answer – onepix – 2019-05-24T09:07:41.110