Search code examples
rsk

How to expose RSK node to an external network?


I am having problems exposing my RSK node to an external IP. My startup command looks as follows:

java \
  -cp $HOME/Downloads/rskj-core-3.0.1-IRIS-all.jar \
  -Drsk.conf.file=/root/bitcoind-lnd/rsk/rsk.conf \
  -Drpc.providers.web.cors=* \
  -Drpc.providers.web.ws.enabled=true \
  co.rsk.Start \
  --regtest

This is my rsk.conf:

rpc {
 
     providers {
         web {
             cors: "*",
             http {
                 enabled = true
                 bind_address = "0.0.0.0"
                 hosts = ["localhost", "0.0.0.0"]
                 port: 4444
             }
         }
     }
 }

API is accessible from localhost, but from external network I get error 400. How do I expose it to external network?


Solution

  • You should add your external IP to hosts. Adding just 0.0.0.0 is not enough to indicate all IPs to be valid. Port forwarding needs to be enabled for the port number that you have configured in rsk.conf, which in this case is the default value of 4444.

    rpc {
         providers {
             web {
                 cors: “*”,
                 http {
                     enabled = true
                     bind_address = “0.0.0.0"
                     hosts = [“localhost”, “0.0.0.0", “216.58.208.100”]
                     port: 4444
                 }
             }
         }
     }
    

    where 216.58.208.100 is your external IP