Home > Back-end >  I can't connect to my BSC full synced node from another computer
I can't connect to my BSC full synced node from another computer

Time:04-07

I have set up a BSC full node on the mainnet on a hetzner server with Ubuntu 20.04 bscusing the steps provided here: https://www.quicknode.com/guides/infrastructure/how-to-run-a-binance-smart-chain-node However I can't connect either with my Metamask to the node, nor through the ws. I receive 'an error has occurred' on both of them, I also tried to connect through a script in python and I am unable to connect to the node with both protocols. I assume the issue is that my server is not allowing others to connect to the node. If I run 'geth attach http://127.0.0.1:8545' on the server I get:

instance: Geth/v1.1.8-859186f2-20220128/linux-amd64/go1.18 at block: 16566352 (Fri Apr 01 2022 14:40:07 GMT 0200 (CEST)) modules: eth:1.0 net:1.0 parlia:1.0 rpc:1.0 txpool:1.0 web3:1.0

and if I execute 'eth.syncing' I get 'false', which should be ok as the node is in sync already.

This is my log from geth: enter image description here

Following up on some of the answers provided on stackoverflow I have also tried to run geth with the following parameters with no success: 'geth --config ./config.toml --datadir ./node --cache 18000 --rpc.allow-unprotected-txs --txlookuplimit 0 --http --http.addr "0.0.0.0" --http.corsdomain "*" --http.port "8545"'

Any help would be greatly appreciated.

CodePudding user response:

I have found the issue if anyone stumbles upon the same situation or close to it you might wanna try it.

The issue was on my config.toml for the RPC http requests, I had by default the following fields HTTPHost = "localhost" and HTTPVirtualHosts = ["localhost"] in the config.toml file, I have replaced the localhost with my server's external IP, and it worked flawlessly. You can also replace it with 0.0.0.0.

Then I've executed geth with the following arguments: --config ./config.toml --datadir ./node --ws --ws.origins=* --rpcvhosts=* --cache 18000 --rpc.allow-unprotected-txs --txlookuplimit 0

The --ws --ws.origins=* arguments made it also possible to me to connect to the node using the websocket protocol.

  • Related