have read all possible examples on the internet but still cannot connect to btc node from Java.

I'm using btcd-cli4j but have tried all other rpc libs as well, result is the same. This is the command:

BtcdClient client = new VerboseBtcdClientImpl(httpProvider, "", 8332, "foo", "bar");  

This is the docker image:

version: '3.3'


image: seegno/bitcoind:latest
  - 8332:8332

Have tried couple of different docker images as well. Always the same: Exception in thread "main"

(super=com.neemre.btcdcli4j.core.http.HttpLayerException: Error #1003001: The server responded with a non-OK (4xx) HTTP status code. Status line: HTTP/1.1 403 Forbidden, code=1003001))

My suspicion was around rpcallowip but don't know how to set correctly. This one is set by going into the docker container and executing hostanme -i to see the ip address. Setting that one in config and restarting the container.

  • I suspect that you are actually connecting to the RPC service since you are getting a 403 status returned and not a timeout. Does it work if you remove -rpcallowip=
    – Willtech
    Mar 17, 2018 at 19:45
  • I would say that as well but cannot get a correct response. When removing it I'm getting Error #1004004: The operation failed due to an unknown IO exception.
    – Reeebuuk
    Mar 18, 2018 at 9:30

1 Answer 1


add or changed to


this will fix most of rpc json 403 forbidden error (this has no security issues if your using it within your network)

  • I would have sworn I've tried this multiple times but heh, it is working now, that is all that matters :)
    – Reeebuuk
    Mar 18, 2018 at 9:32

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.