Peer-to-Peer Network Architecture
Peer-to-peer network architecture is used to organize the bitcoin network. The term "peer-to-peer" or P2P is used to refer to one of the most important characteristics of the bitcoin network, which means each computer takes part in the network as a node, and they are peers to each other. In addition, they are all equal, with no "special" nodes and no one taking higher or lesser responsibility. All nodes share the work of providing network services. That is a distributed network with no server and no centralized service. In addition, all nodes are in a "flat" connection with no hierarchy. Each node both provides and uses at the same time the network services that promote participation in the network. A strong example of P2P network architecture is the internet in the early days, where nodes on the IP network were equal. Despite the change in its hierarchical architecture, the Internet protocol still retains its flat topology as it was on the first day. In conclusion, P2P networks are robust, decentralized, and open by nature.
P2P network architecture is no more than a topology choice of the bitcoin network since it has become a vital core characteristic in network consensus to make the power of bitcoin.
"Bitcoin network" is typical of P2P networks. And that term refers to collections of nodes using the bitcoin P2P protocol. Besides the bitcoin P2P protocol, other protocols such as Stratum are used for mining and lightweight or mobile wallets. The term "extended bitcoin network" refers to that whole protocol.
Although each node in P2P peers each other, they may support different functionality. For that reason, they have different roles. We can define A bitcoin node as a collection of functions: routing, the blockchain database, mining, and wallet services.
The node has all four functions (called full nodes). In fact, each node can have two or above of these functions. However, to take part in the network, all nodes must include the routing function. We can see some kind of node in the figure below:
Full nodes maintain a full blockchain and add transactions. Therefore, it also can be called "full blockchain nodes ."When bitcoin was born, all blockchain nodes were initially full nodes. But in the last few years, new bitcoin clients have been released that do not maintain a full blockchain. Instead, they operate as lightweight clients. That is why we have the term "simplified payment verification" (SPV).
SPV nodes suited for bitcoin clients can run on smartphones, tablets, or embedded systems. SPV nodes download the block headers and not the transactions contained inside each block. Without transactions, the resultant chain of blocks is 1,000 times smaller than the whole blockchain. Because they are unaware of all transactions on the network, SPV nodes cannot build a complete image of all the UTXOs available for spending. SPV nodes verify transactions differently, relying on peers to offer partial views of relevant areas of the blockchain on-demand. SPV validates transactions based on their depth in the blockchain rather than their height. An SPV node will verify the chain of all blocks (but not all transactions) and link that chain to the transaction of interest, whereas a full blockchain node will construct a fully verified chain of thousands of blocks and transactions reaching down the blockchain (back in time) all the way to the genesis block. Well-connected SPV nodes are safe enough for most practical tasks to balance resource requirements, practicality, and security. However, nothing surpasses operating a complete blockchain node for absolute security. SPV nodes provide a privacy concern since they must obtain individual transactions in order to selectively validate them. In contrast to full blockchain nodes, which gather all transactions inside each block, SPV node requests for particular data may mistakenly leak the addresses in their wallet. A third party monitoring a network, for example, may keep track of all transactions requested by a wallet on an SPV node and use them to link bitcoin addresses to the user of that wallet, violating the user's anonymity.
A Bloom filter is a type of probabilistic search filter that may be used to define the desired pattern without stating it precisely. In addition, Bloom filters are a quick and easy method to convey a search pattern while safeguarding your privacy. SPV nodes use them to ask their peers for transactions that fit a given pattern without exposing which addresses, keys, or transactions they are looking for. Bloom filters provide this role by allowing an SPV node to set a search pattern for transactions that may be optimized for precision or privacy. A more specialized bloom filter will yield more accurate results, but at the cost of disclosing the patterns, the SPV node is interested in revealing the addresses owned by the user's wallet. A less specialized bloom filter will generate more data on more transactions. Although many of them will be useless to the node, they will allow the node to keep greater privacy.
In order to participate in the network, a new node must discover other bitcoin nodes on the network when it powers up. To be more specific, firstly, a new node must discover and connect to at least one existing node on the network. The geographical location of other nodes is unimportant; the bitcoin network architecture is not specified geographically. As a result, any current bitcoin node can be chosen randomly.
How does a new node discover its peers? The first way is to query DNS with a number of "DNS seeds," which are DNS servers that offer a list of bitcoin node IP addresses. Some of those DNS seeds provide a static list of IP addresses for reliable bitcoin listening nodes. Some DNS seeds are bespoke BIND (Berkeley Internet Name Daemon) implementations that deliver a random subset of bitcoin node addresses acquired by a crawler or a long-running bitcoin node. The names of five distinct DNS seeds may be found in the Bitcoin Core client. The variety of ownership and implementation of the many DNS seeds ensures a high level of stability throughout the initial bootstrapping procedure.
 Antonopoulos, Andreas M., Mastering Bitcoin: Programming the Open Blockchain - 2nd Edition, accessed April 13th, 2022.