$ cat setting-up-private-blockchain-network-using-geth.md
Setting Up a Private Blockchain Network Using Geth
2026-07-23 · Amrit Bhusal · General

Introduction
Blockchain technology is revolutionizing various industries by providing a decentralized, transparent, and immutable ledger. While public blockchains like Bitcoin and Ethereum are open to anyone, private blockchains offer more control and security for businesses and organizations. In this guide, we will walk through the step-by-step process of setting up a private blockchain network using Geth (Go Ethereum) on a single device.
What is a Private Blockchain?
A private blockchain is a permissioned network where access is restricted to specific participants. Unlike public blockchains, where anyone can join and validate transactions, private blockchains operate under the control of an organization or a group of entities. Some key characteristics include:
- Access Control: Only authorized participants can read, write, or validate transactions.
- High Performance: Due to fewer participants, transactions are faster.
- Consensus Mechanisms: Uses consensus algorithms like Proof of Authority (PoA) instead of Proof of Work (PoW).
- Examples: Hyperledger Fabric, Corda, and Quorum.
Now, let's dive into the process of setting up a private blockchain network using Geth.
Step-by-Step Guide to Setting Up a Private Blockchain
Step 1: Install Geth
Geth is the official Go implementation of the Ethereum protocol. To install it, visit the official Geth website and download the appropriate version for your operating system.
After installation, verify the installation by running:
geth version
Step 2: Create a Private Blockchain Network Folder
Create a directory on your device to store blockchain data and open it in Visual Studio Code (or any text editor/terminal of your choice). Run the following commands in your terminal:
mkdir private-blockchain
cd private-blockchain
mkdir node1 node2
Next, create a password.txt file in both node1 and node2 folders. This file will store the passwords for your accounts.
Step 3: Create Ethereum Accounts for Nodes
Navigate to the node1 folder and create an Ethereum account:
cd node1
geth --datadir "./data" account new
You will be prompted to enter a password. Store this password in password.txt.
Repeat the same process for node2:
cd ../node2
geth --datadir "./data" account new
Make sure to note down the generated account addresses as they will be required later.
Step 4: Generate a Genesis Block
The genesis block is the first block of the blockchain. Open a new terminal and run:
puppeth
This will prompt you to enter a name for your blockchain network (e.g., privateblockchain).
You will then see a menu with options. Select:
- Configure new genesis
- Create new genesis from scratch
- Choose Clique (Proof-of-Authority) as the consensus mechanism (since PoW is unnecessary for a private blockchain).
- Set block time (e.g., 5 seconds).
- Provide the node address of one of the accounts created earlier.
- Prefund the node addresses with Ether.
- Confirm by typing
yesto pre-fund the precompile address. - Set a network ID (e.g.,
12345).
Once completed, a privateblockchain.json file will be generated.
Step 5: Initialize Nodes with Genesis Block
Initialize both nodes with the generated genesis block:
For node1:
cd node1
geth --datadir "./data" init ../privateblockchain.json
For node2:
cd ../node2
geth --datadir "./data" init ../privateblockchain.json
This initializes the private blockchain for both nodes.
Step 6: Set Up a Bootnode
A bootnode helps in connecting different nodes within a private blockchain.
Generate a bootnode key:
bootnode -genkey bnode.key
Run the bootnode:
bootnode -nodekey "./bnode.key" -verbosity 7 -addr "127.0.0.1:30301"
Copy the generated enode address, which will be used in the next step.
Step 7: Start Blockchain Nodes
Now, start the blockchain nodes and connect them to the bootnode.
For node1:
geth --networkid 12345 --datadir "./data" --bootnodes enode://<YOUR_ENODE_KEY>@127.0.0.1:30301 --port 30303 --ipcdisable --syncmode full --rpc --allow-insecure-unlock --rpccorsdomain "*" --rpcport 8545 --unlock <NODE1_ADDRESS> --password password.txt --mine console
For node2 (use a different rpcport):
geth --networkid 12345 --datadir "./data" --bootnodes enode://<YOUR_ENODE_KEY>@127.0.0.1:30301 --port 30304 --ipcdisable --syncmode full --rpc --allow-insecure-unlock --rpccorsdomain "*" --rpcport 8546 --unlock <NODE2_ADDRESS> --password password.txt --mine console
Once both nodes are running, they will start mining and maintaining the blockchain.
Conclusion
Congratulations! You have successfully set up a private Ethereum blockchain using Geth. This blockchain can be used for secure enterprise applications, testing smart contracts, or learning blockchain development without the complexities of public networks.
Next Steps
- Deploy smart contracts on your private blockchain.
- Connect a front-end application using Web3.js or Ethers.js.
- Expand the network by adding more nodes.
If you found this guide useful, feel free to share it with others who might be interested in setting up their own blockchain! 🚀