Private network questions

kostaskostas Member Posts: 16
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!



  • YarkoLYarkoL Member Posts: 9
    edited May 2015
    I've noticed this too, although these "visitors"
    do not seem to matter much in practice.

    However I think you could try running geth
    -bootnodes (list of enodes) -maxpeers (the number of enodes)
    to limit the peers to the ones in the list
  • kostaskostas Member Posts: 16
    edited May 2015
    @YarkoL: that does not seem to work unfortunately.

    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.
  • TalkingAntColonyTalkingAntColony Member Posts: 9
    You could also try setting the protocol version to something. For unique user login functionality you would need to program this feature into the clients, or do that at the network level with something like a VPN and virtual firewalls. I'm not sure what your use case is but you might look into project Eris, which is an Ethereum fork tailored to private networks.
  • YarkoLYarkoL Member Posts: 9
    edited May 2015

    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...

  • tgerringtgerring Member Posts: 28 ✭✭
    To use a different networkid, you'll need to use a chain specific to that network. You can override this by specifying a --datadir when also using --networkid
  • kostaskostas Member Posts: 16
    @YarkoL: you are actually right. It turns out it just needs some time until the connection from B to A is established. Thank you for looking into it.

    And thank you all for the replies!
Sign In or Register to comment.