In this segment, we will be learning about blockchain architecture. The analogy will be drawn from the traditional network architectures, i.e. client-server architecture model.
The web is a service that allows sharing of data. Due to this feature of the web, it is said to follow the client-server architecture. In a client-server architecture, a client can be a machine or a program that allows the user to make requests to the server. For example, WWW is a client-server program. Users can request data and the web will provide it. On the other hand, a server is essentially a program and NOT A DEVICE.
There are two types of servers:
A server is always listening for requests. As soon as it receives a request, it responds with an action or a message.
A Client-Server architecture model is an architecture on the web that splits the devices into two sections: devices that request for data and devices that provide the requested data.
In a peer-to-peer network, each device can act as a server and as a client at different points in time. The most suitable example of this is ‘Skype’.
2-tier Architecture | 3-tier architecture |
A 2-tier architecture is basically meant for client-server applications. This means that there is direct communication between client and server. | A 3-tier architecture is usually meant for web-based applications. There is always an intermediary (can be more than one) between server and client. |
Servers can not record multiple requests at the same time. | These architectures have a high performance because requests can be cached, and load can be reduced. |
It is easy to maintain. | Complexity is increased due to the increase in the number of layers. |
It is easy to modify. | It improves data integrity, security and are easy to maintain and modify. |
A distributed app, commonly referred to as the D-App, runs on a peer-to-peer network. Assume multiple copies of client-server devices set up on the network, with each server connecting and interacting with other servers. Each of these servers can be mapped to be a node in a blockchain network. D-Apps connect a blockchain via a smart contract, much like APIs in a client-server middleware architecture. The address or domain name for a server is fixed, and clients can connect through that.