17

I'm running an Ethereum node using geth and it can't find any peers. I've already tried the time sync command suggested on the wiki. My bandwidth is good.

1
  • I am getting peerCount as zero even after trying this admin.addPeer("enode:ip:portnumb").This is giving true when I executed it in cmd prompt but net.peerCount is 0 > admin.addPeer("[email protected]:30340?discport=0") true > web3.net.peerCount 0 > net.peerCount 0 >
    – Akshatha_G
    Jul 8, 2016 at 12:40

3 Answers 3

15

By default, geth uses port 30303 for connection to other nodes. You may need to modify your firewall to allow traffic over this port.

You can check your peer count as well as getting a list of peers when attached to the javascript console (geth attach).

instance: Geth/v1.3.2/darwin/go1.5.1
datadir: /Users/home/Library/Ethereum
coinbase: 0xd3cda913deb6f67967b99d67acdfa1712c293601
at block: 864339 (Sun, 17 Jan 2016 16:00:07 MST)
modules: admin:1.0 db:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 shh:1.0 txpool:1.0 web3:1.0
> net.peerCount
5
> admin.peers
[{
    caps: ["eth/61", "eth/62"],
    id: "03743aa20db17dc12d2e355f32b75964653408eaab2c6e0fad7b2600fef49b3c2ec938d436fc48e86582d732d8eb64935edddee7d5c9caf726261add05cf46fe",
    name: "Geth/v1.2.2/linux/go1.5",
    network: {
      localAddress: "10.0.1.48:30303",
      remoteAddress: "87.106.88.35:35646"
    },
    protocols: {
      eth: {
        difficulty: 2283869820384174300,
        head: "d0d57a2f8fea1c834ce277d031727fecc1baf617b69e4d169f87f7e2d56f04c6",
        version: 62
      }
    },
    ...
]

If you have a healthy geth node running somewhere else you can try bootstrapping your peer connection with the admin.addPeer function. The function should be called with an enode address in the format of admin.addPeer("enode://<id>@<ip_address>:<port>") where the ip_address and port values come from the remoteAddress portion of the peer information and the id is the big long hex string under the id key for the peer info. For the peer above, this would be:

 admin.addPeer("enode://03743aa20db17dc12d2e355f32b75964653408eaab2c6e0fad7b2600fef49b3c2ec938d436fc48e86582d732d8e[email protected]:35646")

This can be useful if you somehow lose connection to all of your peers through some non-network based mechanism. However, not having any peers is likely to be a networking issue and manually adding peers will potentially only server as a stop-gap solution at best.

1
  • I've also noticed that an original Raspberry Pi struggles. I suspect because it's so slow it doesn't respond in a timely way and other peers don't want to sync with it. Jan 22, 2016 at 13:40
4

Good you checked the time, but the most common reason for failing to find peers is firewall and network configuration. If a firewall is running, try disabling it.

3

I use this script if my node is acting odd ... obviously you need to modify it to suite your situation...

#!/usr/bin/env bash
trap "exit" INT

LOCALIP=(192.168.10.11)   (put your machines IP here)

IP=$(dig +short myip.opendns.com @resolver1.opendns.com)

echo "Local IP: $LOCALIP"
echo "Public IP: $IP"

echo "Starting eth"
eth --bootstrap --peers 50 --remote 52.16.188.185:30303 --mining off  --public-ip $IP --listen-ip $LOCALIP -- listen 30303

Warning - this is not something you should use as a default .. it will burn up internet bandwidth like crazy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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