简体   繁体   中英

How do i connect to an Ethereum node?

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

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM