A Beginners Guide To Setup Ethereum Node On Localhost

Ethereum Blockchain comprises a network of nodes connected peer to peer. Let’s learn how to deploy Ethereum Node on local server and how to interact with it.

Guide To Setup Ethereum Node On Localhost

In our previous blog posts, we wrote on multiple topics that include Blockchain Technology for Business, Writing a Basic Smart Contract, and Popular Blockchain Platforms. In this blog post, we will talk about Ethereum Blockchain regarding setting up Ethereum Node on localhost and we will see how to interact with the test network. We will cover the following key points.

Insights About Ethereum Blockchain

Most of the decentralized applications are based on Ethereum Blockchain. Smart Contract is an integral component of this distributed infrastructure. Moreover, blockchain is a network of computers called “Nodes”. However, each node contains a copy of the blockchain and thus participates in the network. Ethereum Blockchain also has its own cryptocurrency called “Ether”.

All the transactions are cryptographically secured. In addition, it is a complete ledger technology that never shuts down or gets corrupted. It lets you write smart contracts and dapps. There is strong support for Ethereum Blockchain and fortune 500 companies have shown great interest to do development on a larger scale using this technology.

How to Setup Ethereum Blockchain?

In this section, we will set up the Ethereum node on our local machine. Before going further, make sure you have installed the following pre-requisites.

Once pre-requisites are in place, please run the following command to clone the source code:

git clone https://github.com/ethereum/go-ethereum

Upon a successful clone, go into the directory:

cd go-ethereum

Now, run the following command to build the geth program:

make geth

Note

In case of any error, please Install XCode by running xcode-select --install and try again

So, you have set up all the pre-requisites and source code. Therefore, run the following command to start the Node:

build/bin/geth
Ethereum Node
This image shows the running Ethereum Node

How to Interact With Ethereum Blockchain?

This section talks about the interaction with a running Ethereum Node that is fully synchronized with the blockchain. We can use the GETH software to interact and send commands to the test network.

For that, let’s include build/bin/geth in $PATH environment variable by running the following commands:

cd build/bin/
sudo scp geth /usr/local/bin

After that, stop the server that you brought up above and run the test network with the following flags:

geth --testnet --rpc --rpcapi="db,eth,net,web3,personal,web3"
Ethereum Node

Next, you need to open a new terminal window and attach the Geth command to the Node by running the following command:

geth attach http://127.0.0.1:8545
Ethereum Node

Geth will open a console window where you can interact with the test network. Following command will create an account that holds the virtual currency and public/private key pair:

personal.newAccount()
Ethereum Node

To check your account, you can run the following command:

eth.accounts
Ethereum node

Likewise, there are many commands that you can use to interact with Ethereum Blockchain.

Conclusion

Here comes the end of this tutorial. Ethereum Blockchain is a generalized solution for most decentralized applications. Further, containerize.com has published many technical blog posts and tutorials about popular open source products at blog.containerize.com. Therefore, stay connected with the Blockchain Platforms category for regular updates.

Relevant Product Pages

You may find the following links relevant: