1

I setup an Ethereum light node on a VPS using Geth, and i'm running it using:

nohup geth --syncmode "light" --rpc --rpcapi "eth,net,web3" --ws --rpccorsdomain '*' --rpcaddr 0.0.0.0 --rpcport 8080 &

Now from my local laptop i would like to use this node to perform web3 queries to the Etherum blockchain. I'm using python but i tried to do the same using Web3js too and the output is the same:

from web3 import Web3
w3 = Web3(Web3.HTTPProvider('http://MY-VPS-IP:8080'))
print(w3.isConnected())

Which gives me the following output:

False

Which means, i'm assuming, that the node is not accessible from outside the vps where i hosted it. How can i access it from outside? In theory the command i used should work, and i also made sure to have port 80 open. Any advice is appreciated

TylerH
  • 20,799
  • 66
  • 75
  • 101
JayK23
  • 287
  • 1
  • 15
  • 49

1 Answers1

1

The command you write is old and not fully correct use this:

geth --syncmode "light" --ws --ws.addr "specific IP" --http --http.addr "specific IP"
  • Note that binding RPC ports to all public IPs to your Ethereum node, what `0.0.0.0` effectively does, is a bad idea as your node will get a lot of malicious traffic. It is only recommend for people who know what they are doing. Instead, bind RPC to a specific IP that it *not* exposed to Internet. – Mikko Ohtamaa Aug 04 '21 at 06:50
  • yes you are right, its just an example i have to edit my answer thanks a lot – Ehsan Shojaei Aug 06 '21 at 17:28