In our last blog post we discussed how the blockchain can been seen as an immutable ledger. So how does the blockchain communicate with each block and how does the data stored on the block protect itself from hacks or attacks on the data.
Since the blockchain technology involves decentralization, the infrastructural communications network underlying the blockchain must also be decentralized. In other words, the network follows a peer-to-peer (P2P architecture, and not a client-service model).
This is the physical architecture that allows Blockchain to work and provides a blockchain with redundancy.
The P2P in P2P distributed network stands for peer to peer, indicating a network comprised of peers.
The majority of networks in place now are called server/client networks
In the picture below, the centre square represents a server, with the boxes around it representing nodes . When you want to view a web page, you send a request from your node to a server. The server will then respond with the requested information.
While this works well, it does have some drawbacks. First off, since the server is central point of communication and the holder of all the information (webpages, databases, etc), if the server goes down, the network is essentially dead. This is the whole idea behind one of the more successful methods of cyber attack – the Denial of Service in which a server is targeted with more traffic than it can handle, shutting it down.
Blockchain does not use a server client approach. Instead it uses a P2P or peer to peer network to function. In a peer to peer, the nodes (laptops, tablets, etc) all talk directly to each other.
Instead of a server holding all the information, the data that makes up the blockchain is instead distributed across all the different nodes. So the more nodes that are part of the blockchain, the more copies of it that exist.
In particular, the P2P(Peer to Peer) structure has the following features:
- Decentralization. Dispatched centre and database does not exist in P2P network.
- Each of the nodes contains the same logic and state. There is no concept of client or server.
- Unreliability. The connections between nodes are unreliable.
P2P architecture is naturally therefore suitable for decentralized blockchain network.
 Note that this only happens at the network layer. In upper layers such as the application layer, nodes will have different roles between full nodes and lightweight nodes.
Since P2P networks are decentralized and do not have a central database, nodes can join and leave at any time. As such, resource allocation becomes a major issue. The strategy to locate resources quickly and effectively is known as content routing.
In search of a solution, the P2P network model has evolved through several different forms, including centralized, pure distributed, hybrid, and structured.
Centralized model uses master index, distributed storage and strong-dependency index server. This model is not reliable enough.
In pure distributed model, nodes and resources are randomly distributed and disordered, therefore could suffer from message flooding and storms in ease.
Hybrid network contains a combination of super nodes and ordinary nodes, where super nodes are more likely to dominate the network.
The structured P2P network is generally based on a distributed hash table (DHT), which hashes the resource to obtain the resource ObjectID and allocates NodeID to every node in the network.
As we can see from the discussion P2P networks work great for redundancy as even if you took out a couple of nodes in the network, it would still be able to function as normal. Even if you were able to hack in and corrupt the blockchain in one of the nodes, the fact that copies of it exist on all the other nodes protect it from corruption.