5

I have read a similar post which had no answer at this location. I am trying to use bitcoin-cli from a host that different from the host that runs bitcoind. I also would be happy with being able to use curl to issue rpc requests. I have had much success with getting bitcoind and bitcoin-cli to communicate within the same host, but activating the rpc port for external communication has proven to be beyond difficult if not impossible, and I am seeking your help.

I have started bitcoind with the following configuration file:

server=1
rpcuser=jared
rpcpassword=1234
rpcport=8332
rpcallow=192.168.*.*
gen=0
prune=600

(Note, the password will be changed after the system is working)

I have confirmed that the system is functioning on the local machine using bitcoin-cli to get the following:

{
    "version" : 110200,
    "protocolversion" : 70002,
    "blocks" : 183745,
    "timeoffset" : -1,
    "connections" : 8,
    "proxy" : "",
    "difficulty" : 1583177.84744401,
    "testnet" : false,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00005000,
    "errors" : ""
}

And from another host on the network, I have used nmap to scan the ports to display:

Starting Nmap 6.47 ( http://nmap.org ) at 2015-12-19 15:20 PST
Nmap scan report for c161.attlocal.net (192.168.1.68)
Host is up (0.0014s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
8333/tcp open  unknown

In the question referenced above, the user was able to cause the rpc port to open by removing the rpcallow lines from his configuration file. He commented them out, and the problem fixed itself. I have also tried this and not had any luck.

I also have tried using rpcallow of '192.168.1.*', '192.168.0.0/16', '192.168.1.0/24' and once tried using rpcbind, which appears to be related to an older version of bitcoind as it is no longer listed in the man pages for bitcoin.conf.

My system is running the following OS:

Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:    15.10
Codename:   wily

Any and all help is appreciated! Kind regards, and thank you.

2
  • The wildcard syntax is not supported anymore, you need to use 192.168.0.0/16. What does netstat -antlp | grep 8332 say?
    – Nick ODell
    Dec 20, 2015 at 0:25
  • @NickODell, please add your comment as an answer so I can give you credit for solving my problem. The RPC port does not display as an open port on nmap even still, but it is clear the bitcoin-cli application is communicating with the primary host. Dec 20, 2015 at 1:31

2 Answers 2

5

Two thoughts:

  1. The wildcard syntax is not supported anymore. Instead of 192.168.*.*, use 192.168.0.0/16. Instead of 192.168.1.*, use 192.168.1.0/24.

  2. As an additional debugging step, try running netstat -antlp | grep 8332. If that produces output like the following, that means that it is bound to the port.

    tcp        0      0 0.0.0.0:8332             0.0.0.0:*               LISTEN 
    
4
  • Thanks. After netstatit turns out my bitcoin node listen at port 18332, not 8332.
    – Ozgur
    Jan 9, 2018 at 19:04
  • Did you ever figure out why it doesn't use the provided port?
    – ulu
    Aug 25, 2019 at 9:13
  • Where can I find actual official documentation for bitcoin.conf?
    – gkucmierz
    Oct 24, 2023 at 5:16
  • 1
    @gkucmierz You should ask that as a question so that it's easily searchable.
    – Nick ODell
    Oct 24, 2023 at 15:51
0

Besides allowing range of network addresses for clients, you need to add also specify rcpbind=server_ip_address for the server (where your bitcoin core is running).

The default value for rcpbind is 127.0.0.0 and it only allows RPC to listen on the localhost and not on 0.0.0.0.

In order to have the ability to connect from localhost and from the network add the setting twice, as shown in example:

server=1
rpcuser=bitcoin
rpcpassword=yourpassword

[main]
rpcbind=127.0.0.1
rpcbind=192.168.0.10
rpcallowip=127.0.0.1
rpcallowip=192.168.0.0/16

EDIT: Alternatively, instead of typing the specific address of the server, you can just use rcpbind=0.0.0.0 to force RPC to listen on 0.0.0.0. This is more flexible, but then you rely solely on rpcallowip to allow only local connections.

0

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.