Creating an Ethereum wallet and deploying a private blockchain is a foundational skill for developers exploring decentralized applications (dApps), smart contracts, and blockchain technology. This step-by-step guide walks you through setting up Geth, generating a wallet, launching a local test network, and connecting it to tools like MetaMask and Remix IDE — all essential for Ethereum development.
Whether you're building your first smart contract or testing dApp logic in isolation, a private Ethereum chain gives you full control without risking real funds. Let’s dive in.
Installing Geth and Setting Up the Environment
The first step in creating your private Ethereum network is installing Geth (Go Ethereum), the official Ethereum client written in Go. Geth enables you to run a full Ethereum node, interact with the network, deploy contracts, and mine blocks — even on a local test setup.
Step 1: Download and Install Geth
Visit the official Geth downloads page and select the stable version for your operating system. For Windows users, choose the 64-bit or 32-bit Geth & Tools package depending on your system architecture.
After downloading, extract the ZIP file to your preferred installation directory (e.g., C:\Ethereum\geth).
Step 2: Configure System Environment Variables
To run Geth from any command line window, add its path to your system's environment variables:
- Right-click This PC > Properties > Advanced System Settings
- Click Environment Variables
- Under System Variables, find
Path, click Edit, then New - Paste the full path to your extracted Geth folder
- Save changes
Open Command Prompt (Win + R, type cmd) and run:
geth versionIf you see version details, Geth is correctly installed.
Creating an Ethereum Account and Initializing the Private Chain
Now that Geth is ready, we’ll create a wallet account and configure a custom private blockchain using a genesis file.
Step 1: Set Up Project Directory
Create a new folder (e.g., gethaccount) with a subfolder named keystore. This will store your encrypted account keys.
In the main folder, open Command Prompt and run:
clef newaccount --keystore ./keystoreFollow the prompts:
- Confirm with
ok - Enter a strong password (at least 10 characters)
A new key file will appear in the keystore folder.
Step 2: Generate and Customize the Genesis File
Run:
geth --dev dumpgenesisThis outputs default genesis block data. Copy this into a new file called genesis.json.
Edit genesis.json to customize:
- Replace
"coinbase"with your generated account address - Under
"alloc", allocate initial ether:
"alloc": {
"your-account-address-here": {
"balance": "100000000000000000000"
}
}Create a password.txt file containing your account password (used later for unlocking).
Step 3: Initialize the Blockchain
Run:
geth --datadir . init .\genesis.jsonThis initializes the blockchain with your custom genesis configuration.
Step 4: Launch the Private Network
Create a start.txt file with the following startup command:
geth --datadir "." --dev --dev.period 2 --http --http.api eth,web3,net --http.corsdomain "http://remix.ethereum.org" --password password.txt --http.port 8888Save and rename it to start.cmd. Double-click to run — this starts your local Ethereum node on port 8888.
Attach to the console:
geth attach \\.\pipe\geth.ipcCheck your account and balance:
eth.accounts
eth.getBalance(eth.accounts[0]) / 1e18You should see your pre-funded balance.
Exporting Your Private Key Using Node.js
To import your account into MetaMask or other wallets, you need the private key. We’ll use Node.js and the keythereum library to extract it securely.
Step 1: Install Node.js
Download and install Node.js from the official site. After installation, verify with:
node -v
npm -vAdd Node’s installation path to your system environment variables as done with Geth.
Step 2: Extract the Private Key
Inside your keystore folder, create a JavaScript file (e.g., exportKey.js) with this code:
var keythereum = require('keythereum');
var datadir = './'; // Adjust path if needed
var address = 'your-account-address'; // Replace with actual address
var keyObject = keythereum.importFromFile(address, datadir);
var privateKey = keythereum.recover('your-password', keyObject);
console.log("Private Key:", privateKey.toString('hex'));Install the required package:
npm install keythereumRun the script:
node exportKey.jsYour private key will print in hexadecimal format. Store it securely — never share or commit to version control.
Connecting MetaMask to Your Local Chain
MetaMask lets you interact with Ethereum-compatible networks via browser extension. Here’s how to connect it to your private chain.
Step 1: Install MetaMask
Open Microsoft Edge (or Chrome), go to Extensions, and install MetaMask. Create a new wallet and securely back up your seed phrase.
⚠️ Do not connect to the mainnet — we’re working locally.
Step 2: Import Account Using Private Key
Click Import Account > Private Key, and paste the key obtained earlier.
Step 3: Add Custom Network
Click Networks > Add Network > Add a Network Manually:
- Network Name: Localhost 8888
- New RPC URL:
http://localhost:8888 - Chain ID:
1337(commonly used for local dev) - Currency Symbol: ETH
- Block Explorer URL: Leave blank
Save and switch to this network.
If your node is still running (start.cmd), you should now see your pre-allocated balance in MetaMask.
Deploying Smart Contracts via Remix IDE
With everything connected, test deployment using Remix IDE, a browser-based Solidity editor.
Step 1: Open Remix
Go to:
https://remix.ethereum.org (link removed per instructions)
Write or import a simple Solidity contract (e.g., a basic token or storage contract).
Step 2: Connect to Injected Provider (MetaMask)
In Remix:
- Go to the Deploy & Run Transactions tab
- Select Injected Provider - MetaMask
MetaMask will prompt you to connect your account. Confirm.
Step 3: Deploy and Interact
Click Deploy. You’ll see a transaction confirmation in MetaMask. After mining (instant on private chains), your contract appears under deployed contracts.
Interact with functions directly in Remix — perfect for testing logic before going live.
Frequently Asked Questions (FAQ)
Q: Why use a private Ethereum chain?
A: It allows safe, cost-free development and testing of smart contracts without affecting the mainnet or spending real ETH.
Q: Is it safe to export my private key?
A: Only do so in secure, offline environments. Never expose it online or in shared code repositories.
Q: What’s the difference between Geth and MetaMask?
A: Geth runs an Ethereum node and manages the blockchain; MetaMask is a wallet interface that interacts with nodes like Geth.
Q: Can I use this setup for team development?
A: Yes — share the same genesis.json and ensure all members initialize their data directory with it for consistency.
Q: How do I reset my private chain?
A: Delete the geth data folders (like chaindata, keystore) and re-run geth init with the genesis file.
Q: Why set CORS domain to Remix?
A: Cross-Origin Resource Sharing (CORS) allows Remix IDE (hosted externally) to communicate securely with your local Geth node.
Final Thoughts
You’ve now built a complete Ethereum development environment: created a wallet, launched a private blockchain, exported keys, connected MetaMask, and deployed contracts via Remix. This foundation empowers you to experiment freely with decentralized technologies.
As you advance, consider integrating tools like Truffle, Hardhat, or Foundry for more robust testing and automation. But for learning core concepts, this hands-on approach remains unmatched.
Core keywords naturally integrated throughout: Ethereum wallet, private blockchain, Geth, MetaMask, Remix IDE, smart contract deployment, Node.js, private key.