0

I have bitcoin-qt running on a Windows machine in my network started with the following command and empty config file (hence, all default configurations).

bitcoin-qt.exe -server=1 -rest=1

I can query the API endpoint of the node on the 8332 port; for instance:

curl http://localhost:8332/rest/chaininfo.json

I want to access the same REST API endpoint from the second computer on the network. On the second computer, I can reach the 8333 endpoint, but not 8332.

$ nc -vz 196.168.1.2 8333
Connection to 192.168.1.2 port 8333 [tcp/*] succeeded!

$ nc -vz 196.168.1.2 8332
nc: connect to 192.168.1.2 port 8332 (tcp) failed: Connection refused 

On the first computer (the one that is running bitcoin-qt), it seems port 8333 can be reached with the computer's IP in the LAN while port 8332 is only reachble via localhost:

$ netstat -aon | findstr 8333
  TCP    0.0.0.0:8333           0.0.0.0:0              LISTENING       117384
  TCP    192.168.1.2:1033     84.212.130.217:8333    ESTABLISHED     117384
  TCP    192.168.1.2:1034     50.39.164.136:8333     ESTABLISHED     117384
  TCP    192.168.1.2:1035     45.132.158.199:8333    ESTABLISHED     117384
  TCP    192.168.1.2:1045     95.84.137.91:8333      ESTABLISHED     117384
  TCP    192.168.1.2:1065     82.197.215.125:8333    ESTABLISHED     117384
  TCP    192.168.1.2:1076     209.237.133.54:8333    ESTABLISHED     117384
  TCP    192.168.1.2:1091     178.48.160.142:8333    ESTABLISHED     117384
  TCP    192.168.1.2:1093     95.110.133.223:8333    ESTABLISHED     117384
  TCP    192.168.1.2:1106     5.188.62.18:8333       ESTABLISHED     117384
  TCP    192.168.1.2:1112     108.248.87.92:8333     ESTABLISHED     117384
  TCP    [::]:8333              [::]:0                 LISTENING       117384


$ netstat -aon | findstr 8332
  TCP    127.0.0.1:8332         0.0.0.0:0              LISTENING       117384
  TCP    [::1]:8332             [::]:0                 LISTENING       117384

Mind [::] for port 8333 and [::1] for port 8332.

I am wondering what changes need to be made in order to reach the 8332 port of the node from another computer in the network.

1 Answer 1

2

The rest interface uses the RPC options for setup. You can use the -rpcbind option to bind the interface to a different address and port, and set the -rpcallowip. Note that this will also affect the RPC interface.

17
  • Could you provide a working example? I used rpcbind according to the following docs, and still cannot get the address correct. github.com/bitcoin/bitcoin/blob/… Commented Aug 29, 2022 at 5:04
  • For example, if the my computer's LAN IP is 192.168.1.10, then to expose my the rpc interface on LAN, I would do -rpcbind=192.168.1.10.
    – Ava Chow
    Commented Aug 29, 2022 at 15:30
  • Thanks! I have actually tried that, but that does not seem to be enough; e.g., above-linked docs read "This option is ignored unless -rpcallowip is also passed.". I have tried passing -rpcallowip arg as well, but that does not seem enough either. Commented Aug 29, 2022 at 17:50
  • What value did you pass for -rpcallowip? In my example, you would do -rpcallowip=192.168.1.1/24.
    – Ava Chow
    Commented Aug 29, 2022 at 22:33
  • Could you please elaborate? e.g., what is 24? Commented Aug 29, 2022 at 22:51

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.