What is peer-to-peer (P2P)?
In peer-to-peer (P2P) computing, a (P2P) network consists of a group of devices that share and share files. Each participant (node) acts as a separate peer. As a rule, all nodes have the same power and perform the same tasks.
In financial technology, the term "peer-to-peer" usually refers to the exchange of cryptocurrencies or digital assets over a distributed network. The P2P platform allows buyers and sellers to make transactions without intermediaries. In some cases, websites may also provide a P2P environment that connects lenders and borrowers.
The P2P architecture can be suitable for a variety of use cases, but it became particularly popular in the 1990s when the first file sharing applications were created. Today, P2P networks underpin most cryptocurrencies and make up a large part of the blockchain industry. However, they are also used in other distributed computing applications, including web search services, streaming platforms, online marketplaces, and the InterPlanetary File System (IPFS) web protocol.
How does P2P work?
In essence, the P2P system is supported by a distributed network of users. They usually have no central administrator or server, as each node contains a copy of the files, acting as both a client and a server for other nodes. In this way, each node can download files from other nodes or upload files to them. This is what distinguishes P2P networks from more traditional client-server systems, in which client devices download files from a centralized server.
In P2P networks, connected devices exchange files that are stored on hard drives. Using applications designed for data sharing, users can request and download files to other devices on the network. Once a user has downloaded that file, they can be the source of that file.
In other words, when nodes act as clients, they download files from other network nodes. But when they act as a server, they are a source from which other websites can download files. However, in practice, both functions can be performed at the same time (for example, uploading file A and uploading file B).
As each node stores, transfers, and receives files, P2P networks become faster and more efficient as their user base grows. In addition, their distributed architecture makes P2P systems highly resistant to cyber attacks. Unlike traditional models, P2P networks do not have a single point of failure.
We can classify peer-to-peer systems according to their architecture. There are three main types: unstructured, structured and hybrid P2P networks.
Unstructured P2P networks
Unstructured P2P networks do not represent any particular organization of nodes. Participants randomly communicate with each other. These systems are considered to be resilient to high churn activity (i.e. multiple nodes join and leave the network frequently).
Even though unstructured P2P networks are easier to build, they can require more CPU and memory because searches are sent to as many peers as possible. This tends to overload the network with requests if a small number of nodes offer the desired content.
Structured P2P networks
Conversely, structured P2P networks are organized architectures that allow nodes to efficiently search for files even when the content is not public. This is most often achieved through the use of hash functions, which facilitate database searches.
Although structured networks can be more efficient, they typically have a higher level of centralization and usually require higher setup and maintenance costs. In addition, structured networks are less robust when faced with high outflow rates.
Hybrid P2P networks
Hybrid P2P networks combine a conventional client-server model with some aspects of peer-to-peer architecture. For example, thanks to this, you can create a central server that will simplify the connection between peers.
Compared to the other two types, hybrid models have improved overall performance. They usually combine some of the main advantages of each approach while achieving a significant degree of efficiency and decentralization.
Distribution or decentralization?
Although P2P architecture is inherently distributed, it is important to note that there are varying degrees of decentralization. So, not all P2P networks are decentralized.
In fact, many systems rely on a central authority to manage network activity, making them somewhat centralized. For example, some P2P file sharing systems allow users to search for and download files from other users, but they cannot participate in other processes such as managing search requests.
Additionally, small networks controlled by a limited general-purpose user base can be said to have a higher degree of centralization despite the lack of a centralized network infrastructure.
The role of P2P in blockchains
In the early stages of Bitcoin, Satoshi Nakamoto defined it as a “peer-to-peer electronic money system”. Bitcoin was created as a digital form of money. It can be transferred from one user to another through a P2P network that manages a distributed ledger called a “blockchain”.
In this context, the P2P architecture inherent in blockchain technology allows Bitcoin and other cryptocurrencies to be transferred around the world without the need for intermediaries or a central server. In addition, anyone can create a Bitcoin node if they want to participate in the process of validating and confirming blocks.
As such, there are no banks in the Bitcoin network that process or record transactions. Instead, the blockchain acts as a digital ledger that publicly records all actions. Essentially, each node stores a copy of the blockchain and compares it to other nodes to ensure data accuracy. The network quickly rejects any malicious activity or inaccuracy.
In the context of cryptocurrency blockchains, nodes can perform many different roles. Full nodes, for example, ensure network security by verifying transactions against the system's consensus rules.
Each full node maintains a full, up-to-date copy of the blockchain, allowing them to participate in a collaborative effort to verify the true state of the distributed ledger. However, it is worth noting that not all fully verified nodes are miners.
Advantages
Peer-to-peer architecture of blockchains provides many advantages. Among the most important is the fact that P2P networks provide greater security than traditional client-server mechanisms. The distribution of blockchains across a large number of nodes makes them virtually immune to Denial-of-Service (DoS) attacks, which many systems suffer from.
Since most nodes must reach a consensus before adding data to the blockchain, it is virtually impossible for an attacker to change the data. This is especially true for large networks like Bitcoin. Smaller blockchains are more prone to attacks because one person or group can eventually gain control of most nodes (this is known as a 51% attack).
As a result, the distributed peer-to-peer network, combined with the majority consensus requirement, gives blockchains a relatively high level of resistance to malicious activity. The P2P model is one of the reasons why Bitcoin (and other blockchains) were able to achieve so-called “Byzantine fault tolerance”.
In addition to security, the use of P2P architecture in cryptocurrency blockchains also makes them resistant to censorship by central authorities. Unlike standard bank accounts, cryptocurrency wallets cannot be frozen or emptied by governments. This resistance also extends to censorship attempts by private payment and content processing platforms. Some content creators and online merchants have accepted cryptocurrency payments to avoid having their payments blocked by third parties.
Limitation
Despite numerous advantages, the use of P2P networks on blockchains also has certain limitations.
Because distributed ledgers must be updated on each individual node, rather than on a central server, adding transactions to the blockchain requires enormous computing power. Although this provides increased security, it in turn significantly reduces operational efficiency, which is one of the main obstacles when it comes to scalability and widespread adoption. However, cryptographers and blockchain developers are exploring alternatives that can be used as scaling solutions. Prominent examples are the Lightning Network, Ethereum Plasma, and Mimblewimble protocols.
Another potential limitation is related to attacks that can occur during hard fork events. Because most blockchains are decentralized and open source, groups of nodes can freely copy and modify code and branch off from the main chain to form a new parallel network. Hard forks are completely normal and do not pose a threat in themselves. But if certain security practices are not adopted properly, both chains can become vulnerable to replay attacks.
Moreover, the distributed nature of P2P networks makes them relatively difficult to control and regulate not only in the blockchain sphere. Several P2P programs and companies have been implicated in illegal activity and copyright infringement.
Results
Peer-to-peer architecture can be designed and used in many different ways, and it is the foundation of the blockchains that make cryptocurrencies possible. By distributing transaction ledgers across large networks of nodes, the P2P architecture provides security, decentralization, and censorship resistance.
In addition to their utility in blockchain technology, P2P systems can also serve other distributed computing applications, ranging from file sharing networks to energy trading platforms.