Getting started with blockchain | What exactly is a smart contract?

The "smart contract" of the blockchain is a controversial concept. Once Vitalik also regretted using the name smart contract, it was better to call "persistent scripts", which was about to get tired of this concept. Someone also asked this thing is a program script, where is the intelligence? But if you say this, there isn't a thing worthy of being named "smart" right now. Can a smartphone be called a mobile phone with free software? Moreover, the English smart and intelligent are translated into "smart" in Chinese, which is even more misleading.

So in that debate, some people suggested that it be called "stored procedures", which is the stored procedure of the database. If the blockchain is treated as a distributed database, the smart contract is really like a database stored procedure in terms of technical implementation. Using a new programming language is not a different one. If you use a more general-purpose VM, you can use exactly the same programming language as other programs. In addition, the deterministicity that people often say is actually the characteristic of the Turing machine itself. As long as the random mechanism is not introduced, it is difficult to write a program that is not deterministic. So why did you create a new vocabulary? Apply a common saying, what do we mean when we talk about "smart contracts"?

If you don't see much difference from a technical point of view, then let's take a look at the legal "contract" point of view. According to the definition of Wikipedia:

Contract: A contract is a legally-binding agreement which recognises and governs the rights and duties of the parties to the agreement.

A contract is a legally binding agreement that defines the rights and obligations of the parties. In other words, the form of the contract is actually not important, it can be textual or verbal, and the key is to be legally binding.

Then we apply the "smart contract", it can also be said that the performance of the smart contract is not the key, the key is the "binding force." Here we give a definition:

A smart contract is a computer program that defines the rights and obligations of all parties and has a "binding force".

How does the "binding force" of the computer program arise?

Binding of smart contracts

Before analyzing the binding force of smart contracts, let's take a look at the binding force of legal contracts. The legal binding comes from two aspects. On the one hand, the parties who sign the contract have a clear intention to express the contract. For example, if the bragging on the wine table is difficult, it is difficult to be a contract. The contract has a clear distinction from the daily conversation and the text. Written contracts are more likely to reduce the cause of misunderstandings in this regard. On the other hand, public power provides such a system of judicial enforcement. When the contract fails to perform properly, it can seek the enforcement of public power.

If a country's judicial system is equivalent to an operating system that defines rules through natural language, a contract is a program written in natural language on this operating system. The interpretation of natural language is of course a human brain, but because of the imperfections of natural language and the differences between people, how to ensure the certainty of the results of the implementation? How to prevent executives from cheating? These two problems are the problems that the judicial system has been exploring for thousands of years.

Switching to smart contracts, due to the characteristics of the Turing machine, the certainty of the program execution results is easy to guarantee, the key problem is how to prevent cheating, how to prove that the results of the program execution have not been tampered with?

The credibility of the results of program execution depends on the organization or personal credibility of the control program execution hardware. For current software systems, such as banks or Internet applications, users can trust the results of program execution in a trust organization manner. The binding force is unilateral, and the end user is bound by the program, but the service provider is almost unconstrained by the program. If the user disagrees with the result, he can only resort to other means, such as the judiciary, or if a user of an exchange has gone to the company's door to pull a banner protest.

If the program can be repeatedly verified on hardware that is controlled by different organizations or individuals, can this trust dependency be removed? At the same time, achieve the constraints on both sides? This is also true in the judicial system, such as the first-instance, second-instance, final-trial and other mechanisms, but the implementation cost of the judicial system is too high, and the verification is repeated after controversy, and the number of times is limited. However, the cost of the computer program is much lower, so the verification can be repeated on a large scale.

If you only have the ability to verify, you can't actually be binding, and you need to have enforcement power. If the subject matter of the dispute between the two parties can be directly operated by the program, verification and execution can be implemented. At this point, the blockchain guarantees execution by defining digital assets and economic systems.

Repeated validation bottleneck

Although the cost of computer-repeated verification is much lower than that of human flesh, if each transaction requires repeated verification and execution, the cost is high. This is what we often call the TPS (number of transactions per second) problem of the blockchain. That court enforcement efficiency is so low, why is it not a bottleneck in real social transactions? The current practice of blockchain is equivalent to the court having mastered the assets of all people and the details of contract execution. Each contract execution is carried out through the courts, which of course becomes a bottleneck.

In reality, most contracts do not create differences or disputes, so there is no need for a court to decide. The court does not need to know the details. Only when a dispute arises, the court needs to decide. At this time, the parties can submit relevant evidence. Can this mechanism be moved to the chain? This is what the Layer 2 network (Layer 2) network is trying to achieve. The key question is how can the contractual binding force under the chain arise without repeated verification on the chain?

The Ethereum community introduced the concept of “counterfactuality” into the blockchain and proposed a counterfactual state channel, trying to sum up a general two-layer design principle of blockchain. The "counterfacts" here are similar to the "counterfacts" in the legal system. The binding force of the legal contract itself comes mainly from this counterfactual reasoning. If one party violates the contract and the other party can enforce it through the judiciary, the best strategy for both parties is to faithfully execute the contract, so the contract is binding. Similarly, if a smart contract is not executed on the chain, if any party can make it execute on the chain if there is a disagreement, it will also be binding.

In theory, unlimited TPS can be supported in this way.

Another form of smart contract

The smart contracts mentioned above are expressed through programming languages. The programs executed on the chain, even if they are placed under the chain, need to be guaranteed to be executed on the chain, otherwise they cannot be decided. But since we are concerned with binding, repeated verification is only one way to achieve binding, is there any other way to achieve binding? For example, when the court decides the contract, it is not repeated and then verified, but the proof of the execution result submitted by both parties, or the proof of the result of the other party's approval, such as signature.

The "smart contract" on Bitcoin is similar to this mechanism. Under the bitcoin model, the lock script is equivalent to a lock, which determines the ownership of the BTC of the transaction output. It is not allowed to define the contract, but it can set the unlock condition by cryptography to achieve the contract effect, such as implementing two. Exchange of digital assets (equivalent to trading contracts). The specific implementation is not detailed here. You can look at atomic exchange, lightning network, and Discreet Log Contracts based on Schnorr signature.

The idea of ​​this mechanism is that the specific implementation of the contract is not important, as long as the guarantee of the subject matter of the final dispute of the contract can achieve the binding effect. Of course, under this mechanism, the types of contracts that contracts can express are limited.

Some time ago we also did a small experimental project to try to implement smart contracts on the lightning network. Participants verify each other's contracts. When there is a dispute, they arbitrate through the arbitration service node. The assets are mortgaged by the lightning time network's hash time lock mechanism. The arbitrator can decide the ownership of the deposit, but cannot directly take the deposit. Although there is also the possibility of joint cooperation, the disadvantages of joint cooperation also have the cost of trust, and the risk is less than the deposit custody.

At this point, you can see it. If we focus on the construction of smart contract binding, the verification, ruling, and execution of the contract can be dismantled and not necessarily implemented at the same level.

Two routes for smart contracts in the future

If we only pursue binding, there is not much difference in the development of smart contracts, but smart contracts are also a kind of program, which has all the characteristics of the program, so there is a difference.

In order to be able to verify the contract, the state of the smart contract and the input parameters are preserved in the chain, which means that the storage capacity is provided, and the contract running environment is provided, which provides the computing power. With these two capabilities, in theory any Internet application can be moved to the chain, and at the same time it is binding. So Ethereum defines itself as a world computer, and EOS defines itself as an OS, a platform for running decentralized application DApps.

However, there have been no major improvements in the DApp trials for several years. At first, everyone thought it was a limitation of TPS, so EOS reduced the nodes participating in the consensus through the DPoS mechanism to achieve a higher TPS. In theory, it can also run a small-scale Internet application, but it still has not improved much. Where is the problem?

The key is that we are always thinking about DApp according to the mode of Internet application. The mode of Internet application is to provide a system for everyone, the state storage and computing power required by the application itself, and the state storage and computing power generated by the need to implement constraints. Mixed together, so almost no value for an Internet application can withstand replicas of this size and double counting.

So now the development of smart contracts and DApps can be roughly divided into two directions:

1. Focus on the binding force of the contract, the necessary calculations and storage are only the basis for achieving binding . In this way, the developer should analyze the application itself, disassemble the calculations and states that need to be constrained, that is, the part that represents the contract between the application and the user, and then construct the proof and verification mechanism, and only submit the necessary data to On the chain, the chain does not need to be re-executed, and the calculations and storage unrelated to the contract are still in the chain. Most of the two-layer networks, as well as the multi-chain, cross-chain system constraints and arbitration mechanisms, are taking this direction.

The easiest way to achieve this is the DeFi class of applications. Because such applications require a state of constraint, it is an asset that solves the problem of fund custody through the binding of smart contracts. And most of the legal contracts in reality are actually related to assets. If the actual legal contracts can be transferred to chain execution or arbitration, the imagination space is very large. The biggest challenge facing this route is not technology, but conflicts with real laws and changes in social cognition.

2. Focus on computing or storage capabilities. Binding is only a means for users to trust hardware resource providers . With this binding, you can build an open system that absorbs more and cheaper hardware resources. If you only want to ensure the necessary security, you can reduce duplicate verification and storage copies, in order to provide DApp with cheaper computing and storage capabilities than the cloud platform, at least not too much cost, the price difference can be open To make up. Such as Filecoin, Truebit, etc. Under this kind of route, in the short run, it is still difficult to surpass the cloud platform in terms of cost and reliability. The technical difficulty is more than the first route, but the advantage is that the actual resistance is not so great.

Of course, there are difficulties in both directions, and there is no conflict. It is best to succeed in both directions and they can be combined with each other. But if you try to achieve two directions at the same time, there will be conflicts, which I personally think is impossible.

Enlightenment to the judicial system

Since smart contracts can be enforced through blockchains, can real-world legal contracts simulate such systems to reduce judicial costs? Then let us assume what conditions are needed if the actual legal contract is to be arbitrated by computer. For example, a loan contract, one party claimed to pay back the money, there is a transfer record as evidence, the other party thinks that there is no return, saying that the transfer is not a repayment, is another reason. How to implement software program ruling?

First, there is a programming language to express this contract.

Second, both parties must have a digital certificate identity and sign the smart contract.

Again, the bank needs to provide a mechanism to link the transfer record to the contract at the time of transfer. At the same time, a digital certificate and a verification interface for the certificate are provided to both parties.

Finally, the court's ruling procedure verifies the identity of both parties through a digital certificate, verifies the repayment transaction through the bank's digital vouchers, and runs the contract for verification. Basically, the ruling can be made, and the bank can execute the ruling after the result of the ruling.

Although this process is a bit simplified, it is theoretically feasible, and the basic technology is also available, but the current different systems are still fragmented, unable to provide digital proof mechanism, and the digital certificate identity system is still missing.

Therefore, I have always suggested that legal persons can also pay attention to smart contract technology. Although this technology is not yet mature, its advantages over legal contracts are very obvious:

  1. The expression is unambiguous and the execution results are clear.
  2. Cross-natural language, universal.
  3. Computer arbitrage, pre-executable.

Although it is not enough to say how popular it is in the future, at least in theory, with the digitization of future assets, most asset-related contracts can be expressed through smart contracts.

to sum up

There is a saying in the blockchain field called Code is law, the code is both legal, in fact I think it should be reversed, say Law is Code. Blockchains and smart contracts are meant to build a binding system through code, describe the rules (laws) in code, and express and enforce rules (laws) through code.

This mechanism, if viewed from the legal system, is a major change in the millennium. Its significance is comparable to the fact that humans have carved text on the stone thousands of years ago. If the experiment is successful, it is possible to construct a legal system that is independent of national sovereignty. The restrictions on software exports by the US Open Source Foundation in the past two days have caused much controversy. Why does the Open Source Foundation have to register with a certain country? Because the open source foundation also needs funds to operate, it needs a bank account. In the event of an economic dispute, it also needs to rely on the existing judicial system to decide. But the blockchain has created digital assets. With the ability to define organizations and have a ruling system, it is possible to have open source organizations that are independent of the state.

Of course, is it possible to completely replace the legal system in reality? This is also impossible. After all, the ultimate sanction is to sanction the human body, unless one day, humans really upload their brains to the Internet, the real body and assets are completely meaningless to people. But maybe it? One explanation for Fermi's paradox is that aliens feel that the reality of the universe is too boring, so they upload themselves to the digital world.

Related Links

Vitalik talks about smart contract push https://twitter.com/VitalikButerin/status/1051160932699770882 Discreet Log Contracts https://adiabat.github.io/dlc.pdf A project to implement smart contracts on Lightning Networks https://github .com/starcoinorg/thor

Author: jolestar

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Intercontinental Exchange CEO: The bear market will boost the implementation of the Bakkt Bitcoin futures program

According to Coindesk's May 3 report, an executive at Bakkt's parent company on the Bitcoin Futures Exchang...

Blockchain

After carrying a huge debt and shutting down TradeBlock, the former crypto empire DCG is now struggling for survival with one arm.

As the liquidity crisis in encryption erupted, the market declined, and the previous blind expansion and investment h...

Blockchain

Thousands of exchange platform license thresholds reach the cloud or 5 platforms enter the Hong Kong Securities Regulatory Commission's sandbox

Source: 21st Century Business Herald Author: Zhou scorching The confrontation between the United States and Iran has ...

Market

The first debate of the Republican primary ended. Which candidates are friendly to cryptocurrencies?

The first debate of eight Republican presidential candidates in the United States ended on Wednesday evening (August ...

Blockchain

Bella Fang: The exchange is at the top of the food chain. How can small and medium-sized projects seize this channel?

On the afternoon of the 9th, at the 2nd Global Blockchain Summit·Wuzhen site hosted by Babbitt, Bella Fang, foun...

Blockchain

Latest updates on regulatory events: CZ releases internal memo, Gensler criticizes two exchanges again.

According to Gensler, his agency has obtained internal communications that allegedly indicate intentional illegal beh...