Setting up Ethereum Client or Node to facilitate testing and development of Decentralized Application Development or DAPP
By: Secured Front
Tags: Digital Transformation, Solidity, Dapps, Contracts, Blockchain

Setting up Ethereum Client or Node to facilitate testing and development of Decentralized Application Development or DAPP Secured Front May 12·3 min read

Many developers lose a lot of productive time in setting up a test environment for DAPP and CONTRACT development using SOLIDITY. Be it Ethereum simulator, Private Ethereum network, or Public test network like ROPSTEN. The example here uses “Public test network”. This blog should save time for you and the rest of your team members.

Install the latest Go Ethereum implementation from here. The installation is very straightforward.

If you are using a windows machine, just remember that the default path for — datadir is C:\Users\% USERNAME%\AppData\Roaming\Ethereum

You will find all your chain and account data here, after installation and first run. Be sure to import or copy your account keys in the keystore.

Start the command window and run the following command:

geth --networkid 4 --http.addr “0.0.0.0” --http --http.api personal, eth, net, web3

If you are doing this for the first time, run these two commands before you proceed. On a separate command prompt run:

geth attach ipc: \\. \ pipe \\ geth.ipc — This should attach geth console to running geth instance.

2. geth account new — This will create a new account

The bold geth command will expose JSON-RPC interface on HTTP for the modules, personal, eth, net, web3.

You can make the network more restrictive, by specifying the interface on which you want the geth to listen. Since it is for testing and development, I have kept it “0.0.0.0” so you can simply copy-paste the command out of the box. You may also add or remove modules as required. Here is the list of modules that you access.

admin, debug, eth, ethash, miner, net, personal, rpc, txpool web3

Watch the console log for a few minutes, you should see peers count increased from 0 to some value, the default max is 25. In case you are not able to see peers or blocks being synced on the console log, make sure that your proxy supports UPnP and is enabled. OR try connecting over a non-proxied internet connection.

If you want peers to connect to your node, ensure that the Ethereum discovery port is accessible to the remote peers, by punching a hole in the firewall for port 30303 on your system.

Since we need to connect remotely using the RPC, we will need to open port 8545 for all the incoming JSON-RPC requests.

Test the URL directly on the browser. For example, if your interface has an IP address of 192.168.1.100. The URL visit will be as follows.

http://192.168.1.100:8545/

The response should be a blank page. Perform a confirmative test by going to browser settings -> developer tools -> Network -> Response. The browser response code of 200 should be seen.

At this point, you are ready to start your development against the remote Ethereum node using JSON-RPC from your DAPP or Decentralized Application.

You could use simulators like Ganecha, but I prefer to stay as to the real environment as possible. A real private or consortium network would also be a great idea, if you would like to skip some steps such as mining.