Home  >  Article  >  Detailed explanation of peer-to-peer network

Detailed explanation of peer-to-peer network

王林
王林forward
2023-04-17 13:01:033179browse

What is peer-to-peer (P2P)?

In the field of computer science, a peer-to-peer network consists of a group of devices that can store and share documents. Each participant (node) is equivalent to a peer individual. That is, all nodes have the same rights and perform the same tasks.

In the field of financial technology, P2P usually refers to digital currency or digital asset transactions through a distributed network. A P2P platform allows buyers and sellers to transact directly without middlemen. Some websites can also provide a P2P trading environment for borrowers and lenders.

The P2P architecture is suitable for various scenarios, but it really became popular in the 1990s, when the first file sharing program was born. Today, peer-to-peer networks have become the core of most digital currencies and account for a large part of the blockchain industry. However, it is also used in a variety of other distributed computer programs, including: web search engines, streaming platforms, online marketplaces, and the InterPlanetary File System (IPFS) network protocol.

How P2P works

Essentially, a P2P system is maintained by users in a distributed network. Typically, they have no central sysadmin or server because each node has a copy of the files -- a user and a server to other nodes. Therefore, each node can download files from other nodes or upload files to them. The client device of the traditional server system needs to download files from the central server. This is the difference between the P2P network and other traditional service systems.

In a P2P network, files shared by interconnected devices are stored on their hard drives. And using software applications to transfer shared data, users can also find and download files on other devices. If a user downloads a specified file, he can act as the source of that file. Detailed explanation of peer-to-peer network

In other words, when a node acts as a user, he will download files from other nodes. But if it works as a server, other nodes can download files from it. In fact, these two functions can be performed simultaneously (for example, downloading file A and uploading file B).

Because each node can store, transmit and receive files, and as the user base of the P2P network gradually grows, it also becomes faster and more efficient. The distributed structure also makes the P2P system more resistant to network attacks. Unlike traditional models, P2P networks do not have a single point of failure.

According to its structure, we can classify P2P systems, of which the main three types are: unstructured peer-to-peer network, structured peer-to-peer network, and hybrid peer-to-peer network.

Unstructured P2P Network

The unstructured peer-to-peer network does not show the specific architecture of the node. Participants can communicate freely with each other. These systems are resistant to high-frequency activity, which means that several nodes frequently entering and exiting the network will not have any impact on the system.

Although unstructured peer-to-peer networks are easier to set up, they require more powerful CPUs and memory because search queries are sent to the largest number of peers. Especially if a small number of nodes can provide the required content, a large number of searches will flood the network.

Structured Peer-to-Peer Network

Unlike unstructured peer-to-peer networks, structured peer-to-peer networks exhibit an organizational structure that allows nodes to efficiently search for files even if the file's content is not widely known use. Most of the time, searches are done by using hash functions to aid database lookups.

Relatively speaking, structured peer-to-peer networks will be more efficient because they can better demonstrate a high level of centralization and require more start-up capital and maintenance costs. In addition, structured peer-to-peer networks are less tolerant of high-frequency activity.

Hybrid peer-to-peer network

Hybrid peer-to-peer network combines some characteristics of the traditional master-slave architecture and point-to-point architecture. For example, it might establish a central server to speed up integration between points.

Unlike the other two modes, hybrid peer-to-peer networks tend to exhibit improved overall performance. It combines the advantages of each method while achieving efficiency and decentralization.

Distributed VS Decentralized

Although the point-to-point structures are distributed, the degree of decentralization is different. Therefore, not all peer-to-peer networks are decentralized.

In fact, many systems require a central department to direct network activities, making them more or less centralized. For example, some peer-to-peer file sharing systems allow users to search for and download files from other users, but they cannot participate in processes such as managing search queries.

In addition, some small networks controlled by a small number of users can also be said to be highly centralized, although they may not have neutral infrastructure.

The role of peer-to-peer in blockchain

In the early days of Bitcoin, Satoshi Nakamoto defined it as a "peer-to-peer electronic cash system." Bitcoin appeared in the public eye as a form of electronic cash. It can be transferred between two users through a peer-to-peer network, which requires the use of a distributed ledger, namely: blockchain. In the blockchain, the peer-to-peer architecture allows Bitcoin and other digital currencies to be transferred to each other around the world without the need for middlemen and any central server. If any user wants to participate in the process of verifying blocks, they can establish a Bitcoin node.

Therefore, there are no banking steps or transaction records in the Bitcoin network. Instead, the blockchain serves as an electronic ledger that publicly records all transaction activity. Basically, each node has a copy of the blockchain and compares it with other nodes to ensure the correctness of the data. The Bitcoin network can quickly clean up all kinds of errors and malicious activity.

Nodes can play various roles in the blockchain. For example, full nodes verify transactions through consensus rules, thus ensuring the security of the network.

Each full node maintains a complete, upgraded copy of the blockchain - allowing these blockchain copies to work together to verify the true status of the distributed ledger. It should be noted that not all verification nodes are miners.

Advantages

The peer-to-peer architecture of blockchain has many advantages. More importantly, compared to the traditional master-slave architecture, point-to-point networks have higher confidentiality. Most nodes are nearly immune to the Denial of Service (DoS) attacks that have compromised many systems. Likewise, since data is added to the blockchain requiring the unanimous consent of a majority of nodes, it is nearly impossible for an attacker to alter the data. Especially in a large network like Bitcoin. However, relatively small blockchains are vulnerable to attacks because one person or organization often controls a large number of nodes (this is also a 51% attack). Therefore, under the premise of unanimous consent of the majority of nodes, the distributed peer-to-peer network makes the blockchain more resistant to malicious network attacks. The peer-to-peer model is the main reason why the Bitcoin network can achieve Byzantine fault tolerance.

In addition to security, the peer-to-peer architecture allows digital currency blockchains to avoid scrutiny by central authorities. Unlike regular bank accounts, digital currency wallets cannot be frozen or consumed by governments. Personal payment processing and content platforms can also avoid corresponding censorship efforts. In order to avoid third-party intervention in their payments, some online merchants have adopted digital currency payment methods.

Limitations

Despite its above advantages, there are certain limitations to using P2P networks in blockchain.

Since the distributed ledger must be upgraded on each node, adding transactions to the blockchain requires huge computer computing power. Although this improves security, it also greatly reduces efficiency and has become one of the main obstacles to the expansion and promotion of blockchain networks. However, cryptographers and blockchain developers are working on alternatives to address scalability issues. A few obvious examples include the “Lightning Network,” “Ethereum Plasma,” and the “Mimblewimble Protocol.” Another potential limitation concerns possible attacks during a hard fork. Since most blockchains are decentralized and open source, nodes are free to copy and modify the code and separate from the main chain, forming new parallel networks in this way. Hard forks are completely normal and do not pose a threat. But both chains can be vulnerable to replay attacks if certain security measures are not properly employed.

In addition, the distributed nature of P2P networks makes them relatively difficult to control and regulate. This problem is not limited to blockchain, some P2P applications and companies are also involved in illegal activities such as infringement.

Summary

The peer-to-peer architecture can be developed and applied in many different aspects, and its core position in the blockchain also contributed to the birth of digital currency. By distributing the transaction ledger across a large network of nodes, the peer-to-peer architecture provides the advantages of security, decentralization, and protection against regulation.

In addition to its advantages in blockchain technology, P2P systems can also be applied to other distributed computing application fields, ranging from file sharing networks to energy trading platforms.

The above is the detailed content of Detailed explanation of peer-to-peer network. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yundongfang.com. If there is any infringement, please contact admin@php.cn delete