Implementing State Replication by Using Blockchain
Let's explore how to use blockchains to perform state replication.
We'll cover the following
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
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
This approach enables a fault-tolerant system. As mentioned by
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 (
Authoritative chain
The collectively selected version of the transaction history is called the authoritative chain or main chain (
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 (
Get hands-on with 1200+ tech skills courses.