1

This question already has an answer here:

I have customized the go-ethereum code a bit, compiled and running on 3 nodes (1 miner 1 bootnode 1 fullnode) in my private-net. I just wondered that why should I initialize genesis.json on each node? Otherwise nodes did not found each other. Also, in the beginning, does a fresh node start to synchronize from genesis block or sth else? Here, I just want to understand how the ethereum node discovery works for a node alone? or do they know some nodes be default?

marked as duplicate by Ismael, shane, flygoing, Briomkez, Aniket Dec 6 '18 at 6:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • No, its not. Mostly protocols mentioned there, in the link. Here, basically the bootnodes and their correct usage, functions is the problem for me. – gomozor Dec 3 '18 at 21:25
0

Bootnodes are (can be) hardcoded into the code base.

Look here > https://github.com/ethereum/go-ethereum/blob/master/params/bootnodes.go

When you start the node (geth) normally it goes and gets bootnode endoes from here ^ and tries to connect to them.

If you are running your own network you can modify them like I did here for a project that forked ethereum.

https://github.com/AtlasWork/go-atlas/blob/master/params/bootnodes.go

I replaced the ethereum boot nodes with my own bootnodes so every time my geth was run it looked for my networks nodes not the Ethereum nodes, this way your nodes should all be finding each other on your private network.

  • Could you have used --bootnode parameter (instead of modifying goth source) ? – Shamit Verma Dec 3 '18 at 17:24
  • 1
    yes, but users I needed testing at the start were barely capable of finding a terminal never mind issuing commands into it so hard coding them ensured each time the binary was run it would always search out two nodes I know would always be running. – Lismore Dec 3 '18 at 17:28
  • Thanks a lot. This is what I was looking for. So, I don't have to add --bootnode="enode://..." each time I started each node with my own geth version. – gomozor Dec 3 '18 at 21:18
  • Shamit, yes you can do it but what if you have 50 nodes and stops/starts constantly (think power outages). Hard coding is more practical. – gomozor Dec 3 '18 at 21:21
0

there a some steps to process when you start a node: 1. load bootstrap nodes into router; 2. load seeds from database into router by randomly; and then, node tries to connect these nodes. so , if you have 3 nodes, you could make one as bootstrap which others could connect to according to modify there configuration file.

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