2

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)

roytags
  • 99
  • 6

2 Answers2

2

If you want to avoid 51% attacks, you should consider running permissioned chains. You can either do this by keeping your genesis block of the Proof-of-Work or -Stake network private, but you would have to share it with any participant in the network and you will not know if this can be leaked at some point. And if it does, there is no way to stop other users from participating.

Another option is to use Proof-of-Authority networks. Both Geth and Parity support that. This allows only strictly defined nodes to seal blocks and everyone else can just use the network, but not change the set of rules defined by the authorities.

Note: I work for Parity.

q9f
  • 11,293
  • 8
  • 57
  • 96
1

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.

Adam Kipnis
  • 10,175
  • 10
  • 35
  • 48
  • Thanks for your input. Does it mean base on my example above **network id =1223123341** can have more than 5 nodes? The idea is we are restricting the number of nodes that can join the network for now to avoid 51 percent attack as currently we have only 5 nodes (1 nodes per each user). We are avoiding that 1 user would create many nodes to tamper the data. – roytags Apr 20 '18 at 06:25