Ethereum : How to setup a local test node with initial ether balance using geth


  • Ethereum node — Using geth (Version: 1.7.3)
  • Environment — MacOS Sierra (Version10.12.3)
  • Ethereum wallet/client -Mist (Version 0.9.2)


  • Geth should be installed
  • Mist should be installed
  • Create folder “mychain” in your home directory (all the data related to the new node will be stored in this folder). Create “data” and “logs” subfolder inside mychain folder. inside logs folder, create an empty log file call “00.log
mkdir ~/mychain
cd ~/mychain
mkdir data
mkdir logs
cd logs
touch 00.log

Verify environment

  1. If geth is installed successfully you should see the following output for ‘geth version’ from your command prompt.
XXXMBP:~ xxxx$ geth version
Version: 1.7.3-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.2
Operating System: darwin
Folder/File structure

Setting up process

Step 1 — Create an account

geth --datadir ~/mychain/data account new
Your new account is locked with a password. Please give a password. Do not forget this password.
Repeat passphrase:
Address: {7a5ef9a69d1748bb9ece0ef8ad94e63a7e76d10d}

Step 2 — Create additional accounts

Private keys in keystore for newly created accounts

Step 3 — Create CustomGenesis.json

"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x8000000",
"difficulty": "0x400",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {
"0x01c9bad367636cf1583e4130ab9f99b59f204c25": {
"balance": "0x1337000000000000000000"},
"0x350032e948159e9d11bec9f4ad8ed88b4f100a03": {
"balance": "0x2337000000000000000000"}

Step 4 — Initialise local private node

geth --identity “LocalTestNode” --rpc --rpcport 8080 --rpccorsdomain “*” --datadir ~/mychain/data/ --port 30303 --nodiscover --rpcapi db,eth,net,web3,personal --networkid 1999 --maxpeers 0 --verbosity 6 init ~/mychain/CustomGenesis.json 2>> ~/mychain/logs/00.log

Step 5 — Start the node with JavaScript console

geth --identity “LocalTestNode” --rpc --rpcport 8080 --rpccorsdomain “*” --datadir ~/mychain/data/ --port 30303 --nodiscover --rpcapi db,eth,net,web3,personal --networkid 1999 --maxpeers 0 console

Step 6 — Check account balances (from JS console)

> eth.getBalance(eth.accounts[1]);

Step 7 — Check account balances (from Mist)

/Applications/ --rpc http://localhost:8080 --swarmurl “null”
Mist Wallet/Client with accounts showing initial balances



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store