These notes main objective is to help understand P2P networks, and explains some of Ethereum’s implementation details. P2P technology has the potential to alleviate shortcomings of centralized systems by utilizing the rich resources of end devices, and since the 1990s has been adopted by popular softwares like eMule, bitTorrent, and Skype. It is also a key component of blockchain systems like bitcoin or Ethereum, the system the Shyft Network is derived from. Most people have heard about P2P, but do not know what exactly it is. Let’s start by talking about P2P networks in general.
What is a P2P Network?
A Peer-to-Peer (P2P) network is an overlay network — that is, it’s built on top of the public Internet. Mathematically, It can be viewed as a directed graph G = (V,E), where V is the set of peers in the network and E is the set of links between peers. Each peer p has a unique identification number pid. A link (p,q) in E means that p has a direct path to send a message to q; that is, p can send a message to q over the network using q’s pid as the destination. Although in the underlying TCP/IP network, similar IP addresses could translate to nearby physical locations, there is rarely such direct correlation.
Ideally, all peers should be connected by a path. Since individual peers have only an incomplete view of the network topology and peer membership, the overlay depends on intermediate peers to forward messages to the correct regions of the overlay. The graph structure provides multiple paths between every pair of peers, and contributes to resilience by enabling connectedness despite peer node changes. At each peer’s level, the connectivity of the graph is reflected in terms of its adjacencies to other peers. When peers join or leave the network, adjacent peers may have incorrect adjacency information. Overlay maintenance mechanisms are used to keep the adjacency information updated, thus maintaining connectedness across all nodes.
Participants in the P2P network make a portion of their resources available to other network participants. Each peer contributes compute cycles (CPU), disk storage, and network bandwidth, without the need for a central coordination instance. Peers are both suppliers and consumers of network resources, in contrast to the traditional client-server model, where only servers supply and clients consume. Therefore, P2P networks have the potential to address the limitations of the client-server model, such as scalability and the single point of failure.
There is often a minimum resource contribution threshold for a peer to join the P2P overlay. Resource contribution should be fair. A fairness criterion can dictate that, for example, the average contribution of any peer should be within a statistical bound of the overall average of the P2P system. Resource contribution should also be mutually beneficial. Users are incentivized to participate in P2P applications if the benefit is comparable to the resources being contributed.