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.
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
- How to Setup Ethereum Blockchain?
- How to Interact With Ethereum Blockchain?
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:
Now, run the following command to build the geth program:
NoteIn case of any error, please Install XCode by running
xcode-select --installand try again
So, you have set up all the pre-requisites and source code. Therefore, run the following command to start the 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:
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"
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
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:
To check your account, you can run the following command:
Likewise, there are many commands that you can use to interact with Ethereum Blockchain.
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.