1

I am able to spin up as many nodes on the same machine as I would like and have them peered in the same private blockchain network. But when I try to use addPeer() on a separate EC2 instance, I am having no success.

One of the nodes is on block 16000 and the other is on block 50, and I want to sync the 50 block node to the 16000 block node.

Security Groups are set up appropriately, what are some other possible reasons for my failure in using addPeer()?

0

Common Problems With Connectivity

Sometimes you just can't get connected. The most common reasons are as follows:

  • Your local time might be incorrect. An accurate clock is required to participate in the Ethereum network. Check your OS for how to resync your clock (example sudo ntpdate -s time.nist.gov) because even 12 seconds too fast can lead to 0 peers.
  • Some firewall configurations can prevent UDP traffic from flowing. You can use the static nodes feature or admin.addPeer() on the console to configure connections by hand.

In my opinion, the most likely reason is connectivity issue, where the firewall of the EC2 is blocking the traffic to go out or in. Run the following commands:

(Machine 1)

> admin.peers
[{
  ID: 'a4de274d3a159e10c2c9a68c326511236381b84c9ec52e72ad732eb0b2b1a2277938f78593cdbe734e6002bf23114d434a085d260514ab336d4acdc312db671b',
  Name: 'Geth/v0.9.14/linux/go1.4.2',
  Caps: 'eth/60',
  RemoteAddress: '5.9.150.40:30301',
  LocalAddress: '192.168.0.28:39219'
}, {
...

(Machine 2)

> admin.nodeInfo
{
  Name: 'Geth/v0.9.14/darwin/go1.4.2',
  NodeUrl: 'enode://3414c01c19aa75a34f2dbd2f8d0898dc79d6b219ad77f8155abf1a287ce2ba60f14998a3a98c0cf14915eabfdacf914a92b27a01769de18fa2d049dbf4c17694@[::]:30303',
  NodeID: '3414c01c19aa75a34f2dbd2f8d0898dc79d6b219ad77f8155abf1a287ce2ba60f14998a3a98c0cf14915eabfdacf914a92b27a01769de18fa2d049dbf4c17694',
  IP: '::',
  DiscPort: 30303,
  TCPPort: 30303,
  Td: '2044952618444',
  ListenAddr: '[::]:30303'
}

And check if the ports used by Geth to connect your peers are correctly open.

0

Most of the time the issue is with PORT that are being used for peers on same machine. Usually by default it is 30303.

Crosscheck the port being used by running > admin.nodeInfo In case they are same; that's the problem and you should start node with a different port.

1
  • I am using port 30303 for both machines and they wouldn't peer when 30303 was open, but when I allow all traffic they can communicate. Obviously I don't want to allow all traffic in a production scenario – 0TTT0 Mar 6 '19 at 18:54

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.