Tutorial Overview
This tutorial guides you through creating a private Ethereum blockchain on Windows. You will install the required tools, create a genesis block, initialize a local chain, start a private network, create accounts and mine development Ether.
Private blockchain
Create a local Ethereum network for learning, testing and development.
Custom genesis block
Define the initial rules and settings for your private network.
Geth console
Run and control your Ethereum node from the command line.
Local mining
Mine private-chain Ether for experiments and testing.
Prerequisites Overview
Before setting up your private Ethereum blockchain, prepare the following components.
Node.js
JavaScript runtime used by Ethereum development tools and Web3 workflows.
Geth
Go Ethereum client used to run Ethereum nodes and private networks.
Environment Setup
Configure PATH variables so tools can be used easily from the command line.
Wallet Tools
Use a wallet interface, such as MetaMask or a legacy wallet, to interact with the network.
Installing Node.js and Development Tools
Option 1: Direct Download
Download Node.js directly from the official Node.js website.
Option 2: Using Chocolatey
Run PowerShell as Administrator and execute these commands.
Set-ExecutionPolicy Bypass
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install visualstudiocode -y
choco install git -y
choco install nodejs -y
Wallet Tools
The original tutorial uses Ethereum Mist Wallet. For modern learning, you may use a current wallet such as MetaMask to interact with a private network. If you are following the original Windows 10 steps exactly, you can keep the legacy wallet section as a historical reference.
Legacy Ethereum Wallet Setup
- Download the Ethereum Wallet release package.
- Create the folder C:\Program Files\Ethereum.
- Extract the wallet files to the folder.
Installing Geth
What is Geth?
Geth stands for Go Ethereum. It is the Ethereum client used in this tutorial to run the node, initialize the chain, open the console and mine blocks on your private network.
Installation Steps
- Download and install Geth for Windows.
- Use the default installation folder unless you have a specific reason to change it.
- Confirm the expected installation path.
C:\Program Files\Geth
Setting Up Environment Variables
Why Set PATH Variables?
Adding tools to your system PATH allows you to run commands from any command prompt location.
Steps to Configure
- Right-click This PC and choose Properties.
- Click Advanced system settings.
- Click Environment Variables.
- Select Path under System Variables.
- Click Edit and add the required folders.
C:\Program Files\Ethereum-Wallet
C:\Program Files\Geth
Understanding the Genesis Block
What is a Genesis Block?
The genesis block is the first block in a blockchain network. It acts as the foundation for all later blocks and defines the starting rules of the private network.
Block #0
The first block is always numbered zero.
No Parent
It has no previous block to reference.
Network Configuration
It defines the rules and parameters for the private chain.
JSON Format
The configuration is written as a JSON file.
What You Configure
- Network ID and chain configuration.
- Mining difficulty and gas limits.
- Initial account allocations.
- Consensus and block parameters.
Genesis Block Parameters Explained
chainId
Protects against replay attacks by making transactions unique to this network.
homesteadBlock
Defines which protocol rules are active from the genesis block.
difficulty
Controls mining difficulty. Lower values make mining faster for testing.
gasLimit
Sets the maximum gas allowed per block.
nonce
A proof-of-work related value used in the block header.
parentHash
All zeros in the genesis block because there is no previous block.
Creating the Genesis Block
Step 1: Create the JSON File
Create a file named 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 myGenesis.json in the same working folder you will use for Geth.
Initialize the Genesis Block
Run the Initialization Command
geth init myGenesis.json
What Happens
- Geth reads the genesis configuration.
- It creates the blockchain database.
- It sets up the initial network parameters.
- It creates the Ethereum folder structure.
C:\Users\[username]\AppData\Roaming\Ethereum
Starting Your Private Network
Launch the Network
geth --networkid=5 console
Command Breakdown
- geth: Runs the Go Ethereum client.
- --networkid=5: Sets a private network ID.
- console: Opens the interactive JavaScript console.
Launch Wallet Interface
- Start the wallet application or connect a modern wallet to your private network.
- Make sure Geth is still running in the background.
- Confirm the wallet shows the private network and starts from the genesis block.
Creating Your First Account
Method 1: Using Wallet Interface
- Open your wallet tool.
- Navigate to the account or wallet section.
- Create a new account.
- Set a strong password and keep it safely.
Method 2: Using Geth Console
geth account new
What You Get
- Account address: Unique Ethereum-style address.
- Private key: Stored encrypted in your keystore.
- Initial balance: Zero ETH until you mine or allocate funds.
Mining Your First Blocks
Start the Mining Process
miner.start(1)
What This Command Does
- miner.start() begins mining.
- 1 uses one CPU thread.
- New blocks are created on the private network.
- Mining rewards are assigned to the coinbase account.
Monitor Your Progress
- Watch the console for mining messages.
- Check whether the wallet balance increases.
- Observe the block number increasing.
Stop Mining
miner.stop()
You may also press Ctrl + C in the console when appropriate.
Conclusion and Next Steps
What You Have Accomplished
Installed tools
Prepared Node.js, Geth and supporting development tools.
Created genesis block
Defined the starting rules for your private Ethereum blockchain.
Started private network
Launched Geth with a private network ID and console access.
Mined blocks
Created accounts and mined local Ether for development use.
What to Explore Next
- Deploy smart contracts to your private network.
- Create multiple accounts and transfer Ether.
- Experiment with different network and mining parameters.
- Connect multiple nodes to form a private network.
- Build and test DApps on your private chain.