2

I am trying to add a peer. I created two nodes using the following commands on geth.The boot node creation command is

geth --datadir ./chaindata3 --port 30304 --nodiscover --networkid 12 --rpc --rpcport "8546" --rpccorsdomain "*" --ipcdisable console

The other node creation command

geth --datadir ./chaindata4 --port 30307 --nodiscover --networkid 12 --ipcdisable --bootnodes "enode://7143091f47a3d4aae216ce781e28b53c1faa9daa08bbeaa9a01adbd9b3933fb3b83acff00a375bf0a4b30b1135b7aabef422c28c60279de34e9399a3d91d7c88@127.0.0.1:30304" console

When i type the command admin.peers it returns an empty list. Can someone please help me with this?

cbhangale
  • 87
  • 2
  • 8

2 Answers2

1

Setup actual boot node, don't treat base node (first full node as boot node).

bootnode -genkey boot.key

bootnode -addr localhost:port -nodekey boot.key  -verbosity 9

Start other nodes pointing the boot node

ex:

geth --datadir "data" --syncmode "full" --rpcport port --rpc --rpcaddr "localhost"  --port port --rpccorsdomain "*" --rpcapi "personal,eth,net,db,web3,txpool,miner" --bootnodes "enode://************@localhost:port" --networkid 100  --ipcdisable --mine console

Sorry couldn't format:that's why added new answer

Diwa
  • 73
  • 1
  • 7
  • The first two commands of setting up a bootnode on which terminal should I type it. – cbhangale Jul 11 '18 at 07:17
  • It is just as similar to other nodes, but it only acts as a message broker. In one terminal run the boot node command. In another terminal initialize and start the nodes, with verbose enabled you can able to see the logs how node communicate in the boot node terminal. – Diwa Jul 11 '18 at 07:29
  • But bootnode is not a command right It shows no command found. – cbhangale Jul 11 '18 at 08:45
0

Both the nodes should be initiated with the same genesis. Starting Geth directly without initializing it with the genesis creates a block with default networkId and consensus algorithm which will not be the same as the base genesis.

Diwa
  • 73
  • 1
  • 7
  • Actually I did that but whenever i am using rpc port im facing a problem without rpc it just works fine and shows peers – cbhangale Jul 11 '18 at 05:48
  • Setup actual boot node, don't treat base node (first full node as boot node). **bootnode -genkey boot.key** **bootnode -addr localhost:port -nodekey boot.key -verbosity 9** Start other nodes pointing the boot node **ex:** geth --datadir "data" --syncmode "full" --rpcport port --rpc --rpcaddr "localhost" --port port --rpccorsdomain "*" --rpcapi "personal,eth,net,db,web3,txpool,miner" --bootnodes "enode://************@localhost:port" --networkid 100 --ipcdisable --mine console _Sorry couldn't format_ – Diwa Jul 11 '18 at 06:56