4

I'm currently running geth.

I have 4 nodes in my network and I'm willing to make them interact with each other.

On host-01, I've run:

geth --identity "Node1" --genesis /tmp/eth/genesis.json --rpc --rpcport \
    "8001" --rpccorsdomain "*" --datadir /tmp/eth/60/01/ --port "30301" \
    --nodiscover -ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" \
    -rpcapi "db,eth,net,web3" --autodag --networkid 4828 --nat \
    "any" console 2>> /tmp/eth/60/01.log

On host-02, I've copied the genesis.json file from host-01, and ran the same command, just changing the --identity argument.

Now I'm trying to make them talk to each other. I've obtained host-01 enode:

admin.nodeInfo.enode

this gave me a string like:

"enode://6380bf79e7900309ac71612835f...@[::]:30301?discport=0"

Then, on host-02, I've run in the console:

admin.addPeer("enode://6380bf79e7900309ac71612835f...@[::]:30301?discport=0")

The result is true, but when I run:

admin.peers

it shows me an empty list.

What am I missing?


Edit

Additional info: The hosts do see each other in the network (tested via ping) and the ports are up (tested via telnet), although the connection only keeps open for approximately 1 sec. Not sure if this is the problem.

  • Perhaps you could try adding the second node created from the first node that you created? – glider Mar 28 '16 at 18:45
  • The private network tutorial on the Geth github have got the ports as integers and not strings. – glider Mar 28 '16 at 18:49
5

Shame on me!

I've forgotten to change the network interface to reflect the actual IP address of the other node:

admin.addPeer("enode://6380bf79e7900309ac71612835f...@<HOST-02 IP HERE>:30301?discport=0")

Now works perfectly.

  • Yeah, but SE makes me wait 2 days before I can do so :/ – Henrique Barcelos Mar 28 '16 at 21:00

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.