Go back

How to connect to Ethereum Full node for Development

If you would like to utilize the Ethereum fullnode for your development purpose using Web3 javascript api, you can do so by restarting Geth with RPC node opened . Below are the steps :

  1. First, stop the Geth process by running below command
sudo killall -HUP geth

/img/common/ethereum-fullnode/killall.png

  1. Now restart Geth by running below command:
sudo nohup geth --http --http.addr "0.0.0.0" --http.port "8545" --http.corsdomain "*" --config /home/ubuntu/ethereum/eth_config.toml >> /var/log/cloud-init-output.log 2>&1 &

/img/gcp/ethereum-fullnode/restart-sync.png

  1. Before you can connect to the node from Javascript or other Ethereum supported API, make sure port 8545 is opened over the VM’s public IP. How to add custom port on AWS

How to add custom port on GCP

How to add custom port on AZURE

  1. Once the port is opened over public ip, you can connect to the node . Below is a code snippet to connect to the node using Web3 javascript api assuming Web3 is installed on the client machine:
Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://VM_PublicIP:8545"));
Go back