Bitcoin Forum
September 21, 2018, 01:24:56 AM *
News: ♦♦ New info! Bitcoin Core users absolutely must upgrade to previously-announced 0.16.3 [Torrent]. All Bitcoin users should temporarily trust confirmations slightly less. More info.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: bitcoind json-rpc docker 403 Forbidden  (Read 44 times)
Hekica
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
March 05, 2018, 01:28:58 PM
 #1

Hi guys,

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, "127.0.0.1", 8332, "foo", "bar"); 
This is the docker image:

Quote
version: '3.3'

services:

bitcoind:
image: seegno/bitcoind:latest
command:
  -printtoconsole
  -regtest=1
  -rest
  -rpcallowip=172.18.0.2
  -rpcuser=foo
  -rpcpassword=bar
  -rpcport=8332
  -server
  -logips
  -debug=rpc
ports:
  - 8332:8332
Have tried couple of different docker images as well. Always the same: Exception in thread "main"

HttpLayerException(super=CommunicationException
(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.
1537493096
Hero Member
*
Offline Offline

Posts: 1537493096

View Profile Personal Message (Offline)

Ignore
1537493096
Reply with quote  #2

1537493096
Report to moderator
1537493096
Hero Member
*
Offline Offline

Posts: 1537493096

View Profile Personal Message (Offline)

Ignore
1537493096
Reply with quote  #2

1537493096
Report to moderator
Einax Airdrops and Bounties made easy! List your ERC-20 token
FREE
ETH markets launching soon!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1537493096
Hero Member
*
Offline Offline

Posts: 1537493096

View Profile Personal Message (Offline)

Ignore
1537493096
Reply with quote  #2

1537493096
Report to moderator
jrian
Jr. Member
*
Offline Offline

Activity: 38
Merit: 4


View Profile
March 06, 2018, 12:21:00 PM
 #2

Hi guys,

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, "127.0.0.1", 8332, "foo", "bar"); 
This is the docker image:

Quote
version: '3.3'

services:

bitcoind:
image: seegno/bitcoind:latest
command:
  -printtoconsole
  -regtest=1
  -rest
  -rpcallowip=172.18.0.2
  -rpcuser=foo
  -rpcpassword=bar
  -rpcport=8332
  -server
  -logips
  -debug=rpc
ports:
  - 8332:8332
Have tried couple of different docker images as well. Always the same: Exception in thread "main"

HttpLayerException(super=CommunicationException
(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.


just remove rpcallowip from config and test how it's works
Hekica
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
March 06, 2018, 01:02:13 PM
 #3

Tried but getting:

Quote
Caused by: org.apache.http.NoHttpResponseException: 127.0.0.1:8332 failed to respond

One interesting thing in docker logs is

Quote
bitcoind_1  | 2018-03-06 12:57:42 Binding RPC on address ::1 port 8332 failed.

But that happens for any port not just that one.

And this one, connected to the container I tried to read the config:

Quote
root@990e2bbe3ebc:/# cat /home/bitcoin/.bitcoin/bitcoin.conf
cat: /home/bitcoin/.bitcoin/bitcoin.conf: No such file or directory

But in docker logs it is claiming it is reading it.

Quote
bitcoind_1  | 2018-03-06 12:57:42 Using config file /home/bitcoin/.bitcoin/bitcoin.conf

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!