Ethereum Networks – Part II: Setting up Private Testnet on the local machine

Ethereum Networks
Reading Time: 2 minutes

In the previous blog: Understanding the different kinds of Ethereum Networks, we talked about what are the different kinds of Ethereum Networks and how to choose a specific network when starting the development with Ethereum. In this blog, we will provide you a cheat sheet of Linux commands which you can refer to quickly set up the private network on your machine without going through the extensive theoretical details of each step. I will only provide details where it is necessary.  So, let us begin!!

Install Required Softwares

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install -y build-essential
$ sudo apt-get install git
$ cd ~
$ git clone

After installing the required software with the above steps, change to your home directory as:

 $ cd ~

Thereafter, download go Ethereum version 1.9.3 (You can switch to the latest version, but we will keep this version so that we will have some consistency throughout this article.

Install Go

cd ~ $ wget

UnPack Go

sudo tar -C /usr/local -xzf go1.9.3.linux-amd64.tar.gz

Add the following at the end of ~/.bashrc and refresh the terminal.

 $ export PATH="$PATH:/usr/local/go/bin"

Once the go is added to the PATH, verify it by:

 $ go version 
 go version go1.9.3 linux/amd64 (output)

Reducing Mining Algorithm Difficulty (Optional)

If you want to reduce the difficulty of mining and consensus algorithm so that you can further reduce the block validation time on the local machine, it is well instructed by this blog

Build Go Ethereum (geth)

 $ cd ~ 
 $ cd go-ethereum 
 $ make geth

Configuring and running Go Ethereum

Create data directory for Ethereum and create a new account specifying the created data directory. Upon generating the Account, you will get the Ids and will be asked for setting a passphrase. Create an account and save the Account Number and passphrase.

Create Account

$ cd ~ 
$ mkdir gethDataDir 
$ geth account new --datadir ~/gethDataDir

Configuring the Genesis Block:

The Genesis block is the inception of blocks while starting a network for the first time. We can configure the genesis blocks with various parameter below to have some funds already while starting up the Network for created accounts. Create a file in genesis.json in the Data Dir i.e. ~/gethDataDir in our case. Remember, the Account address must be replaced with your newly generated account.

Genesis Block Config

    "config": {
        "chainId": 99,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    "difficulty": "1",
    "gasLimit": "2100000",
            "yourNewlyCreatedAccountAddressMustGoHere": {
            "balance": "300000"

Initialize the blockchain with below commands:

$ cd ~/gethDataDir
$ geth --datadir ~/gethDataDir/ init genesis.json
Verify the set up by starting Ethereum:
$ cd ~
$ geth --datadir ~/gethDataDir --networkid 99

One can connect to the Ethereum using RPC or IPC endpoint as suggested by the initialization logs in Ethereum Node.

That’s all about setting up Private Node and running it on the local machine.

In the next part of our blog, We will guide you through deploying a contract on the Ethereum Testnet. Stay Tuned! Thanks for reading!!



The cheat sheet is partly referenced from the Timothy McCallum blog on Medium and Go Ethereum Wiki.

Written by 

Manish Mishra is Lead Software Consultant, with experience of more than 7 years. His primary development technology was Java. He fell for Scala language and found it innovative and interesting language and fun to code with. He has also co-authored a journal paper titled: Economy Driven Real Time Deadline Based Scheduling. His interests include: learning cloud computing products and technologies, algorithm designing. He finds Books and literature as favorite companions in solitude. He likes stories, Spiritual Fictions and Time Traveling fictions as his favorites.