Practical steps for go-ethereum setup

This tutorial cover installation, setup and basic commands of go-ethereum. After completing this tutorial, you can setup your own semi public ethereum network.


OS: Ubuntu 16.04 ( 64 bit )

If you are using Virtual Machine, bridge the network adapter as below.

Network setting in virtual box

Geth Installation

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt update
sudo apt install ethereum

Check geth command

geth --help
Testing geth

Project directory setup

mkdir ethProject
cd ethProject

Create a directory node_app to add script files containing geth commands.

mkdir node_app

Creating a new account

Inside directory node_app , create a file .

cd node_app

Put the below command inside file.

geth --datadir ../eth_node account new

press Ctrl + x and y and enter to save file.

Make the file executable.

sudo chmod +x

Run script.


The directory structure become like below.

|- eth_node
|- keystore
|- account-file
|- node_app

Blockchain initialization

Create a file genesis.json

nano genesis.json

Put the below contents

"config": {
"chainId": 88888,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
"coinbase" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x1",
"extraData" : "0x00",
"gasLimit" : "0xfffffffffffffff",
"nonce" : "0x0000000000000042",
"timestamp" : "0x00",
"alloc" :{
"account-address": {"balance": "0xffffffffffffffffffffffff"}
Notes: "alloc" properties will fill your account(s) with ether. You need to fill account-address with the previously created account. When you setup geth on another computer, you need to use the same 'genesis.json' file in order to make successful connections between nodes.

Create a file .


Put the below command.

geth --datadir ../eth_node init genesis.json

Make the file executable as above.

Run script.


Running geth and interacting with javascript console

Create a file putting the below command and make it executable.

geth --datadir ../eth_node --nodiscover console

Run script


You can test basic commands valid inside JavaScript console.

eth.accounts // list accounts
eth.getBalance(eth.accounts[0]) //check balance of account 0

more commands

Start mining


Let’s Create another account to transfer ether.

Open another terminal and Inside node_app directory, run ./ .

You will see two accounts when running eth.accounts inside console.

Check the balance of new account.

Transferring ether between accounts

Unlock account to send transaction.


Transfer ether

eth.sendTransaction({from:eth.account[0],to:eth.account[1], value:10000000000})
Transferring ether

The above transaction is mined by geth as below.

Make sure geth node is mining by checking a boolean property,


Check balances again

Balances after transaction

Now, geth is running as a single node with own genesis block and mining transactions successfully. Let’s create a blockchain network.

Geth multi-nodes setup

Create a file static-nodes.json

Inside console, print enode of geth node


Copy result into static-nodes.json file and insert ip address as below


Copy node_app folder to another computer.

Run scripts inside node_app folder.


Copy static-nodes.json into eth_node directory

cp static-nodes.json ../eth_node

Start geth


When geth run, it will detect static-nodes.json and connect to the node(s) using enode(s).

Check peer count


Check balance of account

Transfer ether from account of first node to account of second node.

Check balance again.

Now, you have successfully created blockchain network using geth.

You can add as many nodes as you want by adding enodes inside static-nodes.json file.