Implementing State Replication by Using Blockchain

Let's explore how to use blockchains to perform state replication.

Overview

Since the trustworthiness of the nodes is unknown in the permissionless setting, the blockchain network we defined in this lesson is, in fact, an unreliable distributed system, where any node can exhibit Byzantine behavior, which implies the need for fault tolerance (see this section :Fault_Tolerance ). Drescher (2017)Daniel Drescher. Blockchain Basics: A Non-Technical Introduction in 25 Steps. Berkely, CA, 2017. Apress. describes that “the main problem to be solved by the blockchain is achieving and maintaining integrity in a purely distributed peer-to-peer system that consists of an unknown number of peers with unknown reliability and trustworthiness,” whereas integrity is the “ability to make a true statement about ownership and to ensure that only the lawful owner can transfer his or her property rights to others.” The authorization for transferring ownership of funds is simply based on digital signatures, but it’s not that easy to ensure a true statement about ownership itself.

We already said that the transaction data is permanently recorded in blocks, the ledger, which helps to maintain a chronological ordering of data and thus allows documentation of ownership of the funds, despite working over a network of trust-free nodes. But there’s still the question of how the blockchain should be stored. As mentioned in this Definition(Distributed system), A distributed system is a system in which computation and storage of information are distributed across independent components which communicate and coordinate their actions by passing messages., the memory must be distributed across the network since there’s no central authority or trusted third party which stores and maintains the ledger. This means that every single node has to locally store a replica of the blockchain.

This approach enables a fault-tolerant system. As mentioned by Drescher (2017)Daniel Drescher. Blockchain Basics: A Non-Technical Introduction in 25 Steps. Berkely, CA, 2017. Apress., “having only one ledger is risky since it can be damaged, destroyed or forged.” Thus, the blockchain is replicated and distributed across all nodes in the network, whereas every node has the ability to update the ledger with new transactions. Therefore, each node is collecting incoming transactions in its own memory pool and placing them in so-called candidate blocks, which are then suggested to be appended onto the blockchain.

This approach is based on a consensus mechanism in order to make sure that every node is able to update its own replica of the ledger is updated by any other node. Therefore, instead of maintaining just one ledger, the system deploys a purely peer-to-peer network of independent ledgers, where the application of a consensus algorithm ensures that the system collectively reaches a unique state. Once the nodes agree on a consistent state of the ledger, every node updates its local blockchain if it is different from the authoritative one, thus the blockchain is copied between the nodes in order to update the distributed shared state.

Distributed consensus

Distributed consensus is the ability that enables a blockchain to present a single version of the truth that is agreed upon by all peers without the requirement of central authority (Imran Bashi (2017)Imran Bashir. Mastering Blockchain. Packt Publishing, Limited, 2017.).

Authoritative chain

The collectively selected version of the transaction history is called the authoritative chain or main chain (Drescher (2017)Daniel Drescher. Blockchain Basics: A Non-Technical Introduction in 25 Steps. Berkely, CA, 2017. Apress.).

We can summarize by stating that a blockchain-based system allows a fault-tolerant implementation of a distributed system, where independent nodes reach a consensus on a common shared state (cf. this section), which means that the nodes are able to establish an authoritative blockchain. From this point of view, the blockchain is one possible approach to implementing state machine replication, where the shared state is simply represented by the blockchain, and the pre-defined state transition rules are given by the rules of the blockchain protocol, where a consensus mechanism allows a secure updating of the distributed shared state, namely the blockchain.

This is why a blockchain system is referred to as an eventually consistent system (see this lesson), where eventual consistency means that the data of various replicas may be temporarily inconsistent, i.e., be conflicting to each other, but will eventually be synchronized in order to reflect a common state, whereas consensus mechanisms ensure that all nodes will obtain the same copy and thus the system achieves consistency. This is called state machine replication, which is a method for implementing fault-tolerant services in distributed systems (Fred B. Schneider et al. (1990)Fred B. Schneider. Implementing fault-tolerant services using the state machine approach: A tutorial. ACM Comput. Surv., 22(4):299-319, December 1990 .). As a result, we can declare the blockchain as a possibility to achieve state machine replication.

Get hands-on with 1200+ tech skills courses.