[Ethereum] the distinction between libp2p, devp2p and RLPx

devp2pipfslibp2prlpx

What is the distinction between libp2p and devp2p? Do they refer to the same thing? How are they related to RLPx?

In the libp2p whitepaper, dated Nov 2014, they appear to be the same thing:

libp2p (aka ÐΞVp2p) aims to provide a lightweight abstraction layer
that provides these low-level algorithms, protocols and services in a
transparent framework without predetermining the eventual
transmission-use-cases of the protocols.

In the Devcon 2 presentation "libp2p ❤ devp2p":

libp2p is the modular secure networking suite that powers IPFS….

and

devp2p is the secure networking suite that powers Ethereum….

I'm guessing the second link is more up-to-date and that the whole thing is evolving as I type. Perhaps the IPFS libp2p was born out of the Ethereum one linked above (or vice versa). Can anyone give summaries of libp2p and devp2p, including where they came from, what they are used for and what the main differences are, along with links to their official specifications?

Finally, how does RLPx fit in with devp2p? The docs describe it like this…

RLPx is a cryptographic peer-to-peer network and protocol suite which
provides a general-purpose transport and interface for applications to
communicate via a p2p network. RLPx is designed to meet the
requirements of decentralized applications and is used by Ethereum.

… which sounds like what I had imagined devp2p to be doing. Is there a high level description of what libp2p, devp2p and RLPx are and how they fit together?

Other links:

https://ethereum.gitbooks.io/frontier-guide/content/devp2p.html

https://github.com/libp2p/libp2p

https://github.com/ethereum/devp2p

RLP versions (Jul 16) https://ethereum.stackexchange.com/a/7221/820

Ethereum protocols mapped to OSI https://ethereum.stackexchange.com/a/9923/820

What underlying protocols are used to send packets between nodes, and how are messages encrypted?

Best Answer

LIBP2P is a protocol implementation toolset or library that allows you to build software for different P2P networks and scenarios.

DEVP2P and RLPx are presented in the Ethereum documentation as something separate, but in fact:

  • They are the same thing if you are talking about a protocol
  • They are different things if you are talking about message formats

The naming and conceptual model is confused and very poorly communicated. In my opinion the entire P2P layer of Ethereum could really use a lot of clarification:

  • The RLPx wire protocol requires that each 'packet' specify its 'protocol type,' a ushort (unsigned short).
  • But the 'protocol type' is based on a commonly agreed numbering system established only after the peer handshake completes, and that peer handshake to establish the numbering system is carried out using 'devp2p,' which the designers seem to have intended as being a super-protocol over the rlpx transport.
  • So in terms of protocol the RLPx and DEVp2p handshake steps can be considered one thing. The RLPx protocol is meaningless without the DEVp2p handshake step. The protocol RLPx+DEVp2p is one thing and needs to be renamed by the community to show that that is actually the case.
  • DevP2P messages are basically of the format "Message Type" + "Payload". The message type is a number within the space agreed by the commonly agreed protocol. The problem is that DEVP2P, despite intending to support multiple protocols, does not have a "protocol" id. The protocol id is left to the RLPx subprotocol/transport. So DEVP2P cannot fulfill its design goal without a transport that cooperates.

In short it is best to see DEVP2P and RLPx as one thing.

Related Topic