Search code examples
privateethereum

Private Ethereum maxpeer


Steps

  1. I have created a private node and use --maxpeer of 1 (network id =1223123341)
  2. Add user's X node by admin.addPeer(enode of user X) successfully. (same network id and genesis)

Base on my understanding that maxpeer will limit the node that can conect from the network to 1 node only(user's X node)

Question - if user's X node update his --maxpeer to 5 and give the network id and genesis file to other nodes, does it means there can now 5 who can conect to this network? Who control the maxpeer in a private network (e.g. network id =1223123341)


Solution

  • The --maxpeers option controls the number of peers for that particular instance. So, yes, if node 1 has --maxpeers=1 and node 2 has --maxpeers=5, you will not be limited to just 2 nodes in the network. Nodes don't all need to know about every other node either, so node 2 may be peers with nodes 3-7 and not know anything about node 1 (in other words, with the example you provided, the total number of nodes could be even more than 5).

    AFAIK, there is no configuration to limit the total number of nodes in a network, and I don't see what you would want one. You are given enough control at the node level.