CN112417055B - Method for mapping blockchain intelligent contracts to real contracts - Google Patents
Method for mapping blockchain intelligent contracts to real contracts Download PDFInfo
- Publication number
- CN112417055B CN112417055B CN202011432203.XA CN202011432203A CN112417055B CN 112417055 B CN112417055 B CN 112417055B CN 202011432203 A CN202011432203 A CN 202011432203A CN 112417055 B CN112417055 B CN 112417055B
- Authority
- CN
- China
- Prior art keywords
- contract
- real
- intelligent
- template
- intelligent contract
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 238000013507 mapping Methods 0.000 title claims abstract description 16
- 230000006870 function Effects 0.000 claims description 15
- 238000010586 diagram Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004075 alteration Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Abstract
A method of blockchain intelligence contract mapping to real contracts, comprising the steps of: s1, intelligent contract deployment flow: A. uploading intelligent contracts and real contract templates to a system; B. the system checks whether the intelligent contract and the real contract template meet the rule, comprising: whether the hash value in the real contract template is consistent with the value obtained by carrying out hash calculation on the content of the intelligent contract or not; whether the blank field in the real contract template can find a corresponding variable in the intelligent contract or not; C. if the check passes, the system saves the smart contract and the real contract template. By adopting the method and the system of the invention, the logic of the intelligent contract is well described, the problem that the intelligent contract is not friendly and transparent is solved, so that a user can quickly understand the intelligent contract and agree on the intelligent contract, the actual contract template is a file written by using human language, and compared with the program language, the intelligent contract logic described in the file is easy to read by people.
Description
Technical Field
The invention relates to the technical field of blockchains, in particular to a method for mapping a blockchain intelligent contract to a real contract.
Background
The implementation logic on the blockchain is completed by an intelligent contract, the intelligent contract is essentially a section of program written in a specific programming language, the processing logic of the real contract is realized by the section of program, and in all the existing blockchain products, two methods exist for processing the intelligent contract:
(1) The intelligent contract source code is disclosed, a user reads the code by himself and understands the logic of the real contract realized by the intelligent contract source code, and a typical product is a bit coin system;
(2) In addition to the intelligent contract source code disclosure, the code implementation description is written in a text file, the input and output of the code implementation description are marked by variable names, and a user understands the logic of the implemented real contract by combining reading the code and comparing the text file of the implementation description, wherein the code implementation description file is called a Lejia diagram contract, and a typical product is an EOS system;
both of the above methods do not allow the user to clearly understand the logic of the smart contract, and there has been a lack of an effective method to associate the smart contract with the real contract, so that the user of the blockchain effectively understands the processing logic of the smart contract, thus creating a great obstacle to the consensus of the smart contract.
Disclosure of Invention
The invention aims to provide a method for mapping a blockchain intelligent contract to a real contract, which has the advantage of convenient use, and solves the problem that the existing method cannot correspond the intelligent contract to the real contract, so that a blockchain user effectively understands the processing logic of the intelligent contract, and therefore, great obstacle is caused to the consensus of the intelligent contract.
In order to achieve the above purpose, the present invention provides the following technical solutions: a method of blockchain intelligence contract mapping to real contracts, comprising the steps of:
S1, intelligent contract deployment flow:
A. uploading intelligent contracts and real contract templates to a system;
B. the system checks whether the intelligent contract and the real contract template meet the rule, comprising: whether the hash value in the real contract template is consistent with the value obtained by carrying out hash calculation on the content of the intelligent contract or not; whether the blank field in the real contract template can find a corresponding variable in the intelligent contract or not;
C. If the examination passes, the system stores the intelligent contract and the reality contract template;
D. If the check does not pass, returning a system error;
E. Ending the deployment flow;
S2, intelligent contract calling flow:
A. The caller initiates the call of the intelligent contract function or method through the block chain system to provide input parameters;
B. The system records the input parameters as input variables;
C. The system calls an intelligent contract function or method to execute the intelligent contract;
D. after the intelligent contract function or method is executed, the system records a return value or a return variable, or a key and a key value of a writing block, which are all used as output variables;
E. the system searches and opens a real contract template corresponding to the intelligent contract;
F. the system searches in the blank space of the real contract template to find out the domain matched with the name of the input variable or the output variable, and fills the blank space with the value of the input variable or the output variable;
G. After the system is filled with the reserved airspace, the real contract template is stored in a real contract file and written into block data;
H. The system bar block data are packaged and stored in a distributed account book;
I. ending;
S3, checking a real contract:
A. the user inputs parameters such as transaction time, transaction party name and the like, and the system searches a corresponding transaction number through the parameters;
B. Searching a real contract file generated by the intelligent contract when the transaction is executed in an account book through the transaction number;
C. Displaying the real contract file to a user;
A system for mapping blockchain intelligent contracts to real contracts, which is applied to the method, comprises an intelligent contract, a real contract template and a real contract, wherein the intelligent contract and the real contract template are in one-to-one relationship, and the real contract template and the real contract are in one-to-many relationship;
The smart contract consists of three parts:
A. Inputting a variable;
B. Executing code;
C. outputting a variable;
The reality contract template is composed of three parts:
A. contract clauses;
B. Leaving an airspace;
C. Hash value of the smart contract;
After the intelligent contract is operated, the blockchain system matches an input variable before operation and an output variable after operation with a reserved space domain of a real contract template, fills a variable value into the reserved space domain to generate a real contract file, records the mark of the current call in the real contract file, and stores the real contract file in an account book of the blockchain.
Preferably, the execution code in the smart contract may be a function and a method.
Preferably, the output variables in the smart contract include, but are not limited to, return values or return variables of the function or method, key value correspondence written to the ledger.
Preferably, the contract terms in the real contract template are contract treaties written in human language, describing logic of executing code.
Preferably, the space-reserving area in the real contract template is a part of the real contract template reserved with a gap, which is called space-reserving area, and each space-reserving area corresponds to one or more input variable names or output variable names of intelligent contracts and is necessarily corresponding and cannot be blank.
Preferably, the hash value of the intelligent contract in the real contract template is a hash value calculated by recording all the content of the corresponding intelligent contract in the real contract template, so as to bind the corresponding intelligent contract.
Compared with the prior art, the invention has the following beneficial effects:
By adopting the method and the system of the invention, the logic of the intelligent contract is well described, the problem that the intelligent contract is unfriendly and opaque is solved, so that a user can quickly understand the intelligent contract and achieve consensus on the intelligent contract, the real contract template is a file written by using human language, compared with a program language, the intelligent contract logic described in the intelligent contract template is easy to read and understand, the real contract template and the intelligent contract are in one-to-one correspondence, are deployed in the same data area, deployment and modification are synchronous, the two are not separable, the logic of the intelligent contract can be synchronously reflected in the real contract template, the block chain system automatically records input variables and output variables each time the intelligent contract is executed, then the corresponding real contract template is searched, and the reserved area is filled, so that a real contract file is generated, the logic described by the real contract file is consistent with the real contract template, and the process is forced by the system, and each time the real contract is correspondingly realized, namely, the related party achieves one-time agreement. And when the transaction is carried out every time in real life, a contract is signed, the real contract file and the block data are stored in the distributed account book together, so that the distributed account book cannot be tampered, and the real contract file can be traced back according to the transaction number to reflect the situation, the condition, the contract and the like of the transaction at the moment.
Drawings
FIG. 1 is a schematic diagram of the system principle of the present invention;
FIG. 2 is a flow chart of smart contract deployment of the present invention;
FIG. 3 is a flow chart of smart contract invocation in accordance with the present invention;
fig. 4 is a real contract viewing flow chart of the present invention.
Detailed Description
The technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention provides a technical scheme that:
a method of blockchain intelligence contract mapping to real contracts, comprising the steps of:
S1, intelligent contract deployment flow:
A. uploading intelligent contracts and real contract templates to a system;
B. the system checks whether the intelligent contract and the real contract template meet the rule, comprising: whether the hash value in the real contract template is consistent with the value obtained by carrying out hash calculation on the content of the intelligent contract or not; whether the blank field in the real contract template can find a corresponding variable in the intelligent contract or not;
C. If the examination passes, the system stores the intelligent contract and the reality contract template;
D. If the check does not pass, returning a system error;
E. Ending the deployment flow;
S2, intelligent contract calling flow:
A. The caller initiates the call of the intelligent contract function or method through the block chain system to provide input parameters;
B. The system records the input parameters as input variables;
C. The system calls an intelligent contract function or method to execute the intelligent contract;
D. after the intelligent contract function or method is executed, the system records a return value or a return variable, or a key and a key value of a writing block, which are all used as output variables;
E. the system searches and opens a real contract template corresponding to the intelligent contract;
F. the system searches in the blank space of the real contract template to find out the domain matched with the name of the input variable or the output variable, and fills the blank space with the value of the input variable or the output variable;
G. After the system is filled with the reserved airspace, the real contract template is stored in a real contract file and written into block data;
H. The system bar block data are packaged and stored in a distributed account book;
I. ending;
S3, checking a real contract:
A. the user inputs parameters such as transaction time, transaction party name and the like, and the system searches a corresponding transaction number through the parameters;
B. Searching a real contract file generated by the intelligent contract when the transaction is executed in an account book through the transaction number;
C. Displaying the real contract file to a user;
A system for mapping blockchain intelligent contracts to real contracts, which is applied to the method, comprises an intelligent contract, a real contract template and a real contract, wherein the intelligent contract and the real contract template are in one-to-one relationship, and the real contract template and the real contract are in one-to-many relationship;
The smart contract consists of three parts:
A. Inputting a variable;
B. executing codes, wherein the executing codes can be functions and methods;
C. output variables including, but not limited to, return values or return variables of functions or methods, key value correspondence written into ledgers;
The reality contract template is composed of three parts:
A. Contract clauses, which are contractual agreements written in human language, illustrating logic to execute code;
B. leaving airspace, namely a part which is reserved with blank in a real contract template, is called leaving airspace, and each blank area corresponds to one or more input variable names or output variable names of intelligent contracts and is necessary to correspond and cannot be blank;
C. The hash value of the intelligent contract is calculated by recording all the content of the corresponding intelligent contract in a real contract template, so that the corresponding intelligent contract is bound;
After the intelligent contract is operated, the blockchain system matches an input variable before operation and an output variable after operation with a reserved space domain of a real contract template, fills a variable value into the reserved space domain to generate a real contract file, records the mark of the current call in the real contract file, and stores the real contract file in an account book of the blockchain.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.
Claims (6)
1. A method for mapping a blockchain smart contract to a real contract, characterized by: the method comprises the following steps:
S1, intelligent contract deployment flow:
A. uploading intelligent contracts and real contract templates to a system;
B. the system checks whether the intelligent contract and the real contract template meet the rule, comprising: whether the hash value in the real contract template is consistent with the value obtained by carrying out hash calculation on the content of the intelligent contract or not; whether the blank field in the real contract template can find a corresponding variable in the intelligent contract or not;
C. If the examination passes, the system stores the intelligent contract and the reality contract template;
D. If the check does not pass, returning a system error;
E. Ending the deployment flow;
S2, intelligent contract calling flow:
A. The caller initiates the call of the intelligent contract function or method through the block chain system to provide input parameters;
B. The system records the input parameters as input variables;
C. The system calls an intelligent contract function or method to execute the intelligent contract;
D. after the intelligent contract function or method is executed, the system records a return value or a return variable, or a key and a key value of a writing block, which are all used as output variables;
E. the system searches and opens a real contract template corresponding to the intelligent contract;
F. the system searches in the blank space of the real contract template to find out the domain matched with the name of the input variable or the output variable, and fills the blank space with the value of the input variable or the output variable;
G. After the system is filled with the reserved airspace, the real contract template is stored in a real contract file and written into block data;
H. The system bar block data are packaged and stored in a distributed account book;
I. ending;
S3, checking a real contract:
A. the user inputs parameters such as transaction time, transaction party name and the like, and the system searches a corresponding transaction number through the parameters;
B. Searching a real contract file generated by the intelligent contract when the transaction is executed in an account book through the transaction number;
C. Displaying the real contract file to a user;
A system for mapping blockchain intelligent contracts to real contracts, which is applied to the method, comprises an intelligent contract, a real contract template and a real contract, wherein the intelligent contract and the real contract template are in one-to-one relationship, and the real contract template and the real contract are in one-to-many relationship;
The smart contract consists of three parts:
A. Inputting a variable;
B. Executing code;
C. outputting a variable;
The reality contract template is composed of three parts:
A. contract clauses;
B. Leaving an airspace;
C. Hash value of the smart contract;
After the intelligent contract is operated, the blockchain system matches an input variable before operation and an output variable after operation with a reserved space domain of a real contract template, fills a variable value into the reserved space domain to generate a real contract file, records the mark of the current call in the real contract file, and stores the real contract file in an account book of the blockchain.
2. The method of mapping blockchain smart contracts to real contracts according to claim 1, wherein: the execution code in the smart contract may be functions and methods.
3. The method of mapping blockchain smart contracts to real contracts according to claim 1, wherein: output variables in the smart contract include, but are not limited to, return values or return variables of functions or methods, key value correspondence written into the ledger.
4. The method of mapping blockchain smart contracts to real contracts according to claim 1, wherein: the contract terms in the real contract template are contract treaties written in human language, describing logic of executing code.
5. The method of mapping blockchain smart contracts to real contracts according to claim 1, wherein: the blank space in the real contract template is a part of the real contract template which is reserved with blank space, which is called blank space, and each blank space corresponds to one or more input variable names or output variable names of intelligent contracts and is necessary to correspond and cannot be blank.
6. The method of mapping blockchain smart contracts to real contracts according to claim 1, wherein: the hash value of the intelligent contract in the real contract template is calculated by recording all the content of the corresponding intelligent contract in the real contract template, so that the corresponding intelligent contract is bound.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011432203.XA CN112417055B (en) | 2020-12-10 | 2020-12-10 | Method for mapping blockchain intelligent contracts to real contracts |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011432203.XA CN112417055B (en) | 2020-12-10 | 2020-12-10 | Method for mapping blockchain intelligent contracts to real contracts |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112417055A CN112417055A (en) | 2021-02-26 |
CN112417055B true CN112417055B (en) | 2024-04-26 |
Family
ID=74776716
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011432203.XA Active CN112417055B (en) | 2020-12-10 | 2020-12-10 | Method for mapping blockchain intelligent contracts to real contracts |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112417055B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110827145A (en) * | 2018-08-07 | 2020-02-21 | 北京果仁宝软件技术有限责任公司 | Processing method and system based on block chain intelligent contract |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109543457A (en) * | 2018-11-07 | 2019-03-29 | 泰康保险集团股份有限公司 | The method and device called between control intelligent contract |
CN110222067A (en) * | 2019-05-31 | 2019-09-10 | 杭州时戳信息科技有限公司 | The method and system of block chain intelligence contract anchoring trusted external data base |
CN110827145A (en) * | 2018-08-07 | 2020-02-21 | 北京果仁宝软件技术有限责任公司 | Processing method and system based on block chain intelligent contract |
CN111209596A (en) * | 2020-04-21 | 2020-05-29 | 国网电子商务有限公司 | Block chain-based industrial internet identification analysis access control method |
CN111752574A (en) * | 2020-05-08 | 2020-10-09 | 北京科技大学 | Intelligent executable contract construction and execution method and system of legal contract |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018140913A1 (en) * | 2017-01-30 | 2018-08-02 | SALT Lending Holdings, Inc. | System and method of creating an asset based automated secure agreement |
-
2020
- 2020-12-10 CN CN202011432203.XA patent/CN112417055B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110827145A (en) * | 2018-08-07 | 2020-02-21 | 北京果仁宝软件技术有限责任公司 | Processing method and system based on block chain intelligent contract |
CN109543457A (en) * | 2018-11-07 | 2019-03-29 | 泰康保险集团股份有限公司 | The method and device called between control intelligent contract |
CN110222067A (en) * | 2019-05-31 | 2019-09-10 | 杭州时戳信息科技有限公司 | The method and system of block chain intelligence contract anchoring trusted external data base |
CN111209596A (en) * | 2020-04-21 | 2020-05-29 | 国网电子商务有限公司 | Block chain-based industrial internet identification analysis access control method |
CN111752574A (en) * | 2020-05-08 | 2020-10-09 | 北京科技大学 | Intelligent executable contract construction and execution method and system of legal contract |
Non-Patent Citations (2)
Title |
---|
An overview of smart contract and use cases in blockchain Technology;Bhabendu Kumar Mohanta 等;《2018 9th international conference on computing,communication and networking technologies》;20181018;第1-2页 * |
基于区块链的智能合约技术研究进展;朱岩 等;《网络空间安全》;20200916;第11卷(第9期);第19-24页 * |
Also Published As
Publication number | Publication date |
---|---|
CN112417055A (en) | 2021-02-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103383645B (en) | Code generating method and system | |
US8266087B2 (en) | Creating forms with business logic | |
CN104572072B (en) | A kind of language transfer method and equipment to the program based on MVC pattern | |
US20150339269A1 (en) | System and method for generating flowchart from a text document using natural language processing | |
CN105512304A (en) | Method for generating internet applications on line, system integration method and supporting platform | |
CN112417055B (en) | Method for mapping blockchain intelligent contracts to real contracts | |
CN106934011A (en) | A kind of structuring analysis method and device of JSON data | |
CN112015626A (en) | User behavior recording method, device and equipment | |
US20020026632A1 (en) | Universal computer code generator | |
CN107092478A (en) | The integrated system and method for a kind of software component library and component development instrument | |
CN114047928B (en) | Intelligent contract formal verification method and system suitable for combined transaction | |
CN107273127A (en) | Method and device for realizing page plug-in web application | |
CN110109675A (en) | Intelligent contract processing method, device and computer readable storage medium | |
D’Abrera et al. | A formally verified cut-elimination procedure for linear nested sequents for tense logic | |
Best et al. | A unified model for nets and process algebras | |
Zheng et al. | Mapping features to source code through product line architecture: Traceability and conformance | |
Santos et al. | Transformation of UML behavioral diagrams to support software model checking | |
Fiorini et al. | Process reuse architecture | |
KR102340903B1 (en) | Apparatus and method for generating smart contract of legal contract based on block chain | |
CN107862066B (en) | Court writing system and implementation method thereof | |
US20110022501A1 (en) | Service change component generation system, method and recording medium | |
CN109657117A (en) | A kind of extraction method, system and the computer storage medium of webpage element | |
CN110473092A (en) | It is a kind of efficiently to read intelligent contract householder method | |
JPWO2020254962A5 (en) | ||
Bernardi et al. | Integrating model driven and model checking to mine design patterns |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |