1. When I'm in a private network, am I interacting with the main network blockchain, or a separate (private) one?
2. No matter what random, super-long
networkid I use, I always end up having peers. I want to end up having a private network with only certain peers (to whom I will have given the needed login info in advance) -- how do I achieve that?
I've looked into the references below, but couldn't answer these questions. I'm sure I'm missing something.
Thanks for your help!
References:
https://github.com/ethereum/wiki/wiki/White-Paperhttps://github.com/ethereum/go-ethereum/wiki/Setting-up-private-network-or-local-clusterhttps://github.com/ethereum/go-ethereum/wiki/Connecting-to-the-network
Comments
do not seem to matter much in practice.
However I think you could try running geth
with
-bootnodes (list of enodes) -maxpeers (the number of enodes)
to limit the peers to the ones in the list
Say you have client A on networkid 3098420984.
If you launch client B with the "bootnodes" flag set to the enode of client A, and the "maxpeers" flag set to 1, then, oddly enough, client A is not going to be your one peer. Instead it's going to be a random "visitor".
What you have to do is just launch client B (with or without the bootnodes flag, it doesn't matter), and do admin.addPeer(enode of client A) on the JS console to explicitly add client A as your peer.
But that still leaves you with random visitors on the network, namely the other random peers of client B.
I can't figure out what I'm missing here.
The behaviour you describe is strange indeed.
I tried my own suggestion, with nodes A and B, with B having A as the bootnode and maxpeers=1,
andwhile it does not keep away visitors at A, it did seem to restrict B's connections solely to A.
Also, when I have kept up a private network for a while, the visitors
seem to have vanished. Of course, I'd have to poll admin.peers() all the
time to verify if that is really the case.
Looking at the code of go-ethereum/eth/backend.go, there
are 3 hardcoded enodes, I guess that's where the visitors drop in.
(edit:) well, no, looking closer at the code, if you have your own bootnodes set
in command line, it should not contact those "default bootnodes".
So the visitors are a "feature" of something else...
And thank you all for the replies!