TransWikia.com

Connect dApp hosted on cloud with Geth running locally

Ethereum Asked by Prachi Sharma on December 23, 2021

I’ve my dApp running on AWS and Geth running locally. How am I supposed to connect my hosted dApp with the Geth?

I’m connecting my web3(using web3.py) using my computer’s(Windows OS) IP address.

web3 = Web3(Web3.HTTPProvider("http://xx.xx.xx.xx:8545"))

Port 8545 has been also opened via Firewall port.

Running my Geth node using

geth --datadir ./Doc-Nodes --networkid 4780 --rpc --rpcapi "db,personal,eth,net,web3,debug,admin" --rpccorsdomain="*" --rpcaddr="0.0.0.0" --rpcport 8545 --allow-insecure-unlock console  

But I’m always getting the error while sending the request to dApp.

requests.exceptions.ConnectTimeout:
HTTPConnectionPool(host=’xx.xx.xx.xx’, port=8545): Max retries
exceeded with url: / (Caused by
ConnectTimeoutError(urllib3.connection.HTTPConnection object at)

How am I supposed to connect both? I’m confused about what IP should be provided in the web3 connection as well as rpc address.

Thanks.

2 Answers

You can try using a reverse ssh connection on a host with public ip of your property, or otherwise use ngrok for the reverse ssh.

host= public ip

$ssh -R 8545:localhost:<port> user@<host>

$ngrok tcp 8545

web3 = Web3(Web3.HTTPProvider("http://<host>:<port>")) //or ngrok link connection with port

Answered by user7362292 on December 23, 2021

You need to pass --rpcvhosts * too

Answered by Kivutar on December 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP