5

I'm currently trying to setup an ethereum private chain on AWS EC2 instances. Unfortunately, the nodes in this network fail to connect to each other over the ethereum P2P protocol.

My question is: what am I missing?

Here is a list of configuration patterns, which I tried and which did not work. Any hint what else I could try or how to fix one of these patterns?

basic structure of the network

  • three EC2 instances, each with a private and a public ip address
  • one instance (the bootnode) running the RCP server on port 8000, mining disabled, private --networkid, --nat "none", --port 30304
  • two instances (the mining nodes) with mining enabled, private --networkid, --nat "none", --port 30304
  • the three nodes belong to the same security group, traffic (tcp and udp) between nodes in this security group is unrestricted

doesn't work: use --bootnodes with private ip address of the bootnode

  • start the mining nodes with --bootnodes "enode://enode-of-bootnode@private-ip-of-bootnode:30304"
  • admin.peers replies [] on both mining nodes

doesn't work: use --bootnodes with public ip address of the bootnode

  • start the mining nodes with --bootnodes "enode://enode-of-bootnode@public-ip-of-bootnode:30304"
  • admin.peers replies [] on both mining nodes

doesn't work: addPeer() with private ip address of the bootnode

  • start the mining nodes without --bootnodes
  • admin.addPeer("enode://enode-of-bootnode@private-ip-of-bootnode:30304") on both mining nodes
  • admin.peers replies [] on both mining nodes

doesn't work: addPeer() with public ip address of the bootnode

  • start the mining nodes without --bootnodes
  • admin.addPeer("enode://enode-of-bootnode@public-ip-of-bootnode:30304") on both mining nodes
  • admin.peers replies [] on both mining nodes

doesn't work: explicitly add mining peers

  • start the mining nodes without --bootnodes and with --nodiscover
  • admin.addPeer("enode://enode-of-mining-0@private-ip-of-mining-0:30304") on mining 1
  • admin.addPeer("enode://enode-of-mining-1@private-ip-of-mining-1:30304") on mining 0
  • admin.peers replies [] on both mining nodes

Dito, if private-ip-of-mining-{0,1} is replaced wit public-ip-of-mining-{0,1}

0

1 Answer 1

2

Answering my own question, here's what finally worked in my case. See this GitHub Repo for more details. It provides ansible playbooks to provision and control a private ethereum network on Amazon EC2 nodes.

two mining nodes

I have 2 mining nodes with a private EC2 ip address running. They are started with (more details ...)

% geth --nodiscover --mine --port 30303 <more command line options>

Note that a mining node is started with --nodiscover.

The enode url of such a node is enode://<enode-id@<private-ip-address>:30303 where enode_is is what you get in the following command:

% geth --exec "admin.nodeInfo.id" <more options> console

a gateway node

I added a gateway node with statically configured minining nodes. The peers are configured in the file static-nodes.json in the data directory:

[
  "enode://<enode-id-1>@<private-ip-address-1>:30303",
  "enode://<enode-id-2>@<private-ip-address-2>:30303"
]

The gateway node is started with (more details ...)

%  geth --nodiscover --port 30303 <more command line options>

what I observe

  • the gateway node connects to each of the mining nodes as peer
  • the gateway node receives blocks mined by both the mining nodes

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