1

I'm new to Ethereum so please pardon my lack of knowledge on the field. For that reason my question might be too broad as well.

I'm working on a project that visualises a topology graph of the whole network. Nodes on the graph are Ethereum nodes and edges represent the connection between 2 nodes, i.e if 2 nodes are peers.

To do that I'm intending to implement my own ethereum client based on the go-ethereum client. To do that I've forked a new repo based on the original geth repo. My ethereum client would ask other nodes for their peers. Once it receives the list of peers, it then asks for those peers' peers, and so on, until it covers the whole network.

I'm looking at the source code of geth and it's quite overwhelming. I've spent some time inspecting the code and it seems like the critical functions that I should look at are resolve, lookUpPubKey, findNode in p2p/discover/v4_udp.go, and resolve and the loop in p2p/dial.go. Those functions seem to cover how nodes can be found.

I'm struggling to find the code that asks nodes for their peers. Which portion of the code should I look at for that functionality? Also which portion of the code should I look at in general to gain to implement this project? Do you have any suggestions on where I should write my code? I'm thinking of starting with the big loop in p2p/dial.go.

I'm sorry if that was a lot of vague questions, and I'd really appreciate any help received.

Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.