Setting Up Private Ethereum Blockchain

Windows 10 Tutorial

A comprehensive guide to creating your own private Ethereum network

What You'll Learn:

  • Install required prerequisites
  • Create a genesis block
  • Start your private network
  • Create accounts and mine Ether

Prerequisites Overview

Before setting up your private Ethereum blockchain, you need to install the following components:

🟢 Node.js

JavaScript runtime environment required for Ethereum development tools and web3 interactions

⚡ Geth

Go Ethereum client - the core component for running Ethereum nodes and mining

🔧 Environment Setup

Configure system PATH variables for easy command-line access to tools

🌐 Modern Wallets

Use MetaMask or other modern wallets to interact with your private network

Installing Node.js

Option 1: Direct Download

Download from: https://nodejs.org/en/download/

Option 2: Using Chocolatey (Recommended)

Run PowerShell as Administrator and execute these commands:

  1. Set execution policy:
    Set-ExecutionPolicy Bypass
  2. Install Chocolatey:
    iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  3. Install Visual Studio Code:
    choco install visualstudiocode -y
  4. Install Git:
    choco install git -y
  5. Install Node.js:
    choco install nodejs -y

Installing Ethereum Mist Wallet

Download and Setup

  1. Visit: https://github.com/ethereum/mist/releases
  2. Download: Ethereum-Wallet-win64-0-11-0.zip
  3. Create folder: C:\Program Files\Ethereum
  4. Extract the zip files to this folder
💡 Tip: The Ethereum Mist Wallet provides a user-friendly graphical interface for managing your blockchain accounts and viewing transactions.

Expected Installation Path

C:\Program Files\Ethereum-Wallet

Installing Geth (Go Ethereum)

What is Geth?

Geth stands for "Go Ethereum" - it's the official Go implementation of the Ethereum client.

Installation Steps

  1. Visit: https://geth.ethereum.org/downloads/
  2. Select Geth 1.8.12 for Windows
  3. Download and install the package

Expected Installation Path

C:\Program Files\Geth
🔧 Key Function: Geth is the core component that will run your Ethereum node, mine blocks, and execute smart contracts.

Setting Up Environment Variables

Why Set PATH Variables?

Adding tools to your system PATH allows you to run them from any command prompt location.

Steps to Configure

  1. Right-click "This PC" → Properties
  2. Click "Advanced system settings"
  3. Click "Environment Variables"
  4. Select "Path" under System Variables
  5. Click "Edit" and add these paths:

Paths to Add

C:\Program Files\Ethereum-Wallet
C:\Program Files\Geth
⚠️ Important: Make sure to add both paths to your system's PATH variable for the tools to work from command line.

Understanding the Genesis Block

What is a Genesis Block?

The Genesis Block is the very first block in a blockchain network. It serves as the foundation for all subsequent blocks.

Key Characteristics

💡 Think of it as: The "constitution" of your blockchain network - it establishes the fundamental rules and parameters that all network participants must follow.

What We'll Configure

Genesis Block Parameters Explained

🔗 chainId

Protects against replay attacks by ensuring transactions are unique to this network.

🏠 homesteadBlock

Ethereum's second major release. Value 0 means using this version from genesis.

⛏️ difficulty

Mining difficulty in hex (0x20000 = 131,072). Lower values make mining faster for testing.

⛽ gasLimit

Maximum gas allowed per block (0x2fefd8 = 3,141,592). High values avoid limits during testing.

🎯 nonce

Cryptographic proof-of-work value. Shows computational effort was expended.

💰 coinbase

Address receiving mining rewards. Can be anything in genesis block.

⏰ timestamp

Unix timestamp of block creation. Helps maintain consistent block timing.

🔗 parentHash

Hash of previous block. Always zeros for genesis block since it has no parent.

Creating the Genesis Block

Step 1: Create the JSON File

Download the genesis file or create myGenesis.json:

{
  "config": {
    "chainId": 45,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 12
  },
  "alloc": {},
  "coinbase": "0x0000000000000000000000000000000000000000",
  "difficulty": "0x20000",
  "extraData": "",
  "gasLimit": "0x2fefd8",
  "nonce": "0x0000000000000042",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp": "0x00"
}

Step 2: Save the File

Save as myGenesis.json in the same folder as Geth

Initialize the Genesis Block

Run the Initialization Command

geth init myGenesis.json

What Happens

📁 Created Folder: After successful initialization, you'll find an "Ethereum" folder at:
C:\Users\[username]\AppData\Roaming\Ethereum
⚠️ Troubleshooting: If you encounter errors, delete the Ethereum folder (or just the chaindata subfolder) and re-run the init command.

Starting Your Private Network

Launch the Network

geth --networkid=5 console

Command Breakdown

🌐 Network ID Guidelines:
• ID 1 = Ethereum Mainnet (avoid!)
• Use any other number for your private network
• All nodes must use the same network ID to connect

What You'll See

The console will display initialization messages and present a JavaScript prompt where you can interact with your blockchain.

Launching Ethereum Wallet

Start the Wallet Application

  1. Navigate to your Ethereum Wallet installation folder
  2. Run Ethereum Wallet.exe
  3. The wallet will automatically detect your running private network
  4. Wait for the interface to fully load
🔄 Synchronization: The wallet needs to sync with your private blockchain. Since you just started it, this should be very quick.

What You'll See

⚠️ Remember: Keep your geth console running in the background while using the wallet!

Creating Your First Account

Method 1: Using Ethereum Wallet

  1. Open the Ethereum Wallet application
  2. Navigate to the "Wallets" section
  3. Click "Add Account"
  4. Follow the prompts to create a new account
  5. Set a strong password and save it securely!

Method 2: Using Geth Console

geth account new
🔐 Security Note: Your account password is crucial! Without it, you cannot access your account or funds. Store it in a safe place.

What You Get

Mining Your First Blocks

Start the Mining Process

In your geth console, run:

miner.start(1)

What This Command Does

💰 Mining Rewards: Each block you mine will give you Ether rewards. Since you're on a private network with low difficulty, mining will be much faster than on the main Ethereum network.

Monitor Your Progress

Managing Mining & Next Steps

Stop Mining

When you want to stop mining, use either:

miner.stop()

Or press Ctrl+C in the console

🎉 Congratulations!

You've successfully set up your private Ethereum blockchain! Here's what you've accomplished:

What's Next?

🚀 You now have your own Ethereum blockchain running!
1 / 15