Building a Private Ethereum Chain on Windows and Connecting to the Mainnet

·

Installing Ethereum Client and Wallet

Download the Go-language version of the Ethereum client, Geth, from the official Go-Ethereum GitHub page. For this guide, we used geth-windows-amd64-1.8.11-dea1ce05.exe. Installation is straightforward—just run the executable.

Next, install the official Mist wallet from its GitHub repository. We opted for the portable version, Ethereum-Wallet-win64-0-10-0.zip. After extraction, launch the wallet by double-clicking Ethereum Wallet.exe.

Connecting Geth to the Ethereum Mainnet

Once Geth is installed, running it automatically connects to the mainnet and begins synchronizing all nodes. As of this writing, the synchronization requires downloading approximately 90GB of data, stored by default in C:\Users[YourUsername]\AppData\Roaming\Ethereum. This process can take over half a day. Since Mist is a full-node wallet, it also requires full synchronization.

👉 Learn more about optimizing Ethereum node synchronization

For detailed Mist wallet usage, refer to the Ethereum GUI Wallet Mist Tutorial. Note that Geth isn't mandatory if you're only using Mist, as the wallet syncs node data independently.

Setting Up a Private Ethereum Chain with Geth

Transactions on the Ethereum mainnet incur fees. With 1 ETH valued at $456, testing on the mainnet is impractical for most developers. Private chains offer a cost-free, faster alternative for development and learning, while replicating mainnet functionality.

Creating the Genesis Block Configuration

Navigate to your Geth installation directory (e.g., E:\Geth) and create a genesis.json file with the following content:

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

Initializing the Genesis Block

Open a command prompt and execute:

cd E:\Geth
geth --datadir data init genesis.json

Here, --datadir specifies the data storage directory (data), and init loads the genesis configuration.

Launching the Private Node

Start the node with:

geth --datadir data --networkid 1108 console

The --networkid flag sets the chain ID (1108; Ethereum mainnet uses 1). The console flag opens the JavaScript interactive console.

Essential Geth Commands

CommandDescription
eth.accountsLists all accounts
personal.newAccount()Creates a new account
eth.getBalance(eth.accounts[0])Checks account balance
miner.start()Starts mining
miner.stop()Stops mining

For advanced commands, see the Geth Command Reference.

👉 Explore advanced Ethereum development tools

Note: The first mining session may take longer while DAG files generate.

Linking Mist Wallet to the Private Chain

After setting up the private chain, launch Mist. It will automatically connect to your private chain (displayed as "private-net" in the top-right corner). Click Launch Application to access the wallet. You’ll see mined Ether (e.g., 2,155 ETH) in your accounts.

FAQs

Why use a private Ethereum chain?

How long does node synchronization take?

Can I interact with smart contracts on a private chain?

Yes, private chains fully support smart contracts, identical to the mainnet.

References