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'))
print(w3.isConnected())
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 0.0.0.0 --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?