CN113050925B - Block chain intelligent contract repairing method and device - Google Patents

Block chain intelligent contract repairing method and device Download PDF

Info

Publication number
CN113050925B
CN113050925B CN202110295709.9A CN202110295709A CN113050925B CN 113050925 B CN113050925 B CN 113050925B CN 202110295709 A CN202110295709 A CN 202110295709A CN 113050925 B CN113050925 B CN 113050925B
Authority
CN
China
Prior art keywords
intelligent contract
repairing
blockchain
code
flow chart
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
Application number
CN202110295709.9A
Other languages
Chinese (zh)
Other versions
CN113050925A (en
Inventor
夏韵
裴磊
夏琼
吴业骏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110295709.9A priority Critical patent/CN113050925B/en
Publication of CN113050925A publication Critical patent/CN113050925A/en
Application granted granted Critical
Publication of CN113050925B publication Critical patent/CN113050925B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0633Workflow analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The invention provides a method and a device for repairing a block chain intelligent contract, and belongs to the technical field of block chains. The intelligent contract repairing method for the blockchain comprises the following steps: uploading the intelligent contract to the blockchain testing network so that the blockchain testing network executes the intelligent contract and generates an operation log; receiving an operation log from a block chain test network, and generating an actual business flow chart according to the operation log; comparing the actual business flow chart with a corresponding preset business flow chart to generate a repair code; and repairing the intelligent contract according to the repairing code. The invention can reduce the development and operation cost of the intelligent contract and improve the accuracy of the logic in the intelligent contract.

Description

Block chain intelligent contract repairing method and device
Technical Field
The invention relates to the technical field of blockchains, in particular to a blockchain intelligent contract repairing method and device.
Background
The intelligent contract can only be tested by being deployed on a blockchain network, the test is generally realized by adopting a test means of compiling an automatic test case and carrying out a large number of input and output checks, and a plurality of companies provide static code scanning and formal verification modes of the intelligent contract to restrict the compiling specification of the intelligent contract.
Although many automation tools ensure the specification and a large number of tests of contracts, the problem investigation and the repair of contract problems in the tests are mainly completed by manually checking a contract execution log, and the accuracy of contract execution is dependent on manual work, so that two problems are caused: firstly, the development and operation of intelligent contracts have high labor cost, the contracts themselves must be tested by executing transactions through a deployment network, if execution errors occur or the results are wrong in the test process, the code problems can be checked and repaired only by manually checking the contract execution logs and finding error reporting information; secondly, the logic accuracy of the intelligent contract cannot be guaranteed, the contract code is a collection of business logic, the integrity of the transaction link on the chain cannot be tracked in real time, the logic loophole can be passively discovered only when checking accounts or reporting errors, and the problem is difficult to reproduce due to unclear links.
Disclosure of Invention
The main purpose of the embodiment of the invention is to provide a method and a device for repairing a blockchain intelligent contract, so as to reduce the development and operation cost of the intelligent contract and improve the accuracy of logic inside the intelligent contract.
In order to achieve the above object, an embodiment of the present invention provides a blockchain intelligent contract repairing method, including:
uploading the intelligent contract to the blockchain testing network so that the blockchain testing network executes the intelligent contract and generates an operation log;
receiving an operation log from a block chain test network, and generating an actual business flow chart according to the operation log;
comparing the actual business flow chart with a corresponding preset business flow chart to generate a repair code;
and repairing the intelligent contract according to the repairing code.
The embodiment of the invention also provides a device for repairing the intelligent block chain contract, which comprises the following steps:
the uploading module is used for uploading the intelligent contract to the blockchain testing network so that the blockchain testing network executes the intelligent contract and generates an operation log;
the actual business flow chart module is used for receiving the operation log from the blockchain test network and generating an actual business flow chart according to the operation log;
the repair code module is used for comparing the actual business flow chart with the corresponding preset business flow chart to generate a repair code;
and the intelligent contract repairing module is used for repairing the intelligent contract according to the repairing code.
The embodiment of the invention also provides computer equipment, which comprises a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor realizes the steps of the blockchain intelligent contract repairing method when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program realizes the steps of the blockchain intelligent contract repairing method when being executed by a processor.
According to the method and the device for repairing the intelligent contracts of the blockchain, the intelligent contracts are uploaded to the blockchain test network, so that the blockchain test network executes the intelligent contracts and generates the operation logs, then the actual business flow charts are generated according to the operation logs, the actual business flow charts are compared with the corresponding preset business flow charts to generate repairing codes, finally the intelligent contracts are repaired according to the repairing codes, the development and operation cost of the intelligent contracts can be reduced, and the accuracy of logic inside the intelligent contracts is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a block chain intelligent contract repair method in accordance with an embodiment of the present invention;
FIG. 2 is a flow chart of a block chain intelligent contract repair method in accordance with another embodiment of the invention;
FIG. 3 is a flowchart of S104 in an embodiment of the invention;
FIG. 4 is a practical business flow diagram in an embodiment of the invention;
FIG. 5 is a schematic diagram of a comparison of a preset business flow diagram and an actual business flow diagram;
FIG. 6 is a block diagram of a block chain intelligent contract repairing apparatus in accordance with an embodiment of the present invention;
FIG. 7 is a block diagram of a block chain smart contract repair apparatus in accordance with another embodiment of the invention;
FIG. 8 is a block diagram of a server on which a block chain intelligent contract repairing apparatus resides in another embodiment of the invention;
FIG. 9 is a process flow diagram of a contract variable and flow management node;
FIG. 10 is a block diagram of a data collection node;
FIG. 11 is a process flow diagram of a business logic matching node;
fig. 12 is a block diagram of a computer device in an embodiment of the invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but 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.
Those skilled in the art will appreciate that embodiments of the invention may be implemented as a system, apparatus, device, method, or computer program product. Accordingly, the present disclosure may be embodied in the following forms, namely: complete hardware, complete software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
In view of the high labor cost of developing, operating and maintaining intelligent contracts and the incapability of guaranteeing logic accuracy in the prior art, the embodiment of the invention provides a block chain intelligent contract repairing method which overcomes the defects of the prior intelligent contract in aspects of link tracking, testing and problem repairing. The invention is based on NSQ combined with full-link tracking technology, reduces the development and operation cost of intelligent contracts, and improves the accuracy of logic in intelligent contracts.
The NSQ is an open-source distributed real-time message platform based on the Go language, can be used for real-time message service in a large-scale system, can process hundreds of millions of level messages every day, has a distributed and decentralized topological structure, has the characteristics of no single-point fault, fault tolerance, high availability and capability of maintaining reliable message transmission, is easy to configure and deploy, and supports a plurality of message protocols. An intelligent contract is an event-driven, stateful program that runs on a copy, shared ledger and is capable of keeping assets on the ledger. Full link tracking refers to transaction full link tracking, and the operation of the whole transaction forms a complete link, so that error checking and problem analysis are facilitated. The present invention will be described in detail with reference to the accompanying drawings.
FIG. 1 is a flow chart of a block chain intelligent contract repair method in accordance with an embodiment of the present invention. FIG. 2 is a flow chart of a block chain intelligent contract repair method in accordance with another embodiment of the invention. As shown in fig. 1 and 2, the blockchain smart contract repairing method includes:
s101: uploading the intelligent contract to the blockchain testing network to enable the blockchain testing network to execute the intelligent contract and generate an operation log.
Table 1 is a smart contract file format table. In particular implementations, smart contracts uploaded in a smart contract file format as shown in Table 1 may be received by contract variables and flow management nodes located at contract variables and flow management servers.
TABLE 1
The blockchain test network is a special test network of intelligent contracts and is used for completing the execution of contracts through the consensus of the verification nodes, namely executing automatic test cases and testing the contract interfaces. The non-verification node is used for marking the step operation of the same link branch as the same link tracking ID (Traceid), and packaging and transmitting the uplink operation log to the data acquisition server under the link in a message pushing mode through NSQ.
S102: and receiving the operation log from the blockchain test network, and generating an actual business flow chart according to the operation log.
In particular, the operation log from the blockchain test network may be received by a data collection node located at the data collection server. Table 2 is an example table of oplogs. As shown in Table 2, the parameters in the operation log are separated by [ ], i.e., [ Link tracking ID (Traceid) ] [ operation time ] [ File name ] [ parent method name-child method name ] [ input function ] [ output function ] [ other information ].
TABLE 2
In one embodiment, generating an actual business flow diagram from the oplog includes: sequencing the operation logs according to the operation time; and generating an actual business flow chart according to the ordered operation log.
In specific implementation, a data acquisition node positioned at a data acquisition server performs business process drawing on the operation log according to the full-link tracking technology, and sorts, checks, analyzes, process drawing and stores the operation log according to the receiving time. Checking, i.e., checking the integrity of the oplog, checking whether the oplog contains a Traceid, whether the format complies with the example specifications of table 2, etc. The parsing is to parse the contents in the operation log, including fields of the Traceid, the operation time, the file name, the parent method name-child method name, the input function, the output function, and the like.
Fig. 4 is a practical business flow diagram in an embodiment of the invention. The process drawing is to perform full link tracking according to the Traceid and the operation time, namely, the operation steps of the same Traceid in the operation log are tracked and drawn according to the operation time sequence, and the actual business flow chart is shown in fig. 4. The storage is to store the contents of the Traceid, the operation time, the file name, the parent method name-child method name, the input function, the output function and the like of the actual service flow chart into a file system of the server, and simultaneously transmit the actual service flow chart to a service logic matching node positioned at the service logic matching server.
S103: and comparing the actual business flow chart with a corresponding preset business flow chart to generate a repair code.
Before executing S103, further comprising:
presetting a service flow according to service requirements, and storing the service flow according to a preprocessing content storage format through a preprocessing node positioned on a service logic preprocessing server. Table 3 is a pre-processed content storage format table. Table 4 is a table of pre-processed content storage formats under the underwriting service scenario contract. As shown in tables 3 and 4, the preset business processes include step names (link branches), dependent steps, step operations, execution conditions, input functions, and output functions. According to the preset business flow, a corresponding preset business flow chart of each step name (link branch) can be generated.
TABLE 3 Table 3
TABLE 4 Table 4
In specific implementation, a service logic matching node positioned at a service logic matching server receives an actual service flow chart from a data acquisition node positioned at a data acquisition server and a preset service flow chart of a preprocessing node positioned on a service logic preprocessing server, compares the actual service flow chart with the corresponding preset service flow chart, and searches for differences. Fig. 5 is a schematic diagram comparing a preset business flow diagram and an actual business flow diagram. As shown in fig. 5, the preset service flow chart is used to output a difference content set of the actual service flow chart and the preset service flow chart, and if the actual service flow chart has fewer operation steps than the preset service flow chart, a supplementary recording scheme is output, for example, a difference operation C (including operation time, step operation and link branching) is absent; if the actual business flow chart is more than the preset business flow chart in operation steps, such as difference operation E, outputting the difference to ensure that business personnel confirm deletion or retention, and generating a repair code according to a difference repair scheme confirmed by the business personnel.
S104: and repairing the intelligent contract according to the repairing code.
Fig. 3 is a flowchart of S104 in the embodiment of the present invention. As shown in fig. 3, S104 includes:
s201: and analyzing the intelligent contract to obtain the intelligent contract source code.
In the implementation, the code package of the intelligent contract can be decompressed through the contract variables and the flow management nodes of the contract variables and the flow management server, meanwhile, the source packaging file is reserved, and the contract content is analyzed according to the decompressed file and the catalogue. Firstly, analyzing the number of branches of a service link, a main calling method (function name) and a branch service description (function description) in main.go, then analyzing the corresponding method flow in the functions according to the main calling method, and simultaneously analyzing input and output structures (including data types, data lengths, data field names and the like) under the corresponding structures in the method and the common function in the called common. And outputting the analysis content and storing the analysis content in a database of a contract variable and a flow management server to form a program logic flow of each link branch. Table 5 is a parsed smart contract storage format table. Table 6 is the intelligent contract source code in the forensic business scenario. Table 7 is a table of storage formats of intelligent contract source codes in a certification service scenario. As shown in tables 5 to 7, the link branches are used for recording main link names of main. Go and call link branch names, the function names are names of file name_call methods used under functions directory, the father functions are names of functions called inside the functions, the input functions and the output functions are defined according to structures in structures corresponding to input structures and output structures of the functions respectively, temporary variables are variables defined inside the functions and do not need to be output externally, step operations are operation records between the input and temporary variables, and function description is business meaning corresponding to the function names.
TABLE 5
TABLE 6
TABLE 7
S202: and repairing the intelligent contract source code according to the repairing code, and converting the repaired intelligent contract source code into the repaired intelligent contract.
In one embodiment, repairing smart contract source code from repair code includes: determining a function name corresponding to the file name of the operation log where the repair code is located; and repairing the intelligent contract source code corresponding to the function name according to the repairing code.
In the implementation, the repair codes are transmitted to contract variables and flow management nodes of a contract variable and a flow management server, and intelligent contract source codes under the same link branch are determined according to function names corresponding to file names of operation logs where the repair codes are located. If the operation step of the complement lack is needed, inserting a complement step, converting the complement step into codes, and repairing the intelligent contract. For example, a variable and an operation record with a function name C are inserted into the record with the function name B in the intelligent contract source code, the record is converted into a code form, and the code (repair code) is added after the operation with the function name B, so that the automatic repair of the intelligent contract source code is achieved. If the redundant operation steps need to be deleted, deleting the redundant operation steps in the intelligent contract source codes under the same link branch, and repairing the intelligent contract.
The blockchain smart contract repair method shown in fig. 1 may be executed by a server. As can be seen from the flow shown in fig. 1, the blockchain intelligent contract repairing method in the embodiment of the invention firstly uploads the intelligent contract to the blockchain test network, so that the blockchain test network executes the intelligent contract and generates an operation log, then generates an actual business flow chart according to the operation log, compares the actual business flow chart with a corresponding preset business flow chart to generate a repairing code, and finally repairs the intelligent contract according to the repairing code, thereby reducing the development and operation cost of the intelligent contract and improving the accuracy of the logic inside the intelligent contract.
The specific flow of the embodiment of the invention is as follows:
1. uploading the intelligent contract to the blockchain testing network to enable the blockchain testing network to execute the intelligent contract and generate an operation log.
2. And receiving the operation logs from the blockchain test network, sequencing the operation logs according to the operation time, and generating an actual business flow chart according to the sequenced operation logs.
3. And comparing the actual business flow chart with a corresponding preset business flow chart to generate a repair code.
4. And analyzing the intelligent contract to obtain the intelligent contract source code.
5. And determining a function name corresponding to the file name of the operation log where the repair code is located, and repairing the intelligent contract source code corresponding to the function name according to the repair code.
6. And converting the repaired intelligent contract source code into the repaired intelligent contract.
In summary, the invention can automatically repair the reporting error of the intelligent contract based on NSQ combined with full-link tracking technology, and has the following specific effects:
1. and transmitting the transaction on the blockchain to the position below the blockchain in real time based on NSQ and full-link tracking technology, forming a complete transaction link diagram for the same service according to the link tracking ID, further confirming whether the transaction link is consistent with preset service logic, and ensuring the accuracy of the service logic.
2. Based on the variable and flow management of the intelligent contract, the wrong business logic generated in the process of verifying a large amount of data is automatically repaired through the comparison difference between the transaction link and the preset business, and only the reasonableness of the repair step is confirmed manually, so that the cost of manually checking the problem and repairing the operation and maintenance is greatly reduced.
Based on the same inventive concept, the embodiment of the invention also provides a block chain intelligent contract repairing device, and because the principle of solving the problem of the device is similar to that of a block chain intelligent contract repairing method, the implementation of the device can refer to the implementation of the method, and the repetition is omitted.
FIG. 6 is a block diagram of a block chain intelligent contract repairing apparatus in accordance with an embodiment of the present invention. FIG. 7 is a block diagram of a block chain smart contract repairing apparatus in accordance with another embodiment of the invention. FIG. 8 is a block diagram of a server on which a block chain intelligent contract repairing apparatus resides in another embodiment of the invention. FIG. 9 is a process flow diagram of a contract variable and flow management node. Fig. 10 is a block diagram of a data collection node. Fig. 11 is a process flow diagram of a business logic matching node. As shown in fig. 6 to 11, the blockchain smart contract repairing apparatus includes:
the uploading module is used for uploading the intelligent contract to the blockchain testing network so that the blockchain testing network executes the intelligent contract and generates an operation log;
the actual business flow chart module is used for receiving the operation log from the blockchain test network and generating an actual business flow chart according to the operation log;
the repair code module is used for comparing the actual business flow chart with the corresponding preset business flow chart to generate a repair code;
and the intelligent contract repairing module is used for repairing the intelligent contract according to the repairing code.
In one embodiment, the smart contract repair module includes:
the analysis unit is used for analyzing the intelligent contract to obtain intelligent contract source codes;
and the intelligent contract repairing unit is used for repairing the intelligent contract source code according to the repairing code and converting the repaired intelligent contract source code into the repaired intelligent contract.
In one embodiment, the oplog includes an operation time;
the actual business flow diagram module comprises:
the sorting unit is used for sorting the operation logs according to the operation time;
and the actual business flow chart unit is used for generating an actual business flow chart according to the ordered operation logs.
In one embodiment, the smart contract repair unit includes:
the function name determining subunit is used for determining a function name corresponding to the file name of the operation log where the repair code is located;
and the intelligent contract source code repairing subunit is used for repairing the intelligent contract source code corresponding to the function name according to the repairing code.
As shown in fig. 7-11, in practical application, the blockchain intelligent contract repairing device includes a preprocessing node 1, a contract variable and flow management node 2, a data acquisition node 4 and a business logic matching node 5. The contract variables and flow management node 2 and the data acquisition node 4 interact with an external test network node 3, and the test network node 3 is located in an external blockchain test network 13 and comprises a verification node 31 and a non-verification node 32. Wherein, preprocessing node 1 is located at business logic preprocessing server 11, contract variable and flow management node 2 is located at contract variable and flow management server 12, data acquisition node 4 is located at data acquisition server 14, and business logic matching node 5 is located at business logic matching server 15.
When in specific implementation, the preprocessing node 1 draws a preset service flow chart according to service requirements, and the service flow chart is stored in the service logic preprocessing server 11 after being confirmed by service personnel; the contract variable and flow management node 2 is used for separating input and output, temporary variables and operation steps used by each method in the contract according to the grammar analysis of the intelligent contract, and storing the data in the contract variable and flow management server 2; the test network node 3 is a network node for contract deployment test, the blockchain test network 13 is a network for automatically testing interfaces and business logic of contracts, wherein a verification node is used for verifying functions of contract interfaces, after the consensus is completed, the operation of uplink business data is executed, and a non-verification node is used for collecting operation logs and transmitting the operation logs to the data acquisition server 14 under a chain through NSQ; the data acquisition node 4 is configured to receive and parse the operation log and the on-link data transmitted by the NSQ, and store the operation log and the on-link data in the relational database under the link, draw a large number of uplink service logic flow diagrams after data verification, store the uplink service logic flow diagrams (actual service flow diagrams) in the data acquisition server 14, and transmit the actual service flow diagrams to the service logic matching node 5; the business logic matching node is used for comparing the actual business flow chart transmitted by the data acquisition node 4 with the preset business flow chart drawn by the preprocessing node 1, outputting the difference, and if the difference needs to be modified, outputting the difference to the contract variable and the flow management node 2 for automatic repair of the intelligent contract, and storing the history record of the difference in the business logic matching server 15.
The service logic preprocessing server 11 is used for storing a service logic flow formulated by service personnel according to service requirements, and mainly comprises the contents of step names (link branches), dependent steps, step operations, execution conditions, input functions, output functions and the like.
The contract variables and flow management server 12 includes an uploading module and an intelligent contract repairing module for repairing the intelligent contract by storing the contents of the input data structure, the output data structure, the temporary variables, the operation steps (step operations) and the like of the parsed code of the intelligent contract.
The blockchain test network 13 is a dedicated test network of intelligent contracts for testing the contract interfaces by verifying the node's consensus to complete execution of the contract, i.e., to execute automated test cases. The non-verification node is used to label the step operation of the same link branch as the same link tracking ID (Traceid), and package and transmit the uplink operation log to the data acquisition server 14 under the link in a message pushing manner through the NSQ.
The data acquisition server 14 includes an actual service flow chart module, configured to acquire a message transmitted from the NSQ to the under-link on the link, and perform service flow drawing on the operation log according to the full-link tracking technology, as shown in fig. 10, and mainly includes two parts, namely, message receiving and message processing, where the message receiving is to receive a message transmitted by the NSQ, and includes receiving, ordering and distributing the message; the method comprises the steps of firstly sequencing received NSQ messages (operation logs) according to the receiving time, and then distributing the operation logs to a message processing part; message processing mainly realizes four parts of message verification, message analysis, message flow drawing and message storage. Message verification, i.e., checking the integrity of the oplog, checking whether the oplog contains a Traceid, whether the format complies with the example specifications of table 2, etc. The message parsing is to parse the contents in the operation log, including fields such as a track, an operation time, a file name, a parent method name-child method name, an input function, an output function, etc. The message flow drawing is to track the whole link according to the Traceid and the operation time, namely, track and draw the actual business flow chart shown in fig. 4 according to the operation time sequence for the operation steps of the same Traceid in the operation log. The message storage is to store the contents of the Traceid, the operation time, the file name, the parent method name-child method name, the input function, the output function and the like of the actual service flow chart into the file system of the server, and simultaneously transmit the actual service flow chart to the service logic matching node 5 located in the service logic matching server 15.
The business logic matching server 15 includes a repair code module, which is used for checking whether a difference exists between a preset business flow chart and a uplink actual business flow chart, outputting a solution to the difference, and ensuring the business logic integrity and accuracy of the contract code.
In summary, the blockchain intelligent contract repairing device of the embodiment of the invention firstly uploads the intelligent contract to the blockchain test network so that the blockchain test network executes the intelligent contract and generates the operation log, then generates the actual business flow chart according to the operation log, compares the actual business flow chart with the corresponding preset business flow chart to generate the repairing code, and finally repairs the intelligent contract according to the repairing code, thereby reducing the development and operation cost of the intelligent contract and improving the accuracy of the logic inside the intelligent contract.
The embodiment of the invention also provides a concrete implementation mode of the computer equipment capable of realizing all the steps in the block chain intelligent contract repairing method in the embodiment. Fig. 12 is a block diagram of a computer device in an embodiment of the present invention, and referring to fig. 12, the computer device specifically includes:
a processor 1201 and a memory 1202.
The processor 1201 is configured to invoke a computer program in the memory 1202, where the processor executes the computer program to implement all the steps in the blockchain intelligent contract repairing method in the above embodiment, for example, the processor executes the computer program to implement the following steps:
uploading the intelligent contract to the blockchain testing network so that the blockchain testing network executes the intelligent contract and generates an operation log;
receiving an operation log from a block chain test network, and generating an actual business flow chart according to the operation log;
comparing the actual business flow chart with a corresponding preset business flow chart to generate a repair code;
and repairing the intelligent contract according to the repairing code.
In summary, the computer device in the embodiment of the invention firstly uploads the intelligent contract to the blockchain test network so that the blockchain test network executes the intelligent contract and generates the operation log, then generates the actual business flow chart according to the operation log, compares the actual business flow chart with the corresponding preset business flow chart to generate the repair code, and finally repairs the intelligent contract according to the repair code, thereby reducing the development and operation cost of the intelligent contract and improving the accuracy of the logic in the intelligent contract.
The present invention also provides a computer readable storage medium capable of implementing all the steps of the blockchain intelligent contract repair method in the above embodiment, where the computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program implements all the steps of the blockchain intelligent contract repair method in the above embodiment, for example, the processor implements the following steps when executing the computer program:
uploading the intelligent contract to the blockchain testing network so that the blockchain testing network executes the intelligent contract and generates an operation log;
receiving an operation log from a block chain test network, and generating an actual business flow chart according to the operation log;
comparing the actual business flow chart with a corresponding preset business flow chart to generate a repair code;
and repairing the intelligent contract according to the repairing code.
In summary, the computer readable storage medium of the embodiment of the invention firstly uploads the intelligent contract to the blockchain test network, so that the blockchain test network executes the intelligent contract and generates the operation log, then generates the actual business flow chart according to the operation log, compares the actual business flow chart with the corresponding preset business flow chart to generate the repair code, and finally repairs the intelligent contract according to the repair code, thereby reducing the development and operation cost of the intelligent contract and improving the accuracy of the logic inside the intelligent contract.
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.
Those of skill in the art will further appreciate that the various illustrative logical blocks (illustrative logical block), units, and steps described in connection with the embodiments of the invention may be implemented by electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components (illustrative components), elements, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design requirements of the overall system. Those skilled in the art may implement the described functionality in varying ways for each particular application, but such implementation is not to be understood as beyond the scope of the embodiments of the present invention.
The various illustrative logical blocks, or units, or devices described in the embodiments of the invention may be implemented or performed with a general purpose processor, a digital signal processor, an Application Specific Integrated Circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described. A general purpose processor may be a microprocessor, but in the alternative, the general purpose processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a digital signal processor and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. In an example, a storage medium may be coupled to the processor such that the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an ASIC, which may reside in a user terminal. In the alternative, the processor and the storage medium may reside as distinct components in a user terminal.
In one or more exemplary designs, the above-described functions of embodiments of the present invention may be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, the functions may be stored on a computer-readable medium or transmitted as one or more instructions or code on the computer-readable medium. Computer readable media includes both computer storage media and communication media that facilitate transfer of computer programs from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, such computer-readable media may include, but is not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that may be used to carry or store program code in the form of instructions or data structures and other data structures that may be read by a general or special purpose computer, or a general or special purpose processor. Further, any connection is properly termed a computer-readable medium, e.g., if the software is transmitted from a website, server, or other remote source via a coaxial cable, fiber optic cable, twisted pair, digital Subscriber Line (DSL), or wireless such as infrared, radio, and microwave, and is also included in the definition of computer-readable medium. The disks (disks) and disks (disks) include compact disks, laser disks, optical disks, DVDs, floppy disks, and blu-ray discs where disks usually reproduce data magnetically, while disks usually reproduce data optically with lasers. Combinations of the above may also be included within the computer-readable media.

Claims (8)

1. A blockchain intelligent contract repair method, comprising:
uploading an intelligent contract to a blockchain testing network to enable the blockchain testing network to execute the intelligent contract and generate an operation log;
receiving an operation log from the blockchain test network, and generating an actual business flow chart according to the operation log;
comparing the actual business flow chart with a corresponding preset business flow chart to generate a repair code;
repairing the smart contract according to the repair code;
repairing the smart contract according to the repair code includes:
analyzing the intelligent contract to obtain intelligent contract source codes;
and repairing the intelligent contract source code according to the repairing code, and converting the repaired intelligent contract source code into the repaired intelligent contract.
2. The blockchain intelligence contract repair method of claim 1, wherein the operation log includes an operation time;
generating an actual business flow diagram according to the operation log comprises the following steps:
sequencing the operation logs according to the operation time;
and generating an actual business flow chart according to the ordered operation log.
3. The blockchain smart contract repair method of claim 1, wherein repairing the smart contract source code according to the repair code includes:
determining a function name corresponding to the file name of the operation log where the repair code is located;
and repairing the intelligent contract source code corresponding to the function name according to the repairing code.
4. A blockchain intelligent contract repairing device, comprising:
the uploading module is used for uploading the intelligent contract to the blockchain testing network so that the blockchain testing network executes the intelligent contract and generates an operation log;
the actual business flow chart module is used for receiving the operation log from the blockchain test network and generating an actual business flow chart according to the operation log;
the repair code module is used for comparing the actual business flow chart with the corresponding preset business flow chart to generate a repair code;
the intelligent contract repairing module is used for repairing the intelligent contract according to the repairing code;
the intelligent contract repair module includes:
the analysis unit is used for analyzing the intelligent contract to obtain intelligent contract source codes;
and the intelligent contract repairing unit is used for repairing the intelligent contract source code according to the repairing code and converting the repaired intelligent contract source code into a repaired intelligent contract.
5. The blockchain smart contract repair device of claim 4, wherein the operation log includes an operation time;
the actual business flow diagram module comprises:
the sorting unit is used for sorting the operation logs according to the operation time;
and the actual business flow chart unit is used for generating an actual business flow chart according to the ordered operation logs.
6. The blockchain smart contract repair device of claim 4, wherein the smart contract repair unit includes:
a function name determining subunit, configured to determine a function name corresponding to a file name of an operation log where the repair code is located;
and the intelligent contract source code repairing subunit is used for repairing the intelligent contract source code corresponding to the function name according to the repairing code.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and running on the processor, wherein the processor implements the steps of the blockchain intelligent contract repair method of any of claims 1 to 3 when the computer program is executed by the processor.
8. A computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the steps of the blockchain intelligent contract repair method of any of claims 1 to 3.
CN202110295709.9A 2021-03-19 2021-03-19 Block chain intelligent contract repairing method and device Active CN113050925B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110295709.9A CN113050925B (en) 2021-03-19 2021-03-19 Block chain intelligent contract repairing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110295709.9A CN113050925B (en) 2021-03-19 2021-03-19 Block chain intelligent contract repairing method and device

Publications (2)

Publication Number Publication Date
CN113050925A CN113050925A (en) 2021-06-29
CN113050925B true CN113050925B (en) 2024-02-13

Family

ID=76513796

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110295709.9A Active CN113050925B (en) 2021-03-19 2021-03-19 Block chain intelligent contract repairing method and device

Country Status (1)

Country Link
CN (1) CN113050925B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108829436A (en) * 2018-06-15 2018-11-16 北京京东尚科信息技术有限公司 Hot restorative procedure, device, system, electronic equipment and computer-readable medium
CN110413316A (en) * 2019-07-31 2019-11-05 中国工商银行股份有限公司 Non-intrusion type test macro and method towards block chain intelligence contract
CN110807195A (en) * 2019-09-26 2020-02-18 图灵人工智能研究院(南京)有限公司 Intelligent contract issuing method, issuing platform device and issuing system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108829436A (en) * 2018-06-15 2018-11-16 北京京东尚科信息技术有限公司 Hot restorative procedure, device, system, electronic equipment and computer-readable medium
CN110413316A (en) * 2019-07-31 2019-11-05 中国工商银行股份有限公司 Non-intrusion type test macro and method towards block chain intelligence contract
CN110807195A (en) * 2019-09-26 2020-02-18 图灵人工智能研究院(南京)有限公司 Intelligent contract issuing method, issuing platform device and issuing system

Also Published As

Publication number Publication date
CN113050925A (en) 2021-06-29

Similar Documents

Publication Publication Date Title
US10983789B2 (en) Systems and methods for automating and monitoring software development operations
CN112506807B (en) Automatic test system for interface serving multiple systems
CN112052172B (en) Rapid test method and device for third-party channel and electronic equipment
CN111061696B (en) Method and device for analyzing transaction message log
CN104899134A (en) Automatic domain name registration server testing system and method
CN111552632A (en) Interface testing method and device
US20050234845A1 (en) End-to-end business integration testing tool
CN112506771A (en) Message comparison method and device
CN113050925B (en) Block chain intelligent contract repairing method and device
CN116506340A (en) Flow link testing method and device, electronic equipment and storage medium
CN109508204B (en) Front-end code quality detection method and device
CN105302731A (en) Testing system and method for upgrading website configuration
CN112579699A (en) Quality monitoring method, system and storage medium for service data processing link
CN111314805A (en) Debugging method and device for intercommunication OMCI (OMCI) messages of GPON (gigabit passive optical network) system
CN113141366B (en) Message submitting method and device, storage medium and electronic equipment
CN112860562B (en) Automatic test method and device
CN113886223A (en) Code test management method and device, computer equipment and readable storage medium
CN116048890A (en) Multimode automatic interface test method, device, equipment and storage medium
CN113434409A (en) Micro-service test method and device
CN117370202A (en) Method, device, equipment and storage medium for testing full link of multiple bins
CN116010349A (en) Metadata-based data checking method and device, electronic equipment and storage medium
CN114942780A (en) Code version management method, device, system and storage medium
CN117057915A (en) File processing method, device, equipment and readable storage medium
CN115185809A (en) Software testing method and device and electronic equipment
CN116303061A (en) Data testing method and device and nonvolatile storage medium

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