CAP theorem and Blockchain

CAP theorem and Blockchain

CAP theorem:

CAP theorem states that “it is impossible for a distributed data store to simultaneously provide more than two out of the three guarantees: Consistency, Availability & Partition tolerance.”

The CAP theorem is a fundamental part of the theory of distributed systems. 

It states that “in the presence of partitions (i.e. network failures), a system cannot be both consistent and available, and must choose one of the two.”

According to the CAP theorem

Techpay is decentralized to store data. It can only provide two of three guarantees simultaneously: consistency, availability, and partition tolerance (CAP). In the context of modern distributed networks of Techpay Blockchain, this theorem has evolved into the Blockchain Trilemma — the popular belief that public blockchains must sacrifice either security, decentralization, or scalability.

 Parts of CAP Theorem

CAP stands for:

 C: consistency 

 A: for availability and

 P: stand for partition 

C: Consistency: means that “every read operation will result in getting the latest record.” 

All the information is guaranteed to be up to date. A lack of consistency means that no response is thus given.

“At any given time, all nodes in the network have exactly the same recent value.”

A: Availability: Availability means a property that indicates a distributed system will always be available. 

If one or more nodes of such a system might turn off for a reason or more, however, the system will still be accessible through other nodes.

 Every request to the network receives a response, though without any guarantee that returned data is the most recent.

P: Partition tolerance: means that every node can work independently from the other ones. 

Partition Tolerance tends to lie more on the safety component, though arriving at the safety consensus in Partition Tolerance is a bit complicated.

It represents the ability of the system to be partitioned.

The network continues to operate, even if an arbitrary number of nodes are failing. 

About CAP Theorem

CAP Theorem, also called Brewer’s Theorem proposed by Eric Brewer, identifies three specific system properties for any distributed/decentralized system. They are: 

  • Consistency
  • Availability and
  • Partitioning tolerance

CAP does not cover the delays in response time thus terming it as available while at the same time, partly available nodes are still termed as available.

Application of CAP Theorem

Partitioning is an inherent feature of any distributed system. That gives us only two choices to pick from consistency or availability

If we pick Availability over Consistency in techpay blockchain, any reads that happen are not guaranteed to be up-to-date.

  •  There is a response from the network at all times
  •  The purpose of the Techpay blockchain being a single source of truth is taken away.
  •  lack of Consistency is something we simply can’t have in any monetary system. Consistency always takes priority in techpay blockchain technology.

On the other hand, Availability as an optional feature would force the network to be unavailable when there is a Partition which would disrupt consensus.

 Hence, availability cannot be sacrificed in blockchain technology since consensus is key. 

Does That Mean Blockchain Violates CAP Theorem ?

NO, blockchain does not violate the CAP theorem. 

In techpay Blockchain, consistency is sacrificed in favor of availability and partition tolerance. 

Consistency (C) on the Blockchain is not achieved simultaneously with Partition Tolerance (P) and Availability (A), but it is achieved over time. This is called eventual consistency.

Those interested in blockchain, opt for AP (Availability + Partition) + Strong/Eventual Consistency.

 Techpay uses Proof of Work as its consensus mechanism. Currently, Techpay maintains a Read & Write protocol. The protocol is designed to consider the longest chain as the accepted main chain. A transaction is confirmed only if it is an “X” number of blocks deep into the chain. Although a probabilistic model, it is left to the users to choose the value for X. Currently, for large transactions, a minimum of 6 blocks wait is considered a win.

Read also :What problem does Blockchain technology solve?

Leave a Reply