When people see something happening in real life, they tend to create possible alternatives that are contrary to what actually occurred. This tendency is named “Counterfactual thinking” by Daniel Kahneman, a Nobel laureate in Economics. You might wonder what CounterFactual has to do with blockchain?
In this article, the author would like to share some of his thoughts on blockchain CounterFactual and what it can do for us.
What is CounterFactual?
CounterFactual (CF) thinking is, as it states: “counter to the facts”. These thoughts consist of the “What if?” and the “If I had only…” that occur when thinking of how things could have turned out differently. CounterFactual thoughts include things that–in the present–now could never happen in reality because they solely pertain to events that have occurred in the past.
From the perspective of blockchain, CounterFactual means: the transaction result could be obtained on-chain, but in reality, the execution result is not obtained on-chain.
In the off-chain scaling technology of blockchain, CF refers to CounterFactual Instantiation, which is derived from a state channel-based off-chain scaling technology proposed by L4Lab. It is widely studied and promoted as a type of blockchain scaling design in the field of blockchain research.
CounterFactual Instantiation means that smart contracts can be deployed on the off-chain CF state channel, instead of being counterfactually instantiated on the blockchain. As long as all participants of smart contracts follow the methods defined in the CF state channel protocol, the execution results of the operations in the state channel are fully equivalent to those executed on the blockchain.
Simply put, off-chain CF state channels can achieve the same results as the blockchain, which include not only the state data of smart contracts but also the trustless feature of the blockchain (traceability and irreversibility at its core). Since the results are the same, why not move most smart contract operations off of the chain, considering the limited blockchain performance and the cost-effectiveness of the off-chain solution.
CounterFactual State Channel
In the L4 Paper, the CF state channel protocol is defined as below:
Roughly speaking, for any on-chain operation X that can be channelized, we use counterfactual X to talk about the case where
1. X could happen on-chain, but doesn’t;
2. The enforcement mechanism allows any participant to unilaterally make X happen;
3. Participants can act as though X has happened.
A Closer Look
As a coder, when I see an application protocol, the first reaction is to verify the completeness of the protocol, analyze its feasibility, create its application boundary, and then think about how to implement it.
Let’s now take a closer look at the 3 criteria in the definition of CF state channel:
1. First, CF state channel and blockchain execution environment are equivalent. Any operations in the state channel must be fully equivalent to those in the blockchain execution environment. Therefore, which execution environment users choose is irrelevant to the protocols;
2. Based on the first criterion, the second criterion defines the fairness and trustless feature of CF state channel, or simply “being secure”. State channels are fair to all participants. State modification caused by each operation must be viewable and verifiable to all participants. Based on the first criterion, anyone can directly synchronize the state modification on-chain. Therefore, for state channel participants, CF state channels are as secure as blockchain;
3. The third criterion defines the consistency and finality of CF state channel. Operations and channelized state within the channel must be consistent to all participants and must be instantly finalized. This can ensure the traceability and irreversibility of the state channel for all participants.
From the above, we can see that CF state channels fully possess the existing blockchain properties, such as consistency, irreversibility, security, and finality. Using CF state channels as an off-chain scaling technique will not compromise the security of blockchain applications.
In the next articles, we will dive into the CF state channel protocol and take a look at its application boundary.