I need to use Web3 on some Python and Javascript applications i'm creating, so i decided to setup a light node on a VPS. The node seems to work, but i'm having troubles accessing it from outside the vps. I'm making sure to serve the RPC API and i tried everything, but i still can use web3 from inside the vps.

w3 = Web3(Web3.HTTPProvider('http://<MY-IP>:8545'))

Gives False.

Instead, if i try to do the same from my local VPS where the node is hosted i get True.

Here is how i'm starting the node:

geth --syncmode "light" --rpc --rpcport 8545 --rpcaddr --rpccorsdomain "*" --rpcapi "eth,web3"

I know that it's not a good practice to make the node available to any remote connection, but i'm not storing private keys or balances, i just want to use it to get blokchain data from web3 and i'll see if there is a way to make it accept only specific IPs. How can i make it accept remote connections?

Can the problem be that port 8545 is refusing remote connections? Or is it something else?

1 Answer 1


First, you should make sure you are using a fairly new geth version. I tested on my recently downloaded version from the official download site

My local version is

$ ./geth version
Version: 1.9.25-stable
Git Commit: e7872729012a4871397307b12cc3f4772ffcbec6
Git Commit Date: 20201211
Architecture: amd64
Protocol Versions: [65 64 63]
Go Version: go1.15.6
Operating System: linux

Second, you should make sure you use the new flags, the ones you listed are deprecated and will be removed in the future.

--rpc --rpcport 8545 --rpcaddr --rpccorsdomain "*" --rpcapi "eth,web3"

Should be replaced with

--http --http.port 8545 --http.addr --http.corsdomain '*' --http.api 'eth,web3'

Lastly, you also need to enable http.vhosts and allow any or only your domain.

You can do this with

--http.vhosts '*'

When you start the node, you should see this line

INFO [02-17|14:32:16.975] HTTP server started                      endpoint=[::]:8545 cors=* vhosts=*

Even after this line was displayed in the console, you still might not be able to connect to it right away.

After the node boots up, which can take a while, you will be able to connect to it.

  • Thank you a lot for your help! Is it possible that i need to do something else? Because i did exactly the same, i just added --syncmode "ligh" at the start and i see endpoint=[::]:8 545 cors=* vhosts=*, but while i can connect from the vps i still can't connect from outside. Maybe there is some port i need to open or a firewall is blocking it?
    – Jack022
    Feb 17, 2021 at 13:15
  • To connect to port 8545 no other port is needed. It is possible that the firewall is blocking it. If you're running nmap or trying to connect to the port directly does it work? You should be able to even try it in your browser and you should get 400 Bad Request. Feb 17, 2021 at 13:39
  • Yes indeed i can't reach it, i don't get a bad request, it's just unreachable; so i guess it's the firewall blocking it but i don't know how to avoid that
    – Jack022
    Feb 17, 2021 at 13:43
  • I tried with telnet from my laptop and the result is the same
    – Jack022
    Feb 17, 2021 at 13:44

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.