Author: Hu Kai
Editor's Note: The original title is "Smart Contract Series 2: Smart Contract Engineering SCE: Smart Contract Engineering"
Contracts are one of the cornerstones of economic and social operations. The contract determines the time, duration, location and content of the multi-party transaction, so that the parties involved in the contract can execute the contract agreement under the condition of trust or distrust to ensure the normal and orderly operation of the transaction activity. Contracts are usually legally enforceable and are based on written principles. Smart contracts are the foundation of digital social activities, and computer programs can manage the work of mechanical equipment for more complex and efficient digital property transactions. Smart contract codes can even replace lawyers and entities to intelligently handle digital social transactions and legal decisions, and digital assets can be created by embedding smart contract codes into physical entities. We can predict that smart contracts will have huge and widespread demand in the next few years, and smart contract engineering is the path to promote and guarantee development.
- A Venezuelan self-report: In Caracas, I used Bitcoin to pay for the medical expenses of my son’s birth.
- Bitcoin fell below the 8000 mark, can the spot be admitted?
- Bakkt won't bring a bull market, but it doesn't stop there.
- Wal-Mart, Canada launches blockchain-based automated tracking and payment management network
- Market Analysis: The decline is still there, when can it be more?
- Study the Times and publish a comment: the development of blockchain must handle five relationships
1. The background of the origin of smart contract engineering
Just like the role of software engineering in the development of software, the establishment and use of sophisticated engineering principles, a more economical means to obtain reliable software that can run effectively on actual machines; the role of smart contract engineering in smart contracts, It is a series of economic engineering methods for the development and maintenance of smart contracts.
Here we can briefly review the development path of software engineering to predict the development of smart contracts. The encyclopedic entry gives a concise explanation, and the programming phase appeared between 1946 and 1955. The characteristic of this stage is that there is no concept of software. The programming mainly focuses on hardware development. The scale is small, the tools are simple, and there is no clear division of developers and users. The software design phase appeared between 1956 and 1970. The characteristics of this stage are: the hardware environment is relatively stable, the software development team has emerged, and the concept of software has been established.
Then the scale of the software system is getting bigger and bigger, the high-level programming language emerges endlessly, the application field is continuously broadened, the developers and users have a clear division of labor, and the demand for software in the society has increased dramatically. However, the quality of software products is not high, and the production efficiency is low, which led to the emergence of the “ software crisis ” that began in the mid-1960s. The cost, quality, schedule, maintenance and scale production of software cannot be guaranteed. This led to the emergence of the new engineering discipline of software engineering.
Software engineering mainly studies the objective regularity of software production, establishes concepts, principles, methods, techniques and tools related to systematic software production, and guides and supports the production activities of software systems, in order to reduce software production costs and improve software product quality. The goal of increasing the level of software productivity. In the process of software development, people began to develop and use software tools to assist in software project management and technology production. People also integrated the software tools used in each stage of the software life cycle into a whole, forming a continuous support for software development and Maintain an integrated software support environment throughout the process to address software crisis issues in both management and technology.
Software engineering identifies seven basic principles, including design languages, databases, software development tools, system platforms, standards, design patterns, and more. The goal is to develop applicability, effectiveness, modifiability, reliability, comprehensibility, maintainability, reusability, portability, traceability, and interoperability, given the cost and schedule. Operational software products. Software engineering has greatly promoted and guaranteed the production and application of modern software industry scale.
Smart contracts are widely accepted as a chain of software code (Chaincode) on the blockchain. They are a special type of software stored in the blockchain that can be pre-defined, ordered, secure, and verifiable. To implement a specific process, the execution of the contract is to determine the contractual information (status, behavior) of the contractor according to the specified contract terms, and take corresponding actions according to the results of the execution. The functions are similar to those in commercial transactions and supervision and management. The executor of laws and regulations. Due to these characteristics and the huge interest-related relevance of the implementation value transfer, the credibility, credibility, scale production and reliable, correct and monitorable implementation of smart contracts bring new challenges or crises.
These crises have caused great concern. For example, on June 17, 2016, The DAO smart contract running on the Ethereum public chain was attacked. The public funds raised by the contract were constantly being redirected by a function to it. The sub-contract involves a total of more than three million Ethereum, which is a serious smart contract attack. In May 2018, the US chain (BEC) was leaked with security holes. The hackers used the BatchOverFlow vulnerability attack in the ERC-20 smart contract of Taifang, causing price collapse. According to researchers in the UK and Singapore, more than 34,000 smart contracts have been issued. The security contract crisis, which can be exploited, has been highlighted. In May 2017, the author first proposed the smart contract engineering method and applied for related patents. The definition and main contents are briefly introduced below.
2. Definition and main content of smart contract engineering
Definition of Smart Contract Engineering (SCE: Smart Contract Engineering): It is the development, maintenance and execution process of intelligent contract systemization, scale and judgment of software engineering, intelligent methods and legal coding technology.
The development framework of a basic smart contract project is shown in Figure 1:
Figure 1 Smart Contract Engineering Framework
In this framework, three aspects of technology are mainly integrated. One is the theoretical method of traditional software engineering. The Formal Method is an effective means for the contract to perform deterministic high-level verification. The concept of contract is used in formal language. The judgment and reasoning are transformed into a smart contract model, which can eliminate the ambiguity and non-universality of natural language, and then use formal tools to model, analyze and verify the intelligent contract, and finally generate the verified contract code. It is the contract that requires the joint recognition of the participants and is as intelligent as possible. The contract code and text need to ensure consistent consistency testability, and the blockchain distributed mechanism is required to ensure the unchangeable and credible of its code and execution. Language recognition, cognitive theory, and machine learning methods enable complex contract rules to be automatically and automatically converted into smart contract codes. At the same time, smart contract production processes must be smarter and easier to understand, write, deploy, and enforce for users. Third, smart contracts require legal level regulation and calculation laws (Com Putational Law) Study how to use computer technology to realize the expression and automatic execution of legal documents, laws, regulations, contracts, articles of association and other legal documents in electronic media, and to ensure that the rules set by computer code are consistent with the legal rules in the real world. Consistent. In addition, it is also meaningful to describe the complex coupling between contractual trading entities, and to reflect the change and transfer of value. Mathematical methods can be used to analyze the stability and reachability of the system and guide the automatic code generation of smart contracts. At the same time, a series of software tools are provided to support the full lifecycle of service generation, composite application, verification, deployment and operation and maintenance of smart contracts.
We define the ten basic attributes that a smart contract produced under the guidance of a smart contract project should satisfy:
1) Legality: The code complies with legal regulations, and the assets under control have ownership and are legal and valid;
2) Credibility: The contract code generation mechanism must be credible and authoritative, and the results can be verified;
3) Evidence: Process data and scenarios must be stored securely and can be used for legal evidence;
4) Consistency: Smart contracts should be consistent with the text and reviewed by professionals;
5) Intelligence: It can accurately reflect the intellectual consensus of the parties to the contract and the complex natural language logic;
6) Credibility: Static generation and dynamic execution must be correct, safe, reliable and manageable;
7) Observability: The contractor can observe all the states of contract execution through the user interface;
8) Verifiability: The contractor's process of executing the contract is verifiable at runtime;
9) Self-mandatory: Sanctions for breach of contract must be mandatory;
10) Access control: The background, scenarios and relationships related to the contract should be protected as assets. Only when disputes arise, the content can be provided to third parties for inspection.
Under the guidance of smart contract engineering, developers need to complete a series of engineering development stages, including the following basic aspects (can be added):
1) M (Model): contract modeling, contract modeling or template filling according to the agreement;
2) F (Formal): verification of the correctness of contract function attributes and non-function attributes;
3) G (Generation): automatic or semi-automatic generation of contract codes;
4) D(DO): development of contract software to develop intelligent contract software;
5) C (Consistency): Conformance test between the contract code and the contract text, meeting the agreement;
6) L (Law): The contract code satisfies the legalization of the contract, and has the functions of deposit and automatic judgment.
In addition, the smart contract project will also promote innovative expansion theories, methods, development models, plans, standards and tools, etc., and the later series will be introduced gradually.
It can be expected that the relationship between blockchain and smart contracts is like the relationship between early network construction and network application in the development of Internet technology. The development of smart contract scale production technology is just like software engineering plays an important role in developing software. It will become a block. The chain industry and drive applications are the most valuable business.
Author Hu Kai is a professor at the Distributed Laboratory of Beijing University of Aeronautics and Astronautics and the Yunnan Institute of Innovation, Beijing University of Aeronautics and Astronautics.