How to setup your own private Ethereum network — Part 2

How to setup your own private Ethereum network — Part 2
In this article we’ll look at connecting to other peers without using boot nodes. A continuation of
Nodes connect to other peers via a static configuration file in the data directory of each node.
The private network is now made up of 3 nodes (without boot nodes) comprising of
- One Miner Node
- Two Peer nodes
Each node is configured using a static json file containing the details of other peers, so you need to find the enode URLs of all the nodes.
- Find the enode url of each node
- Create a static json file detailing the other peers
- Start the nodes
- Attach to each node and find the peers count
Step 1: Find the enode url of each node
When you start up an Ethereum node it details an enode url. The enode URL is of the format enode://publickey@ip:port. Make a list of enode URLs of the 3 nodes.
Step 2: Create a static json file detailing the other peers
The contents of each static-nodes.json file in the data directory is the enode url of other peers
Step 3: Start all the nodes
Start the miner node and 2 nodes with RPC APIs exposed
geth — datadir data/node3 — nodiscover — syncmode “full” -verbosity 6 — ipcdisable — port 3033 — networkid 9876 — gasprice 1 -unlock ‘0x219789a1844eF774Da4810e0437A105989b76332’ — password password.txt -mine
geth — datadir data/node1 — nodiscover — syncmode ‘full’ -verbosity 6 — ipcdisable — port 3031 — rpc — rpcaddr ‘localhost’ — rpcport 8101 — rpcapi admin,debug,eth,miner,net,personal,shh,txpool,web3 — networkid 9876
geth — datadir data/node2 — nodiscover — syncmode ‘full’ -verbosity 6 — ipcdisable — port 3032 — rpc — rpcaddr ‘localhost’ — rpcport 8102 — rpcapi admin,debug,eth,miner,net,personal,shh,txpool,web3 — networkid 9876
Step 4: Attach to each node and find the peer count
Attach to each node and check the peer count (2).
This article demonstrates creating a private Ethereum network using static configuration file to talk to peer nodes.
Published at Wed, 05 Feb 2020 12:58:05 +0000
{flickr|100|campaign}
