text
stringlengths
0
1.08k
The achievement of a *resilient and reliable* chronological ordering for distributed systems, which embeds important properties such as permissiveness and censorship resistance, was reached by Satoshi Nakamoto with the invention of Bitcoin, using the blockchain data structure and a **Proof-of-Work (PoW)** consensus whi...
We will discuss various kinds of **Distributed Consensus Systems** which have some degree of hierarchy and interrelated properties between them. They are differentiated on **how they determine and enforce the most updated state of the system**:
* **Blockchain + PoW Mechanism**. The sequence of **state transitions** is public and auditable and is organized in **transactions** included in ordered blocks which are added one upon the other. The system's security lies in the amount of work required to produce an alternative chain which reverts the actual greater-w...
* **State Channels**. Is a system constructed between 2 (or more) parties and which **depend hierarchically** on the blockchain layer. **The final state is represented by the last transaction out of sequence of ordered invalidating transactions, signed and agreed by the parties \_off-chain**\_. The final state can be e...
* **Client Side Validated Data - Stash**. Is a system that c**an be implemented both on top of blockchain and state channels** and it is based on a certain amount of data whose validity, computation tasks and uplocatesdate is entrusted to a limited number of nodes. Unlike layer 1, the data to be validated by each clien...
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-b0fe0680aec1986998fa2ff39b1ab8a9b26f9ac5%2Fdistributed-data-inc.png?alt=media" alt=""><figcaption><p><strong>The 3 set of Distributed System - Blockchain (Layer 1) is self-su...
In order to precisely frame the applications of each Distributed Consensus System and their underlying data structure it's important to understand the limitations that affect each one of these technology. This condition is expressed in form of a **Trilemma** which is connected to an important theoretical result of Dist...
> Any distributed system can provide simultaneously only two of the following three guarantees:
>
> * Consistency - Every node in the system agree on the current global state.
> * Availability - Every request to the system receives a response.
> * Partition Tolerance - The system continues to operate correctly despite a network partition, e.g. failures or delays between nodes.
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-da96fa00c1cbafb8e44612905fe8c89b6be8fcd1%2Fcap-theorem-full.png?alt=media" alt=""><figcaption><p><strong>Application of CAP Theorem to Distributed Consensus System - Each Dis...
Seen from a more consensus-focused point of view, the properties of the theorem can be reformulated in the following way:
* **Consistency** ==> Integrity
* **Availability** ==> Decentralization
* **Partition Tolerance** ==> Scalability and Confidentiality
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-99f2d0ad58fee36b14d86f63b148dbe37069c42a%2Ftrilemma1.png?alt=media" alt=""><figcaption><p><strong>A more in-depth view of the inherent degree of application of the Trilemma t...
In synthesis:
* **Blockchains** preserve Integrity and Decentralization but **lack Scalability** and Confidentiality as each node needs to replicate *publicly and in full* every state transition.
* **State Channels** preserve Decentralization and Scalability but **don't preserve Integrity** as the state can be changed or updated asynchronously by the counterparties.
* **Stashes of client-side validated data** are Scalable and maintain Integrity however, they **are not replicated** by the vast majority of nodes of the network **lacking Availability**. For this reason, these data are not fully recoverable in a completely decentralized way and some form of centralized backup is neede...
An important feature to take into account is the different ways through which State Channel and Client-Side validation architectures update the state of the data:
* Channel state must be **synchronous** between the counterparts.
* Client-side validated state updates can be **asynchronous**.
Naturally, if the client-side validated data are embedded in the state channels, the state update will be ultimately based on an asynchronous process.
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-e7b41ac98057bcea6851c1786c89b494433f9f7f%2Ftriangle-bifi.png?alt=media" alt=""><figcaption><p><strong>Blockchain is the base layer over which multiple-interacting layers can ...
In addition to the three layers just described, a fourth layer of Bitcoin Finance (#BiFi) which leverages both state channels and blockchain can complete the whole ecosystem. The general picture and the deep interconnections of all the layers, with the blockchain layer at the base, allow to achieve all the properties o...
In the next section, we will delve into Client-side Validation and its features.
***
# Client-side Validation
The goal of every validation process in a distributed system is the **ability to assess the validity and chronological ordering of states**, hence to verify the correctness of the protocol rules of the state transitions that have occurred.
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-f5dffdee91a318e1e783d26160e160c6386303ad%2Fstate-passages.png?alt=media" alt=""><figcaption><p><strong>Consensus system allows for the tracking of the state evolution of some...
In Bitcoin Blockchain, for instance, this process is meant to verify the correctness of the changes in the [UTXO set](https://en.wikipedia.org/wiki/Unspent_transaction_output) determined by the transactions collected into the sequence of ordered blocks. Thus, every block represents a **state update**.
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-a7998cbd9b28654c736e036dd124eb37c8411964%2Futxo-set-1.png?alt=media" alt=""><figcaption><p><strong>In Bitcoin the System State is represented by the UTXO Set, reflecting the ...
The main drawback of Layer 1's validation process is that **each node has to validate each transaction from everybody and store the related data** once block inclusion takes place. This architecture leads to two main issues:
* **Scalability**: the size limit of the blocks vs. the demand of blockspace per unit time shared by all willing participants limits the transaction throughput (i.e. a maximum of 1 MB on \~10 minutes on average on bitcoin, taking into account [witness discount](https://en.bitcoin.it/wiki/Segregated_Witness)).
* **Privacy**: details of each transaction are broadcasted and stored in public form (in particular: the amounts transacted and the receiving addresses, although pseudonyms).
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-849e21c2dbade3ea65307297b75ecf106c0e1fee%2Fblockchain-1.png?alt=media" alt=""><figcaption><p><strong>In Public Blockchains everyone needs to validate all the information lead...
However, from the point of view of the recipient of a transaction, the only aspects that matter are:
* The last state transition, that is represented by a transaction addressed to him.
* The chronological sequence of transactions (and thus state transitions) leading up to the last state transition.
Basically, what is relevant to the recipient is the [Directed Acyclic Graph](https://docs.rgb.info/annexes/glossary#directed-acyclic-graph-dag) which connects the history of the state transitions from the [Genesis](https://docs.rgb.info/annexes/glossary#genesis) to the last state addressed to him (a [Shard](https://doc...
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-367f68dff0e8841fed5e6b5067dde4f13b9f5ab0%2Ftransaction-graph-1.png?alt=media" alt=""><figcaption><p><strong>The transaction graph of Public Blockchains cannot be sharded due ...
For this reason, the **logic of validation can be reversed** in the following terms:
* Each part validates its **own part of the history** and thus the digital properties that matter to him.
* A compact reference of the **validated state transition is committed in Layer 1** to be timestamped. This construction constitutes a [Proof-of-Publication](https://petertodd.org/2017/scalable-single-use-seal-asset-transfer) and acts as an **anti double-spending measure**.
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-f9bda9ec3c889de1b2b17541049ea759ff698419%2Fcsv-blocks-1.png?alt=media" alt=""><figcaption><p><br><strong>Layer 1's blocks are kept public, but client-side validated state tra...
**Client-side Validation** ensures that the following properties are met:
* **Scalability**: since the commitment of the verified state, which must be stored by all, has, at least, a small footprint (order of tens of bytes), or, in [some commitment scheme](https://docs.rgb.info/commitment-layer/deterministic-bitcoin-commitments-dbc/tapret), no additional footprint in respect to an ordinary t...
* **Privacy**: using a [one-way cryptographic hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function) (such as [SHA-256](https://en.wikipedia.org/wiki/SHA-2)), the original data (the pre-image) that produced the commitment cannot be reconstructed and it is kept private by the parties.
<figure><img src="https://160813645-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FaUAGORrT1fl6qzaZSTKt%2Fuploads%2Fgit-blob-d17d30f9b44773d10e2fe6027332476befc0baad%2Fcsv-shard-1.png?alt=media" alt=""><figcaption><p><strong>Several shards can be aggregated in a single Layer 1 transaction. The Anch...
The commitment structure used in Client-Side Validation (as in the RGB protocol, which we will cover in detail [later](https://docs.rgb.info/commitment-layer/commitment-schemes)) allows for important additional scalability features:
* Aggregate state transitions of different contracts (e.g., two different contracts related to 2 different digital assets committed in a single Bitcoin transaction).
* Bundle more than one state transition of the same asset in the same client-side operation.
[Anchor](https://docs.rgb.info/commitment-layer/anchors) structures provide the deterministic link between the [single-use seal](https://docs.rgb.info/distributed-computing-concepts/single-use-seals) and the client-side data that represent the message to which the [single-use seal is closed over](https://docs.rgb.info/...
To guarantee the efficacy of the commitment scheme and precise chronological ordering derived from Layer 1, the use of a new cryptographic primitive needs to be introduced: the **Single-use Seal**.
***