Ethereum Node Peering – Why Are There No Peers?

go-ethereumNetworkpeerssynchronization

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.

Best Answer

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://03743aa20db17dc12d2e355f32b75964653408eaab2c6e0fad7b2600fef49b3c2ec938d436fc48e86582d732d8eb64935edddee7d5c9caf726261add05cf46fe@87.106.88.35: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.