0

I'm trying to understand the algorithms underlying the ethereum overlay network and how do the peers communicate between each other. By looking around I arrived finally to the RLPx and devp2p protocols' specification. In the former the "encrypted handshake" is explained, while in the latter the Hello message is explained. I cannot understand if they are the same thing with different names, or if they are different things.

According to the go ethereum (geth) source code (subdirectory p2p) the devp2p Hello message, is named handshakeMsg (the devp2p packet codes are defined in the file p2p/peer.go). In the file p2p/rlpx.go the function doProtoHandshake is defined and corresponds exactly to what is described as Hello in devp2p protocols specification. Therefore I can conclude that the whole RLPx handshake is performed in two phases: firstly, the "Encoding Handshake" and secondly the protohandshake which contains the exchange of the capabilities and is already "part" of the devp2p protocol. I'm wrong?

1

In case you don't know the role of DEVp2p and RLPx :

Though TCP provides a connection-oriented medium, ÐΞVp2p nodes communicate in terms of packets. RLPx provides facilities to send and receive packets

How nodes know each others?

I tried to catch articles to create own private network based on PoA. The flow after I had created nodes was:

  • Nodes will be in discovery node and play ping-pong game when first boot up. Read code here
  • Run find neighbors to find some friends.
  • Run package neighbor to say hey, make friend.
  • Save contact of that friend to table (based on leveldb) as peers.

That's it. The node got a list of peers (friends) to hangout tonight.

How to nodes talk to each others?

Node will create UPD connection with peers in table.

Do handshake.

Stream data.

Read code here

  • Hi, thank you for the answer, but my question was very specific. I want to know if the two handshakes are the same or not. I do know what are the roles of the protocols... – Briomkez Jul 27 '18 at 10:57

Your Answer

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

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