I am trying to add two peers in ethereum privatenet but not adding its shows peer count is 0. I run the below commands


geth --identity "Privatenet1" --datadir=./Privatenet1 --networkid 1995 --nodiscover --maxpeers=2 --mine --syncmode fast --port 30303 --rpc --rpcport 8545 --rpcaddr --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" --nat "any"


geth --identity "Privatenet2" --datadir=./Privatenet2 --networkid 1995 --nodiscover --maxpeers 2 --mine --syncmode fast --port 30305 --rpc --rpcport 8540 --rpcaddr --rpccorsdomain "*" --rpcapi "eth,net,web3,personal,miner" --nat "any"

my genesis.json file for both nodes is given bellow:

   "config": {
      "chainId": 1995,
      "homesteadBlock": 0,
      "eip155Block": 0,
      "eip158Block": 0,
      "byzantiumBlock": 0
   "difficulty": "400",
   "gasLimit": "2000000",
   "alloc": {
      "a620c4ffe82b2d2a4f3a9efc9d8c88f960696464": { 
          "balance": "100000000000000000000000" 
      "db93c17c1b206ad4925e72896888012ea56a6005": { 
          "balance": "120000000000000000000000" 

then I tried to add node2 peer in node1 as below:


enode is validated and showing true but peer count is still 0 and admin.peers is null. I researched on it and I allowed all ports using sudo ufw allow portnumber and telnet 30303 throwing Error like Connection closed by foreign host. is it firewall blocks my connection? can anyone please tell me the solution to resolve this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.