What does peer-to-peer (P2P) mean?
In the field of information technology, a peer-to-peer or peer-to-peer (P2P) network consists of a group of interconnected devices that exchange files with each other and store the same set of data. Each participant (node) acts as an individual peer. Typically, all nodes have the same power and perform the same tasks.
In financial terms, the term often refers to the exchange of cryptocurrencies or digital assets over a distributed network. The P2P platform allows buyers and sellers to complete transactions without intermediaries. In some cases, websites may also provide a peer-to-peer environment that connects lenders and borrowers.
P2P architecture is suitable for a variety of use cases, and the technology became popular in the 1990s when the first file-sharing programs were created. Today, peer-to-peer networks are the basis of most cryptocurrencies, making up a large part of the blockchain industry. However, it is also used in other distributed computing applications, including search engines, streaming platforms, online marketplaces, and the InterPlanetary File System (IPFS) web protocol.
How it works?
The P2P system is supported by a distributed network of users. They usually do not have a main administrator or server, as each node contains a copy of all files, acting as a client and server for other nodes. Thus, each node can download files from other nodes and also in reverse order. This is a distinguishing feature of a P2P network compared to its more traditional clients, in which devices download files from a centralized server.
In peer-to-peer networks, connected devices exchange files that are stored on their hard drives. Using software applications designed to share data, users can request and download files to other devices on the network. Once the user has downloaded this file, it can act as its source.
In other words, when a node acts as a client, it downloads files from other nodes on the network. But when all nodes act as a server, they are a source from which other nodes can download data. However, in practice, both functions can be performed simultaneously (for example, downloading file A and downloading file B).
Because each node stores, transmits, and receives files, P2P networks tend to operate faster and more efficiently as their user base increases. In addition, the distributed architecture makes such systems very resistant to various 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 network.
Unstructured P2P networks
Unstructured networks do not represent any particular organization of nodes. All participants come into random contact with each other. And in this regard, such systems are considered resistant to high node turnover activity (i.e., some nodes join the network, while others leave it).
Although simple to build, unstructured P2P networks can require higher CPU and RAM usage as search requests are sent to as many peers as possible. This architecture tends to flood the network with requests, especially if a small number of nodes offer the desired information.
Structured P2P networks
Compared to the previous form, structured networks are an organized architecture that allows nodes to search for files more efficiently, even if the content is not widely available. In most cases, this is achieved through the use of hash functions, which make searching the database easier.
While structured networks offer high availability and productivity, they tend to be more centralized and demanding in terms of installation and maintenance. Additionally, this architecture is less resilient when it comes to high node churn rates.
Hybrid P2P networks
Hybrid P2P networks combine the traditional model with some aspects of peer-to-peer architecture. For example, thanks to this, a central server can be developed that will simplify the connection between nodes.
Compared to the other two types, hybrid models tend to have higher overall performance. They usually combine some of the main advantages of each approach and thereby achieve high levels of efficiency and decentralization at the same time.
Distribution or decentralization?
P2P architecture is distributed by nature, but it is worth noting that if implemented, the network may have different levels of decentralization. For this reason, not all peer-to-peer networks are decentralized.
Because many systems rely on a central authority to manage the network, this makes them somewhat centralized. For example, some peer-to-peer file hosting services allow users to search and download files at the expense of other users, but they cannot participate in other processes, such as managing search queries.
In addition to this, it can be said that small networks that are controlled by a limited user base with common goals have a higher level of centralization, despite the lack of a centralized network infrastructure.
Impact of P2P on Blockchain
In the early stages of development, Satoshi Nakamoto defined Bitcoin as a “peer-to-peer electronic cash payment system.” Bitcoin was created as a digital form of money that can be transferred from one user to another through a peer-to-peer network and managed by a distributed ledger, also referred to as a blockchain.
In this context, the P2P architecture, which is characteristic of blockchain technology, allows the exchange of bitcoins and other cryptocurrencies around the world without intermediaries and centralized servers. Additionally, anyone can join and become a node in the Bitcoin network if they want to participate in the process of checking and validating blocks.
Thus, there are no banks on the Bitcoin network that process or record all transactions. Instead, the blockchain works as a digital ledger that publicly records all activity. In practice, each node stores a copy of the blockchain and compares it with copies of other nodes to ensure the accuracy of the data. This way, the network quickly responds to any malicious activity or inaccuracy.
Within cryptocurrency blockchains, nodes can take on different responsibilities. For example, full nodes (full nodes) ensure the security of the network by validating transactions against the established consensus rules of the system.
Each full node maintains an updated copy of the blockchain, allowing it to participate in a collective effort to verify the true state of the distributed ledger. However, it is worth noting the fact that not all full nodes are miners.
Advantages
The peer-to-peer architecture of blockchains provides many benefits to users. One of the most important is that such networks provide greater security than a traditional client-server device. The distribution of data on the blockchain among a large number of nodes makes the network virtually immune to the denial of service (DoS) attacks that plague most systems.
Since most nodes must reach consensus before data is added to the blockchain, it is virtually impossible for an attacker to make any changes. And this is actually true when it comes to a large network such as Bitcoin. Smaller blockchains are more susceptible to attacks because an entity or group of individuals may eventually gain control of a majority of the nodes (also known as a 51% attack).
As a result, a distributed peer-to-peer network, combined with mandatory consensus of the majority of participants, provides blockchains with a relatively high degree of resistance to malicious activity. The P2P model is one of the reasons why Bitcoin (and other blockchains) have been able to achieve so-called Byzantine fault tolerance.
In addition to security, the use of peer-to-peer architecture in cryptocurrency blockchains also makes them resistant to censorship by central authorities. Unlike standard bank accounts, cryptocurrency wallets cannot be frozen or canceled by the government. This resilience also extends to censorship of private payment processing and content publishing platforms. Some media creators and online sellers have started using cryptocurrency to avoid having their payments blocked by third parties.
Flaws
Despite the many advantages, peer-to-peer networks also have certain disadvantages.
Since distributed ledgers must be updated on each node rather than on a central server, adding transactions to the blockchain requires a large amount of computing resources. While this provides increased security, it in turn significantly reduces operational agility, which is one of the main obstacles when it comes to scalability and large-scale adaptation. However, cryptographers and blockchain developers are exploring alternatives that can be used as a solution to increase scalability. Notable examples include the Lightning Network, Ethereum Plasma, and the Mimblewimble protocol.
Another potential drawback relates to the attacks that can occur during a hard fork. Since most blockchains are decentralized and open source, groups of nodes can freely copy and modify the code and then split off from the main chain to form a new parallel network. Hard forks are a completely normal event, which in itself does not pose any threat. However, if certain security measures are not followed properly, both chains may become vulnerable to a replay attack.
Moreover, the distributed nature of P2P networks makes them relatively difficult to monitor and regulate, not just in the blockchain space. Due to this, several P2P applications and companies have been linked to illegal activities and copyright infringement.
Conclusion
Peer-to-peer architecture can be developed and used in different ways, but it is the basis of all blockchains, making cryptocurrency possible. By distributing transaction ledgers among large network nodes, P2P technology ensures security, decentralization, and censorship resistance.
In addition to their utility for blockchain technology, P2P systems can also serve other distributed computing applications, from file-sharing networks to energy trading platforms.