Disclosure of Invention
In order to overcome the above problems or at least partially solve the above problems, embodiments of the present invention provide a data query verification method and system based on a block chain technique, which can effectively verify data query and ensure the authenticity and validity of query data.
The embodiment of the invention is realized by the following steps:
in a first aspect, an embodiment of the present invention provides a data query verification method based on a block chain technique, including the following steps:
acquiring a data query request of a user;
according to the user information in the data query request, a user hash address table pre-entered in the block chain is obtained to verify the user identity, and an identity verification result is generated;
inquiring the stored data in the block chain according to the identity verification result and the data content in the data inquiry request to generate a data inquiry result;
matching the data hash address in the data query result with a preset data identifier to generate a data matching result;
and generating a query verification result according to the data matching result, and sending the corresponding data query result and the query verification result to the user.
In order to guarantee the real effectiveness of the data query and the safety of the data query, the user of the data query and the data are subjected to double verification. After a data query request of a user is acquired, the identity of the user is verified, the data query request comprises query user information and query data content, the user information can be matched with a user hash address stored in a block chain in advance through identity identification information in the user information, and when the user accesses the block chain before storing the data in the block chain, the block chain can give each user a hash address serving as an identification of the user so as to search the data of the corresponding user according to the hash address subsequently; the user information comprises a user name, an identity mark and the like, wherein the identity mark corresponds to the Hash address of the user; the user identity can also be verified through external API real-name verification; after the identity authentication is successful, namely after the corresponding user hash address is found in the block chain, inquiring the stored data stored in the block chain according to the data content in the data inquiry request, and then generating a data inquiry result, wherein the data inquiry result comprises prompt information of whether the data exists, the corresponding inquired data content and the data hash address; and after the corresponding data content is found, matching the corresponding data hash with a preset data identifier, wherein the data identifier is a identifier set before the data is stored in the block chain and is matched with a data hash address given to the data by the block chain, the step of verifying the authenticity of the data is carried out, and after the matching is successful, the data is shown to be truly existed, and then sending the found data query result and verification success information to a corresponding user.
The method can effectively verify the data query, ensure the authenticity and validity of the query data, and simultaneously verify the identity of the user of the data query and perform double verification on the query user and the query data in order to ensure the safety of the data query.
Based on the first aspect, in some embodiments of the present invention, the method for querying the stored data in the blockchain according to the authentication result and the data content in the data query request includes the following steps:
generating contract triggering conditions according to the identity verification result, triggering intelligent contracts in the block chain, and giving data query permission to corresponding users;
and after the data query authority of the corresponding user is given, querying the stored data in the block chain according to the data content in the data query request to generate a data query result.
Based on the first aspect, in some embodiments of the present invention, the method for querying the stored data in the blockchain according to the authentication result and the data content in the data query request includes the following steps:
and performing data query in each block node in the block chain according to the identity verification result, the data content in the data query request and a preset data storage rule to generate a data query result.
Based on the first aspect, in some embodiments of the present invention, the method for querying the stored data in the blockchain according to the authentication result and the data content in the data query request includes the following steps:
and inquiring the stored data stored at the corresponding time point in the block chain according to the identity verification result, the time point in the data content in the data inquiry request and the inquiry information in the data content to generate a data inquiry result.
In a second aspect, an embodiment of the present invention provides a data query and verification system based on a block chain technology, including a request obtaining module, an identity verification module, a query module, a data matching module, and a result sending module, where:
the request acquisition module is used for acquiring a data query request of a user;
the identity authentication module is used for acquiring a user hash address table pre-entered in the block chain according to the user information in the data query request, authenticating the user identity and generating an identity authentication result;
the query module is used for querying the stored data in the block chain according to the identity verification result and the data content in the data query request to generate a data query result;
the data matching module is used for matching the data hash address in the data query result with a preset data identifier to generate a data matching result;
and the result sending module is used for generating a query verification result according to the data matching result and sending the corresponding data query result and the query verification result to the user.
In order to guarantee the real effectiveness of the data query and the safety of the data query, the user of the data query and the data are subjected to double verification. After a data query request of a user is acquired through a request acquisition module, an identity verification module verifies the identity of the user, the data query request comprises query user information and query data content, the identity identification information in the user information can be matched with a user hash address stored in a block chain in advance, before the user stores data in the block chain, when the user accesses the block chain, the block chain gives each user a hash address serving as an identification of the user, and the data of the corresponding user can be searched according to the hash address later; the user information comprises a user name, an identity mark and the like, wherein the identity mark corresponds to the Hash address of the user; the user identity can also be verified through external API real-name verification; after the identity authentication is successful, namely after the corresponding user hash address is found in the block chain, the query module queries the stored data stored in the block chain according to the data content in the data query request, and then generates a data query result, wherein the data query result comprises prompt information of whether the data exists, the corresponding query data content and the data hash address; after the corresponding data content is found, the data matching module matches the corresponding data hash with a preset data identifier, wherein the data identifier is a identifier set before the data is stored in the block chain and is matched with a data hash address given to the data by the block chain, the step is to verify the authenticity of the data, after the matching is successful, the data is shown to be real, and the result sending module sends the found data query result and the verification success information to a corresponding user.
The system can effectively verify data query, ensures the authenticity and validity of query data, and simultaneously, performs identity verification on a user of the data query and performs double verification on the query user and the query data in order to ensure the safety of the data query.
Based on the second aspect, in some embodiments of the present invention, the query module includes an authority granting sub-module and a data query sub-module, where:
the authority endowing sub-module is used for generating contract triggering conditions according to the identity verification result, triggering the intelligent contracts in the block chain and endowing the data query authority of the corresponding users;
and the data query submodule is used for querying the stored data in the block chain according to the data content in the data query request after the data query permission of the corresponding user is given, and generating a data query result.
Based on the second aspect, in some embodiments of the present invention, the query module includes a rule query submodule, configured to perform data query in each block node in the block chain according to the identity verification result, the data content in the data query request, and a preset data storage rule, so as to generate a data query result.
Based on the second aspect, in some embodiments of the present invention, the query module includes a time query submodule, configured to query, according to the identity verification result, the time point in the data content in the data query request, and the query information in the data content, the stored data stored at the corresponding time point in the block chain, so as to generate a data query result.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a memory for storing one or more programs; a processor. The program or programs, when executed by a processor, implement the method of any of the first aspects as described above.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the method according to any one of the first aspect described above.
The embodiment of the invention at least has the following advantages or beneficial effects:
the embodiment of the invention provides a data query verification method and a data query verification system based on a block chain technology, which are used for performing double verification on a user and data of data query in order to ensure the authenticity and effectiveness of the data query and the data query safety. Inquiring the stored data stored in the block chain according to the data content in the data inquiry request, and then generating a data inquiry result; and after the corresponding data content is found, matching the corresponding data hash with a preset data identifier, namely verifying the authenticity of the data, and after the matching is successful, indicating that the data is true, sending the found data query result and verification success information to the corresponding user. The method can effectively verify the data query, ensure the authenticity and validity of the query data, and simultaneously verify the identity of the user of the data query and perform double verification on the query user and the query data in order to ensure the safety of the data query.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Examples
As shown in fig. 1, in a first aspect, an embodiment of the present invention provides a data query verification method based on a blockchain technique, including the following steps:
s1, acquiring a data query request of a user;
in some embodiments of the present invention, in order to ensure the true validity of the data query and the data query security, the user of the data query and the data are double verified. After a data query request of a user is acquired, the identity of the user is verified, and the data query request comprises query user information and query data content.
S2, according to the user information in the data query request, obtaining a user hash address table pre-entered in the block chain, and verifying the user identity to generate an identity verification result;
in some embodiments of the present invention, the identity information in the user information may be matched with a user hash address pre-stored in the block chain, and when the user accesses the block chain before storing the data in the block chain, the block chain may give each user a hash address as an identifier of the user, so as to search the data of the corresponding user according to the hash address in the following; the user information comprises a user name, an identity mark and the like, wherein the identity mark corresponds to the Hash address of the user; the user identity can also be verified through external API real-name verification.
S3, inquiring the stored data in the block chain according to the identity verification result and the data content in the data inquiry request to generate a data inquiry result;
in some embodiments of the present invention, after the identity authentication is successful, that is, after the corresponding user hash address is found in the blockchain, the stored data stored in the blockchain is queried according to the data content in the data query request, and then a data query result is generated, where the data query result includes prompt information indicating whether the data exists, and the corresponding queried data content and data hash address.
S4, matching the data hash address in the data query result with a preset data identifier to generate a data matching result;
and S5, generating a query verification result according to the data matching result, and sending the corresponding data query result and the query verification result to the user.
In some embodiments of the present invention, after finding the corresponding data content, matching the corresponding data hash with a preset data identifier, where the data identifier is a identifier set before the data is stored in the block chain and is matched with a data hash address given to the data by the block chain, and this step is to verify the authenticity of the data, and after successful matching, that is, after the data is shown to be truly present, sending the found data query result and verification success information to the corresponding user. The method can effectively verify the data query, ensure the authenticity and validity of the query data, and simultaneously verify the identity of the user of the data query and perform double verification on the query user and the query data in order to ensure the safety of the data query.
Based on the first aspect, in some embodiments of the present invention, the method for querying the stored data in the blockchain according to the authentication result and the data content in the data query request includes the following steps:
generating contract triggering conditions according to the identity verification result, triggering intelligent contracts in the block chain, and giving data query permission to corresponding users;
and after the data query authority of the corresponding user is given, querying the stored data in the block chain according to the data content in the data query request to generate a data query result.
And returning the input value of the evidence storage function by calling the evidence obtaining function declared in the intelligent contract, calling the corresponding query function by the intelligent contract, and returning the latest data stored in the block by using the evidence obtaining function defined in the intelligent contract. In order to ensure the security of data query, a user successfully authenticated is endowed with data query authority, an intelligent contract is triggered to start a query function, and then the data content in the data query request queries the stored data in the block chain.
Based on the first aspect, in some embodiments of the present invention, the method for querying the stored data in the blockchain according to the authentication result and the data content in the data query request includes the following steps:
and performing data query in each block node in the block chain according to the identity verification result, the data content in the data query request and a preset data storage rule to generate a data query result.
When data is queried, the block information and the transaction information of the ether house can be traversed by means of a preset storage coding rule of an intelligent contract, the data is reversely decoded, analyzed, queried and displayed, and accurate data query is performed on each node in a block chain, so that accurate comprehensiveness of the data query is guaranteed.
Based on the first aspect, in some embodiments of the present invention, the method for querying the stored data in the blockchain according to the authentication result and the data content in the data query request includes the following steps:
and inquiring the stored data stored at the corresponding time point in the block chain according to the identity verification result, the time point in the data content in the data inquiry request and the inquiry information in the data content to generate a data inquiry result.
When the data is queried, in order to improve the query efficiency, the data is queried only at a corresponding time point, and the data stored in the block chain is queried only at the corresponding time, so that the query time is greatly saved.
As shown in fig. 2, in a second aspect, an embodiment of the present invention provides a data query and verification system based on a blockchain technique, including arequest obtaining module 100, anidentity verification module 200, aquery module 300, a data matching module 400, and a result sending module 500, where:
arequest obtaining module 100, configured to obtain a data query request of a user;
theidentity authentication module 200 is configured to acquire a user hash address table pre-entered in the block chain according to the user information in the data query request, and authenticate the user identity to generate an identity authentication result;
thequery module 300 is configured to query the stored data in the block chain according to the identity verification result and the data content in the data query request, and generate a data query result;
the data matching module 400 is configured to match the data hash address in the data query result with a preset data identifier, and generate a data matching result;
and the result sending module 500 is configured to generate a query and verification result according to the data matching result, and send the corresponding data query result and the query and verification result to the user.
In order to guarantee the real effectiveness of the data query and the safety of the data query, the user of the data query and the data are subjected to double verification. After a data query request of a user is acquired through the request acquisition module 100, the identity verification module 200 verifies the identity of the user, the data query request comprises query user information and query data content, the identity identification information in the user information can be matched with a user hash address stored in a block chain in advance, before the user stores data in the block chain, when the user accesses the block chain, the block chain gives a hash address to each user as an identification of the user, so that the data of the corresponding user can be found according to the hash address in the following process; the user information comprises a user name, an identity mark and the like, wherein the identity mark corresponds to the Hash address of the user; the user identity can also be verified through external API real-name verification; after the identity authentication is successful, that is, after the corresponding user hash address is found in the block chain, the query module 300 queries the stored data stored in the block chain according to the data content in the data query request, and then generates a data query result, where the data query result includes prompt information indicating whether the data exists, the corresponding query data content, and the data hash address; after the corresponding data content is found, the data matching module 400 matches the corresponding data hash with a preset data identifier, where the data identifier is a identifier set before the data is stored in the block chain and is matched with a data hash address given to the data by the block chain, this step is to verify the authenticity of the data, and after the matching is successful, it indicates that the data is true, and the result sending module 500 sends the found data query result and the verification success information to the corresponding user.
The system can effectively verify data query, ensures the authenticity and validity of query data, and simultaneously, performs identity verification on a user of the data query and performs double verification on the query user and the query data in order to ensure the safety of the data query.
Based on the second aspect, as shown in fig. 2, in some embodiments of the present invention, thequery module 300 includes a permission granting sub-module 310 and adata query sub-module 320, wherein:
the authority endowing sub-module 310 is used for generating contract triggering conditions according to the identity verification result, triggering the intelligent contracts in the block chain and endowing the data query authority of the corresponding users;
and thedata query submodule 320 is configured to, after the data query permission of the corresponding user is given, query the stored data in the block chain according to the data content in the data query request, and generate a data query result.
And returning the input value of the evidence storage function by calling the evidence obtaining function declared in the intelligent contract, calling the corresponding query function by the intelligent contract, and returning the latest data stored in the block by using the evidence obtaining function defined in the intelligent contract. In order to ensure the security of data query, the authority granting sub-module 310 grants the data query authority to the user whose identity is successfully verified, and triggers the intelligent contract to start the query function, and then the data content in the data query request of the data query sub-module 320 queries the stored data in the block chain.
As shown in fig. 2, based on the second aspect, in some embodiments of the present invention, thequery module 300 includes arule query submodule 330, configured to perform a data query in each block node in the block chain according to the identity verification result, the data content in the data query request, and a preset data storage rule, so as to generate a data query result.
When data is queried, the storage coding rule of a preset intelligent contract can be used for traversing block information and transaction information of the ether house, the query display data is reversely decoded and analyzed, and therule query submodule 330 is used for accurately querying the data at each node in the block chain, so that the accurate comprehensiveness of the data query is ensured.
As shown in fig. 2, based on the second aspect, in some embodiments of the present invention, thequery module 300 includes atime query submodule 340, configured to query, according to the authentication result, the time point in the data content in the data query request, and the query information in the data content, the stored data stored at the corresponding time point in the block chain, and generate a data query result.
When data is queried, in order to improve the query efficiency, thetime query submodule 340 only queries at a corresponding time point, and queries the data stored in the block chain only at the corresponding time, so that the query time is greatly saved.
As shown in fig. 3, in a third aspect, an embodiment of the present application provides an electronic device, which includes amemory 101 for storing one or more programs; aprocessor 102. The one or more programs, when executed by theprocessor 102, implement the method of any of the first aspects as described above.
Also included is acommunication interface 103, and thememory 101,processor 102 andcommunication interface 103 are electrically connected to each other, directly or indirectly, to enable transfer or interaction of data. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. Thememory 101 may be used to store software programs and modules, and theprocessor 102 executes the software programs and modules stored in thememory 101 to thereby execute various functional applications and data processing. Thecommunication interface 103 may be used for communicating signaling or data with other node devices.
TheMemory 101 may be, but is not limited to, a Random Access Memory 101 (RAM), a Read Only Memory 101 (ROM), a Programmable Read Only Memory 101 (PROM), an Erasable Read Only Memory 101 (EPROM), an electrically Erasable Read Only Memory 101 (EEPROM), and the like.
Theprocessor 102 may be an integrated circuit chip having signal processing capabilities. TheProcessor 102 may be a general-purpose Processor 102, including a Central Processing Unit (CPU) 102, a Network Processor 102 (NP), and the like; but may also be a Digital Signal processor 102 (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware components.
In the embodiments provided in the present application, it should be understood that the disclosed method and system and method can be implemented in other ways. The method and system embodiments described above are merely illustrative, for example, the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods and systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, which, when executed by theprocessor 102, implements the method according to any one of the first aspect described above. The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory 101 (ROM), a Random Access Memory 101 (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes will occur to those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.