The present disclosure relates to the field of computer technology, and in particular to a method and an apparatus for data verification.
The basic characteristics of a smart contract include: consistency, customization, observability, verifiability, enforceability, and privacy protection. Verifiability refers to the ability of a client to prove to an arbitrator the performance or breach of the contract, or the ability of the arbitrator to ascertain this point through other means. In order to ensure the accuracy of execution results of the smart contract, it is necessary to verify the execution results of the smart contract. However, how to ensure the credibility of verifying the execution results of the smart contracts is currently a pressing technical problem that needs to be solved.
In view of this, embodiments of the present disclosure provide a method and an apparatus for data verification. A mechanism of multi-node joint verification ensures the accuracy of a contract execution result, and avoids the situation that an operating agency system is in charge of both contract execution and contract verification, causing the low credibility of verification of a smart contract, thereby improving the credibility of contract execution and verification.
In order to achieve the above objectives, according to an aspect of this embodiment of the present disclosure, a method for data verification is provided.
The method for data verification includes:
Optionally, performing the first verification on data-to-be-verified includes:
Optionally, each consensus verification node performs the consensus verification through the following method:
Optionally, the consensus verification includes:
Optionally, the processing the first contract parameter to obtain the second contract parameter includes:
According to another aspect of this embodiment of the present disclosure, an apparatus for data verification is provided.
The apparatus for data verification includes:
According to another aspect of this embodiment of the present disclosure, a method for data verification is provided.
The method for data verification includes:
According to another aspect of this embodiment of the present disclosure, an electronic device for data verification is provided.
The electronic device for data verification includes: at least one processor; and a storage apparatus configured to store at least one program. The at least one program, when executed by the at least one processor, enable the at least one processor to implement the data verification method provided in this embodiment of the present disclosure.
According to another aspect of this embodiment of the present disclosure, a computer-readable medium is provided.
The computer-readable medium stores a computer program. The program, when executed by a processor, implements the data verification method provided in this embodiment of the present disclosure.
Further effects of the foregoing non-conventional optional modes will be explained below by combining implementations.
The accompanying drawings are used for a better understanding of the present disclosure, which do not constitute improper limitations on the present disclosure.
Exemplary embodiments of the present disclosure are illustrated in conjunction with the accompanying drawings below, and various details of the embodiments of the present disclosure are included to facilitate understanding, which should be considered purely exemplary. Thus, those of ordinary skill in the art should realize that the embodiments described herein can be variously transformed and modified, which cannot depart from the scope and spirit of the present disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following descriptions.
In the process of executing a smart contract, after a smart contract execution unit executes the smart contract according to a contract parameter to obtain an execution result, a smart contract verification unit verifies the execution result. In order to solve the problem about how to ensure the credibility of verifying the execution result of the smart contract, the present disclosure employs a mechanism of multi-node joint verification to ensure the accuracy of the contract execution result, which prevents the situation that an operating agency system is in charge of both contract execution and contract verification, therefore avoids self-verification, and improves the credibility of contract execution and verification. Typically, the smart contract verification unit and the smart contract execution unit of the same smart contract operating agency system, such as a bank or a company, are usually associated. Multiple joint verification nodes refer to smart contract execution units of multiple operating agency systems.
At step S101: perform a first verification on data-to-be-verified, where the data-to-be-verified includes a first contract parameter, an identifier of a smart contract, and a first execution result.
At step S102: after the first verification is passed, process the first contract parameter to obtain a second contract parameter, and execute the smart contract based on the second contract parameter to obtain a second execution result.
At step S103: send the second contract parameter, the identifier of the smart contract, and the second execution result to a consensus verification node for a consensus verification.
In this embodiment of the present disclosure, multi-node data verification is implemented through a consensus mechanism. The term “consensus mechanism” refers to a process where verification and confirmation of transactions are achieved through voting by specialized nodes in a short period of time. For a transaction, if a consensus can be reached by several nodes with unrelated benefits, it can be considered that the entire network can also reach a consensus on that.
According to the step S101 to the step S103, joint contract execution and verification can be achieved by a contract verification platform composed of multiple verification nodes, thereby improving the credibility of contract execution and verification.
According to an embodiment of the present disclosure, during execution, the step of performing a first verification on data-to-be-verified may include: the smart contract is acquired according to the identifier of the smart contract; the smart contract is executed according to the first contract parameter to obtain a third execution result; and the third execution result and the first execution result are compared so as to perform the first verification. In this embodiment, the contract parameter and the execution results of the smart contract execution unit are sent to the smart contract verification unit of the operating agency system corresponding to the smart contract execution unit for a preliminary verification. The execution results can be preliminarily verified before the smart contract verification units of the plurality of different operating agency systems perform the consensus verification, and after the preliminary verification is successful, the consensus verification is performed, thereby saving the verification cost, and improving the verification efficiency.
After the first verification is successful, the first contract parameter is processed to obtain the second contract parameter, and the processing of the first contract parameter herein is, for example, desensitization. Because user data needs to be kept confidential between different operating agency systems such as banks or companies, when the multiple consensus verification nodes perform the consensus verification, data desensitization processing is also required to be performed on contract parameter sent to the multiple consensus verification nodes. The desensitization may be typically performed by methods such as data substitution, data obfuscation, data randomization, and data masking. In this embodiment of the present disclosure, the data desensitization processing is performed on the first contract parameter by performing a hash operation on the first contract parameter.
According to another embodiment of the present disclosure, each consensus verification node may be verified by a following method: the smart contract is acquired according to the identifier of the smart contract; the smart contract is executed according to the second contract parameter to obtain a fourth execution result; and the fourth execution result and the second execution result are compared to obtain a second verification result. The consensus verification node execute the smart contract according to the processed second contract parameter, and can verify the contract execution result without obtaining original contract parameter, thereby ensuring privacy and data security of contract parities, and also realizing multi-party joint verification.
According to another embodiment of the present disclosure, the step of consensus verification includes: whether a set condition for reaching set condition for reaching consensus has been met is determined according to a second verification result of each consensus verification node; and in response to the set condition for reaching consensus being met, the consensus verification is successful; in response to the set condition for reaching consensus not being met, the consensus verification is failed. The set condition for reaching consensus may be flexibly set according to requirements of data verification. For example, it may be set that the consensus verification is successful when verification results from more than half of the consensus verification nodes are positive.
The implementation process of this embodiment of the present disclosure is introduced in conjunction with specific embodiments below.
In an embodiment of the present disclosure, when a smart contract execution unit of an operating agency system needs to verify a contract execution result, firstly, the first contract parameter (including involved wallet information, interface parameter required for the contract execution, etc.), a identifier of the smart contract ID, and a real operation record (or a hash value) including a smart contract first execution result to a smart contract verification unit of this operating agency system for the first verification. The smart contract verification unit of this operating agency system obtains, according to the identifier of the smart contract, the smart contract from the contract repository, mock operation is performed on the smart contract according to the first contract parameter to obtain a third execution result, and the third execution result and the first execution result are compared for the first verification. If the first verification is successful, it indicates that the preliminary verification of the smart contract verification unit of this operating agency system on the execution result of the smart contract execution unit is positive, thereby performing the subsequent consensus verification. If the first verification is not successful, a verification failure is directly returned, and the subsequent consensus verification is not performed, such that the smart contract execution unit performs rollback processing and re-execution. The mock operation is similar to black-box testing, and belongs to a kind of verification method that since the smart contract verification unit cannot replicate a real smart contract execution environment, an operation environment is simulated, and in order not to influence the verification result, certain parameters are preset, and only the parameters of concern are adopted as input parameters for input.
After the first verification is successful, a smart contract verification platform of this operating agency system uses the hashing algorithm to desensitize the first contract parameter to obtain the second contract parameter, and then uses the second contract parameter to execute the smart contract to obtain the second execution result.
Then, the smart contract verification platform of this operating agency system sends the second contract parameter, the identifier of the smart contract, and the second execution result to the consensus verification nodes. Each consensus verification node obtains the smart contract from the contract repository, then uses the second contract parameter to execute the smart contract to obtain the fourth execution result, and compares the fourth execution result with the second execution result for the second verification. If the fourth execution result is consistent with the second execution result, the verification is successful (alternatively, the verification result of the consensus verification node may be considered “agreed”); If the fourth execution result is not consistent with the second execution result, the verification is failed.
Finally, the second verification results of all the consensus verification nodes are collected, and whether consensus is reached is judged according to the set condition for reaching consensus, where the set condition for reaching consensus may be, for example, the number of consensus verification nodes with successful verification exceeding half of the total number of all the consensus verification nodes. If consensus is reached, the consensus verification is successful; if consensus is not reached, the consensus verification is failed. In case of the verification failure, the smart contract execution unit performs rollback processing and re-execution.
The first verification module 401 is configured to perform a first verification on data-to-be-verified, where the data-to-be-verified includes a first contract parameter, an identifier of a smart contract, and a first execution result.
The contract execution module 402 is configured to process, after the first verification is passed, the first contract parameter to obtain a second contract parameter, and execute the smart contract based on the second contract parameter to obtain a second execution result.
The second verification module 403 is configured to send the second contract parameter, the identifier of the smart contract, and the second execution result to a consensus verification node for a consensus verification.
According to an embodiment of the present disclosure, the first verification module 401 may be further configured to:
According to another embodiment of the present disclosure, each consensus verification node performs the consensus verification through the following method:
According to another embodiment of the present disclosure, the second verification module 403 may be further configured to:
According to another embodiment of the present disclosure, the contract execution module 402 may be further configured to:
According to the technical solution of this embodiment of the present disclosure, the first verification is performed on the data-to-be-verified, and the data-to-be-verified includes the first contract parameter, the identifier of the smart contract, and the first execution result; after the first verification is successful, the first contract parameter are processed to obtain the second contract parameter, and the smart contract is executed according to the second contract parameter to obtain the second execution result; and the second contract parameter, the identifier of the smart contract, and the second execution result are sent to the consensus verification node for the consensus verification, thereby realizing joint contract execution and verification by the contract verification platform composed of the plurality of verification nodes. The mechanism of multi-node joint verification ensures the accuracy of the contract execution result, and avoids the situation that an operating agency system is in charge of both contract execution and contract verification, causing the low credibility of verification of the smart contract, thereby improving the credibility of contract execution and verification.
As shown in
A user may use the terminal devices 501, 502, and 503 to interact with the server 505 through the network 504 to receive or send messages, etc. The terminal devices 501, 502, and 503 may be provided with various communication client applications, such as banking applications, digital currency applications, data verification applications, smart contract management applications, email clients, and social networking platforms (which are only examples).
The terminal devices 501, 502 and 503 may be various electronic devices having display screens and supporting web browsing, which include but not limited to a smart phone, a tablet personal computer, a portable laptop, a desk computer, etc.
The server 505 may be a server that provides various services, such as a backend management server (which is only an example) that supports data-to-be-verified sent by the user through the terminal devices 501, 502, and 503. The backend management server may perform a first verification on data-to-be-verified according to a received data verification request, where the data-to-be-verified includes the first contract parameter, the identifier of the smart contract, and the first execution result; process, after the successful first verification, the first contract parameter to obtain second contract parameter, and execute the smart contract according to the second contract parameter to obtain a second execution result; and send the second contract parameter, the identifier of the smart contract, and the second execution result to the consensus verification node for the processing such as consensus verification, and feed-back a processing result (e.g., a consensus verification result only as an example) to the terminal devices.
It should be noted that the data verification method provided in this embodiment of the present disclosure is generally executed by the server 505. Correspondingly, the data verification apparatus is generally set in the server 505.
It should be understood that the number of the terminal devices, networks and servers in
Referring to
As shown in
Following components are connected to the I/O interface 605: an input part 606 including a keyboard, a mouse, etc.; an output part 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), a speaker, etc.; the storage part 608 including a hard drive, etc.; and a network interface card communication part 609 including a local area network (LAN) card, a modem, etc. The communication part 609 performs communication processing through networks such as the Internet. A driver 610 is also connected to the I/O interface 605 according to needs. Removable media 611, such as a magnetic disk, an optical disk, a magneto-optical disk, and a semiconductor memory are installed on the driver 610 as needed, so that computer programs read therefrom are installed in the storage part 608 as needed.
Particularly, the foregoing process described with reference to the flowchart according to the embodiments of the present disclosure may be implemented as a computer software program. For example, an embodiment disclosed in the present disclosure includes a computer program product including a computer program stored on a computer-readable medium. The computer program includes program code for executing the method shown in the flowchart. In this embodiment, the computer program can be downloaded and installed, by the communication part 609, from the network, and/or be installed from the removable media 611. The computer program, when executed by the central processing unit (CPU) 601, executes the foregoing functions limited in the system of the present disclosure.
It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium, or a computer-readable storage medium, or any combination thereof. For example, the computer-readable storage medium may include but not limited to: electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems, apparatuses or devices, or any combination thereof. More specific examples of the computer-readable storage medium may include but not limited to: an electrical connection with at least one wire, a portable computer disk, a hard drive, a random access memory (RAM), a read only memory (ROM), an erasable programmable read only memory (EPROM or a flash memory), fiber optics, a portable compact disc read only memory (CD-ROM), a light storage device, a magnetic storage device, or any proper combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium including or storing a program, and the program may be used by an instruction execution system, apparatus or device, or used in conjunction with the instruction execution system, apparatus or device. However, in the present disclosure, the computer-readable signal medium may include data signals propagated in a baseband or propagated as a part of a carrier wave, which carry computer-readable program code. The propagated data signals may have a plurality of forms, and include but not limited to electromagnetic signals, optical signals or any proper combination of the above. The computer-readable signal medium may be any computer-readable medium except the computer-readable storage medium. The computer-readable medium may send, propagate or transmit programs used by the instruction execution system, apparatus or device or used in conjunction with the instruction execution system, apparatus or device. The program code included in the computer-readable medium may be transmitted by any proper medium including but not limited to wireless, a wire, an optical cable, radio frequency (RF), etc., or any above proper combinations.
The flowcharts and block diagrams in the accompanying drawings illustrate system architectures, functions, and operations possibly implemented by the system, method and computer program product according to the various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams may represent a module, a program segment, or part of the code, the module, program segment, or part of the code including at least one executable instruction for implementing specified logical functions. It should be noted that in some alternative implementations, functions marked in the blocks may also occur in an order different from that marked in the accompanying drawings. For example, two consecutively-represented blocks may actually be executed in parallel basically, but sometimes may also be executed in a reverse order, which depends on involved functions. It should be further noted that each block in the block diagrams or the flowcharts as well as a combination of the blocks in the block diagrams or the flowcharts may be implemented by using a dedicated hardware-based system that executes specified functions or operations, or using a combination of special hardware and computer instructions.
The units or modules described in the embodiments of the present disclosure may be implemented through software or hardware. The described units or modules may also be arranged in a processor. For example, it may be described as: a processor includes a first verification module, a contract execution module, and a second verification module. The names of the units or modules do not limit the units or modules in certain cases. For example, the first verification module may also be described as a “module for performing a first verification on data-to-be-verified”.
According to another aspect, the present disclosure further provides a computer-readable medium. The computer-readable medium may be included in the device described in the foregoing embodiment, and may separately exist without being assembled in the device. The computer-readable medium carries at least one program. When the at least one program is executed by the device, the device is enabled to: perform a first verification on data-to-be-verified, where the data-to-be-verified includes the first contract parameter, the identifier of the smart contract, and the first execution result; process, after the first verification is passed, the first contract parameter to obtain the second contract parameter, and execute the smart contract according to the second contract parameter to obtain a second execution result; and send the second contract parameter, the identifier of the smart contract, and the second execution result to the consensus verification node for a consensus verification.
According to the method of this embodiment of the present disclosure, the first verification is performed on the data-to-be-verified, and the data-to-be-verified includes the first contract parameter, the identifier of the smart contract, and the first execution result; after the first verification is successful, the first contract parameter are processed to obtain the second contract parameter, and the smart contract is executed according to the second contract parameter to obtain the second execution result; and the second contract parameter, the identifier of the smart contract, and the second execution result are sent to the consensus verification node for the consensus verification, thereby realizing joint contract execution and verification by a contract verification platform composed of the plurality of verification nodes. The mechanism of multi-node joint verification ensures the accuracy of the contract execution result, and avoids the situation that an operating agency system is in charge of both contract execution and contract verification, causing the low credibility of verification of the smart contract, thereby improving the credibility of contract execution and verification.
The foregoing implementations do not limit the scope of protection of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions may occur based on design demands and other factors. Any modification, equivalent replacement, improvement, etc., made within the spirit and principle of the present disclosure shall fall within the scope of protection of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
202110752705.9 | Jul 2021 | CN | national |
The present disclosure claims the priority of Chinese Patent Application No. 202110752705.9, entitled “Method and Apparatus for Data verification”, filed on Jul. 2, 2021, the entire content of which is incorporated herein by reference as part or all of the present disclosure.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2022/098118 | 6/10/2022 | WO |