CN112037058B - Data verification method, device and storage medium - Google Patents

Data verification method, device and storage medium Download PDF

Info

Publication number
CN112037058B
CN112037058B CN202010883730.6A CN202010883730A CN112037058B CN 112037058 B CN112037058 B CN 112037058B CN 202010883730 A CN202010883730 A CN 202010883730A CN 112037058 B CN112037058 B CN 112037058B
Authority
CN
China
Prior art keywords
branch
block
target
verification
mvcc
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
CN202010883730.6A
Other languages
Chinese (zh)
Other versions
CN112037058A (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202010883730.6A priority Critical patent/CN112037058B/en
Publication of CN112037058A publication Critical patent/CN112037058A/en
Priority to PCT/CN2021/097243 priority patent/WO2022041901A1/en
Application granted granted Critical
Publication of CN112037058B publication Critical patent/CN112037058B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • G06Q20/4014Identity check for transactions

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Computing Systems (AREA)
  • Development Economics (AREA)
  • Data Mining & Analysis (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application relates to the field of blockchain technologies, and in particular, to a data verification method, a device and a storage medium, where the method is applied to a server, and the method includes: performing conflict comparison on the target block and a plurality of branches in a preset DAG network structure; if no conflict exists between the target block and a plurality of blocks in the plurality of branches, a branch is added for storing the target block; when MVCC verification is performed, the target branch and a plurality of branches are verified in parallel; if a conflict exists between the target block and the block of at least one first branch in the multiple branches, selecting one first branch from the at least one first branch as the target branch; when MVCC verification is performed, at least one first branch may wait for MVCC verification to be completed, and MVCC verification is performed on the target block. By adopting the embodiment of the application, the data verification efficiency is improved.

Description

Data verification method, device and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a data verification method, device and storage medium.
Background
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. One node in the blockchain can provide endorsement services for clients, including services such as repeatability checking of transaction IDs, generation of transaction read-write sets, and final signatures; when verifying and storing each transaction in the blockchain, the method can generally comprise the processes of identity authentication, signature authentication, multi-version concurrency control verification and the like, wherein Multi-version concurrency control (Multi-Version Concurrency Control, MVCC) verification can verify whether the data version in the transaction is correct or not, and at present, single thread is adopted to verify all the transactions one by one, so that the data verification efficiency in the blockchain is poor.
Disclosure of Invention
The embodiment of the application provides a data verification method, a data verification device and a storage medium, which are beneficial to improving the data verification efficiency.
An embodiment of the present application provides a data verification method, applied to a server, including:
acquiring a read set and a write set corresponding to a target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block;
judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is performed on the plurality of branches, performing MVCC verification on the target branch and the plurality of branches in parallel;
if there is a conflict between the target block and at least one block of at least one first branch of the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block into the target branch; and when the MVCC verification is performed on the at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete the MVCC verification, and waiting for each block in the target branch except the target block to complete the MVCC verification, performing MVCC verification on the target block.
A second aspect of the embodiments of the present application provides a data verification device, applied to a server, where the device includes: an acquisition unit, a judgment unit and a verification unit, wherein,
the acquisition unit is used for acquiring a read set and a write set corresponding to the target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block;
the judging unit is used for judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is performed on the plurality of branches, performing MVCC verification on the target branch and the plurality of branches in parallel;
the verifying unit is configured to execute selecting any one of the at least one first branch as the target branch if there is a conflict between the target block and at least one block of the at least one first branch in the plurality of branches, and adding the target block into the target branch; and when the MVCC verification is performed on the at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete the MVCC verification, and waiting for each block in the target branch except the target block to complete the MVCC verification, performing MVCC verification on the target block.
A third aspect of the embodiments of the present application provides a server, the server comprising a processor, a communication interface, a memory and one or more programs, the processor, the communication interface and the memory being connected to each other, wherein the memory is configured to store a computer program, the computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method according to the first aspect of the embodiments of the present application.
A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, wherein the computer program causes a computer to perform part or all of the steps described in the first aspect of the embodiments of the present application.
A fifth aspect of the embodiments of the present application provides a computer program product, wherein the computer program product comprises a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
The implementation of the embodiment of the application has at least the following beneficial effects: a read set and a write set corresponding to the target block can be obtained; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block; judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is carried out on a plurality of branches, MVCC verification is carried out on the target branch and the plurality of branches in parallel; if a conflict exists between the target block and at least one block of at least one first branch in the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block into the target branch; and when MVCC verification is carried out on at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete MVCC verification, and after waiting for each block except the target block in the target branch to complete MVCC verification, carrying out MVCC verification on the target block. In this way, the target block is compared with a plurality of branches in a preset DAG network structure in a conflict manner; if no conflict exists between the target block and a plurality of blocks in the plurality of branches, a branch is added for storing the target block; when MVCC verification is performed, the target branch and a plurality of branches are verified in parallel; if a conflict exists between the target block and the block of at least one first branch in the multiple branches, selecting one first branch from the at least one first branch as the target branch; when MVCC verification is performed, at least one first branch can wait for MVCC verification to be completed, and MVCC verification is performed on the target block, so that the block in the branch can be verified in series by verifying the blocks among the branches in parallel while ensuring smooth MVCC verification, thereby being beneficial to improving the data verification efficiency and the performance of a block chain network.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1A is a schematic flow chart of a data verification method according to an embodiment of the present application;
FIG. 1B is a network configuration diagram of a directed acyclic graph according to an embodiment of the present application;
fig. 2A is a schematic flow chart of a data verification method according to an embodiment of the present application;
FIG. 2B is a network architecture diagram of a DAG graph according to an embodiment of the present application;
FIG. 2C is a network architecture diagram of a DAG graph according to an embodiment of the present application;
FIG. 2D is a network architecture diagram of a DAG graph according to an embodiment of the present application;
fig. 3 is a schematic flow chart of a data verification method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a server according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a data verification device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The terms first, second and the like in the description and in the claims of the present application and in the above-described figures, are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly understand that the embodiments described herein may be combined with other embodiments.
In order to better understand the embodiments of the present application, a method for applying the embodiments of the present application will be described below.
The servers referred to in the embodiments of the present application may include, but are not limited to, background servers, component servers, cloud servers, data verification system servers, or data verification software servers, etc., which are merely examples, but are not exhaustive, including but not limited to the devices described above.
Referring to fig. 1A, fig. 1A is a flow chart of a data verification method provided in an embodiment of the present application, and the method is applied to a server, and includes the following steps:
101. acquiring a read set and a write set corresponding to a target block; multiple branches in the preset DAG network structure are obtained, and each branch corresponds to at least one block.
The embodiment of the application is applied to a server, and the server can comprise a blockchain network, wherein the blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The embodiment of the application is particularly applicable to a FiMax blockchain platform, wherein the FiMax blockchain platform is a blockchain network formed by taking S3C as a basic framework, and the S3C is a framework system formed by a blockchain solution module, a blockchain kernel module, a blockchain privacy protection module and a blockchain network management module.
In this embodiment of the present application, the preset DAG (Directed acyclic graph ) network structure may be set by a user or default by a system, which is not limited herein.
The preset DAG network structure is a directed acyclic graph, as shown in fig. 1B, which is a network structure diagram of the directed acyclic graph, and in the embodiment of the present application, the directed acyclic graph is only one possible permutation and combination mode, which is not limited herein; wherein, each number can correspondingly represent a block, the directed acyclic graph can comprise a plurality of branches (two or more), each branch can comprise at least one block, and the preset DAG network structure is used for storing write sets and read sets corresponding to the plurality of blocks. The preset DAG network structure is used for storing the blocks, and the processes of the blocks are classified, so that when MVCC verification is carried out on the blocks later, the parallel MVCC verification can be carried out according to a plurality of branches, the verification efficiency is improved, and meanwhile, the performance of the block chain is improved.
The target block or block may refer to a data organization unit in the blockchain network, and the blocks may be concatenated by a linked list, each block is formed by packing at least one transaction, the transaction is actual data stored in the blockchain network, and the block may record and confirm when and in what order certain transactions become part of the blockchain.
Wherein, at least one transaction can be stored or packaged in the target block, each transaction can correspond to a set of transaction data, and the transaction data can comprise at least one of the following: version number, block ID, data key value pair, certificate information, signature information, public key, etc., without limitation; wherein the at least one transaction may be related or not related, and is not limited herein.
Optionally, after the obtaining the read set and the write set corresponding to the target block, the method further includes the following steps: acquiring at least one corresponding target transaction in the target block; respectively carrying out identity authentication and signature authentication on each target transaction; if the identity authentication and/or signature authentication of any one of the at least one target transaction A fails, executing a data verification step of terminating the target transaction A, wherein the data verification step at least comprises the following steps: the signature authentication or the MVCC verification.
Wherein, each target transaction may include transaction data, and the transaction data may include at least one of the following: version number, block ID, data key value pair, certificate information, signature information, public and private keys, etc., are not limited herein.
The identity (Verify Authority Chain Code, VACC) authenticates, i.e. verifies, through corresponding certificate information in the transaction data in the target block, whether the initiator of the transaction has authority to initiate the transaction.
Wherein the signature (Verify Signature Chain Code, VSCC) authenticates, i.e. verifies, whether the number of executives of the transaction meets the requirements and that the signature of the transaction executives included in the transaction data is correct.
Wherein the Multi-version concurrency control (Multi-Version Concurrency Control, MVCC) verification is a concurrency control method for verifying whether the data version of the transaction data included in the block is correct; i.e. checking whether the read set of the transaction in the block is consistent with the version in the current database ledger (i.e. has no change), if not, indicating that the modification of the data in the transaction write set is valid, marking the transaction as valid, and updating the write set of the transaction into a specific database (e.g. a status database).
Generally, identity authentication, signature authentication, MVCC authentication and the like can be performed on each transaction respectively to verify whether transaction data are correct, whether a sponsor has authority and the like, and further, the data after verification can be stored in a corresponding database, so that the security of the transaction data is ensured.
In a specific implementation, the verification may be performed on transaction data included in any one of the target transactions, and if any one of the signature authentication, the identity authentication, and the MVCC verification fails, the subsequent authentication is terminated.
102. Judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; upon MVCC verification of the plurality of branches, then MVCC verification of the target branch in parallel with the plurality of branches is performed.
When MVCC verification is performed, whether the data version number of transaction data contained in a block is correct or not is mainly verified, and the block related information is stored in a database, so that in a specific verification process, a server mainly obtains a block from the database and mainly verifies the version of a read set of the transaction contained in the block, however, when more blocks need to be verified, if the block is obtained from the database one by one and MVCC verification is realized by single thread, the efficiency is not high, in order to overcome the defect, a plurality of obtained blocks can be placed in different branches to obtain a plurality of branches, and MVCC verification is directly performed on the plurality of branches in parallel.
In the embodiment of the present application, the description of the data verification method is performed only by taking any one block, i.e., the target block, obtained from the database by the server as an example.
Wherein, after the target block is acquired, the transaction data in the target block may be associated with transaction data in other blocks stored in the database, for example, when MVCC verification is performed on one transaction data in the target block, the transaction data in the target block may need to be used as reference data; as such, in performing MVCC verification, a block associated with the target block may conflict or affect its MVCC verification process; therefore, the target block and the remaining blocks can be collision judged before MVCC verification is performed.
In a specific implementation, the read set of the target block may be compared with the write set corresponding to the block already stored in the database, or the stored block information may be obtained from the database, if no conflict exists between the target block and each block in each branch, this indicates that no data association exists between the target block and each block in multiple branches of the preset DAG network structure, and further, a target branch may be newly added to be used for storing the write set of the target block, and since no data association exists between the blocks of all branches, MVCC verification may be performed on the multiple branches and the target branch in parallel during subsequent MVCC verification, which is beneficial to improving verification efficiency.
In one possible example, the determining whether the target block collides with at least one block in each branch according to the read set may include the following steps: verifying whether a relation exists between the read set and a write set corresponding to at least one block in each branch according to the read set; if no association exists between the read set and the write set corresponding to each block, executing to determine that no conflict exists between the target block and at least one block in each branch; if there is an association between the read set and a write set of at least one block in at least one branch, then performing a determination that a conflict exists between the target block and at least one branch in the plurality of branches.
In one possible example, the verifying whether there is an association between the read set and the write set corresponding to the at least one block in each branch may include the steps of: determining at least one first key value pair in a read set corresponding to the target block, wherein each first key value corresponds to one target transaction; determining at least one second key value pair included in each block in each branch, wherein each second key value corresponds to one transaction in one block; if at least one first key value pair is equal to at least one second key value pair, executing to determine that the read set has a relation with a write set corresponding to at least one block; if any one of the first key value pairs is not equal to any one of the second key value pairs, determining that there is no association between the read set and the write set corresponding to each block is performed.
The key-value pair is a mapping set of key and value, and the key-value pair may be a hash value, which is not limited herein.
Wherein, the key value pairs can be provided with data version numbers, and the versions of the key value pairs can be recorded in a reading set; the latest value of the key value pair can be stored in a writing set, the current value of all key value pairs in the account book can be recorded in a database of the blockchain network, which is equivalent to indexing the transaction log of the current account book, the corresponding key value pair can be correspondingly updated whenever the transaction changes, and the data in the corresponding database can be updated; thus, the server may determine whether there is a conflict between the blocks by comparing the latest value of the first key-value pair in the read set in the target block with the second key-value pair stored in the write set for each of the plurality of branches.
In a specific implementation, a read set of the target block can be read from the database, where the read set includes at least one target transaction, each target transaction can correspond to one first key value pair, and similarly, multiple branches in the preset DAG network structure can be obtained, and a second key value pair corresponding to each block in each branch is obtained; otherwise, if there is no condition that any of the first key value pairs is equal to the second key value pair, it indicates that there is no association between the target block and the plurality of blocks.
103. If there is a conflict between the target block and at least one block of at least one first branch of the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block into the target branch; and when the MVCC verification is performed on the at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete the MVCC verification, and waiting for each block in the target branch except the target block to complete the MVCC verification, performing MVCC verification on the target block.
If there is a conflict between the target block and any one of the first branches, it indicates that the target block and the block in the first branch generating the conflict have related transaction data, and when MVCC verification is performed subsequently, serial verification can be performed between the target branch corresponding to the target block and the first branch generating the conflict, otherwise, if there is no conflict, parallel verification can be performed between the target branch corresponding to the target block and the branches.
Further, taking a target block in the target branch as an example, if there is a conflict between the target block and at least one block of at least one first branch in the multiple branches, selecting any one first branch in the at least one first branch as the target branch; then, when MVCC verification is performed on the at least one first branch (including the target branch) later, since the target branch collides with at least one other first branch, MVCC verification may be performed on the target block after the verification of the at least one other first branch is completed and after the verification of all other blocks in the target branch is completed.
Optionally, if there is no conflict between the at least one first branch except the target branch, parallel verification may be performed on the at least one first branch in the verification process of MVCC, and after each block verification in all the first branches is completed, verification is performed on the target block in the target branch; similarly, for the target branch, if there is no conflict between the other blocks in the target branch, parallel MVCC verification may be performed on the blocks in the target branch that do not have a conflict, and MVCC verification may be performed on the target block after the block verification that does not have a conflict is completed.
Therefore, by adopting the embodiment of the application, the classification of the blocks can be realized through the preset DAG network structure, the blocks corresponding to the branches are not in conflict, and the blocks in the branches may have conflict; furthermore, in MVCC verification, MVCC verification can be performed in parallel between branches, MVCC verification can be performed in series in a branch,
it can be seen that the data verification method described in the embodiment of the present application is applied to a server, and can obtain a read set and a write set corresponding to a target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block; judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is carried out on a plurality of branches, MVCC verification is carried out on the target branch and the plurality of branches in parallel; if a conflict exists between the target block and at least one block of at least one first branch in the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block into the target branch; and when MVCC verification is carried out on at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete MVCC verification, and after waiting for each block except the target block in the target branch to complete MVCC verification, carrying out MVCC verification on the target block. In this way, the target block is compared with a plurality of branches in a preset DAG network structure in a conflict manner; if no conflict exists between the target block and a plurality of blocks in the plurality of branches, a branch is added for storing the target block; when MVCC verification is performed, the target branch and a plurality of branches are verified in parallel; if a conflict exists between the target block and the block of at least one first branch in the multiple branches, selecting one first branch from the at least one first branch as the target branch; when MVCC verification is performed, at least one first branch can wait for MVCC verification to be completed, and MVCC verification is performed on the target block, so that the block in the branch can be verified in series by verifying the blocks among the branches in parallel while ensuring smooth MVCC verification, thereby being beneficial to improving the data verification efficiency and the performance of a block chain network.
In accordance with the foregoing, referring to fig. 2A, fig. 2A is a flowchart illustrating a data verification method disclosed in an embodiment of the present application, which is applied to a server, the data verification method may include the following steps:
201. acquiring a read set and a write set corresponding to a target block; multiple branches in the preset DAG network structure are obtained, and each branch corresponds to at least one block.
202. And verifying whether the read set is associated with the read set corresponding to at least one block in each branch according to the read set.
203. If no association exists between the read set and the read set corresponding to each block, determining that no conflict exists between the target block and at least one block in each branch is executed.
204. If there is an association between the read set and a read set of at least one block in at least one branch, then performing a determination that a conflict exists between the target block and at least one branch in the plurality of branches.
205. If there is a conflict between the target block and at least one block of at least one first branch of the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block to the target branch.
206. If there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; upon MVCC verification of the plurality of branches, then MVCC verification of the target branch in parallel with the plurality of branches is performed.
The specific description of the steps 201 to 206 may refer to the corresponding description of the data verification method described in fig. 1B, and will not be repeated herein.
207. At least one second branch of the plurality of branches that does not conflict with the target branch is determined.
The second branches do not collide with the target branches, which means that transaction data corresponding to any block in each second branch is not related to target transaction data corresponding to the target block.
208. The MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
Because each second branch does not conflict with the first branch and the target branch, the at least one second branch, the at least one first branch and the target branch can be verified in parallel during MVCC verification, so that the data verification efficiency is improved.
In addition, in the branch, since the blocks in the branch may have conflicts, the blocks having conflicts can be verified serially, and the blocks not having conflicts can be verified in parallel.
209. And when the MVCC verification is performed on the at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete the MVCC verification, and waiting for each block in the target branch except the target block to complete the MVCC verification, performing MVCC verification on the target block.
The specific description of step 209 may refer to the corresponding description of the data verification method described in fig. 1B, and will not be repeated here.
For example, as shown in fig. 2B, which is a network structure diagram of a DAG graph, each number may correspond to a block, first, before performing MVCC verification, a server may obtain a block 1 and read a read set and a write set corresponding to the block 1, and a branch may be established based on the block 1, and the first branch may store the read set 1 and the write set 1 of the block 1; then, a block 2, a read set 2 and a write set 2 corresponding to the block 2 can be obtained, and the read set 2 and the write set 2 corresponding to the block 2 are correspondingly stored in a first branch by judging that a conflict exists between the read set 2 and the read set 1; obtaining a block 3, and a read set 3 and a write set 3 corresponding to the block 3, and comparing the read set 3 with the read set 2 and the read set 1 to determine that no conflict exists between the read set 3 and the read set 2 and between the read set 1, and adding a branch, namely a second branch, in the preset DGA network structure for storing the read set 3 and the write set 4 corresponding to the block 3; similarly, the block 4 and the read set 4 and the write set 4 corresponding to the block 4 may be obtained, and if the read set 4 does not conflict with the read set 1, the read set 2, and the read set 3, a third branch is added to store the write set 4 and the read set 4 of the block 4.
Still further, at this time, the block 5 and the corresponding read set 5 and write set 5 may be obtained, and by comparing the read set 5 with the read set 2, the read set 1, the read set 3 and the read set 4, respectively, and determining that the read set 5 collides with the read set 3 and the read set 4, a branch where one read set is located may be selected as a target branch of the read set 5, as shown in fig. 2C, a third branch may be selected as a target branch, and the third branch may be added.
In addition, as shown in fig. 2D, if the block 5 is added to the second branch at this time, the second branch may be selected as the target branch of the block 5, and the third branch may be added.
Furthermore, in the subsequent MVCC verification, the first and second branches and the third branch may be verified in parallel, and inside the branches, serial verification may be performed, for example, for the first branch, block 1 may be verified a priori, and then block 2 may be authenticated again; since the block 5 in the third branch also conflicts with the block 3 in the second branch, that is, the transaction data in the block 5 is associated with both the block 3 and the block 4, the block 5 can be verified after the block 3 and the block 4 are verified when MVCC verification is performed.
It can be seen that the data verification method described in the embodiment of the present application is applied to a server, and obtains a read set and a write set corresponding to a target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block; verifying whether the read set is associated with the read set corresponding to at least one block in each branch according to the read set; if the read set is not associated with the read set corresponding to each block, executing to determine that no conflict exists between the target block and at least one block in each branch; if there is an association between the read set and the read set of at least one block in at least one branch, performing a determination that there is a conflict between the target block and at least one branch in the plurality of branches; if there is a conflict between the target block and at least one block of at least one first branch of the plurality of branches, performing selection of any one of the at least one first branch as the target branch, and adding the target block into the target branch. Determining at least one second branch of the plurality of branches that does not conflict with the target branch; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is carried out on a plurality of branches, MVCC verification is carried out on the target branch and the plurality of branches in parallel; and when MVCC verification is carried out on at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete MVCC verification, and after waiting for each block except the target block in the target branch to complete MVCC verification, carrying out MVCC verification on the target block. Therefore, the blocks can be classified based on the preset DAG network structure, the blocks corresponding to the associated transaction data are placed in the same branch, and the blocks not corresponding to the associated transaction data are placed in different branches; and when the MVCC high concurrency verification is carried out subsequently, the branches can be verified in parallel, and the branches can be verified in series or in parallel, thereby being beneficial to improving the data verification efficiency.
In accordance with the foregoing, referring to fig. 3, fig. 3 is a flowchart illustrating a data verification method disclosed in an embodiment of the present application, applied to a server, the data verification method may include the following steps:
301. acquiring a read set and a write set corresponding to a target block; multiple branches in the preset DAG network structure are obtained, and each branch corresponds to at least one block.
302. Judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; upon MVCC verification of the plurality of branches, then MVCC verification of the target branch in parallel with the plurality of branches is performed.
303. If there is a conflict between the target block and at least one block of at least one first branch of the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block to the target branch.
The specific description of steps 301 to 303 may refer to the corresponding description of the data verification method described in fig. 1B, and will not be repeated herein.
304. At least one second branch of the plurality of branches that does not conflict with the target branch is determined.
305. The MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
The specific description of the steps 304-305 may refer to the corresponding description of the data verification method described in fig. 2A, and will not be repeated herein.
306. And when the MVCC verification is carried out on the at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to finish the MVCC verification, and waiting for each block in the target branch except the target block to finish the MVCC verification, and executing transaction data corresponding to each target transaction to obtain at least one transaction data.
307. And obtaining the data version number corresponding to each transaction data to obtain at least one data version number.
308. Comparing each data version number with a preset version number, and if each data version number is the same as the preset version number, determining that MVCC verification of the target block is successful; if the data version number is different from the preset version number, determining that MVCC verification of the target block fails.
The preset version number may be set by the user or default by the system, which is not limited herein. The preset version number may be set by a background staff, for example, may be 100 or 200, if MVCC verification is successful for a transaction, it indicates that the transaction is valid, a block corresponding to the transaction may be stored in a local chain, and corresponding result data of successful verification may be stored in a database.
In the embodiment of the present application, only one block is taken as an example for data verification, and each block may include at least one transaction, and typically, hundreds or thousands of transactions may be packaged in the corresponding block. The target block may include at least one target transaction, and when the target block is subject to MVCC verification, the target block may be determined to be MVCC verified by taking each target transaction as a unit until each target transaction is verified.
In a specific implementation, the version number corresponding to the transaction data corresponding to each target transaction may be correspondingly stored in the read set corresponding to the block in the database, and whether the transaction is valid or not may be verified through the transaction version number, that is, whether the transaction is a normal transaction or not, if the data version number changes, the transaction is indicated to be invalid, that is, the transaction may have timed out or outdated, the transaction may be determined to be invalid, and the target block is determined to fail in MVCC verification; if the data version number corresponding to the transaction is the same as the preset version number, the transaction can be determined to be a normal transaction, and the target block MVCC can be determined to be successfully verified.
309. And after MVCC verification is completed on the target block, deleting the write set corresponding to the target block in the target branch.
After the MVCC verification is completed on the target block, the server may delete the write set corresponding to the target block and write the operation into the database to prevent the MVCC verification from being repeated, in addition, after a new block is acquired from the database in the next MVCC verification, since the write set may store the latest key value pair, the read set corresponding to the new block may be compared with the write set of the target block to determine whether there is a conflict between the two sets, and if there is a conflict, the relevant steps may be repeated when MVCC verification is performed on the write set of the new block, so as to complete the MVCC verification of the new block.
It can be seen that the data verification method described in the embodiment of the present application is applied to a server, and obtains a read set and a write set corresponding to a target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block; judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is carried out on a plurality of branches, MVCC verification is carried out on the target branch and the plurality of branches in parallel; if there is a conflict between the target block and at least one block of at least one first branch of the plurality of branches, performing selection of any one of the at least one first branch as the target branch, and adding the target block into the target branch. When MVCC verification is carried out on at least one first branch, waiting for each block in other branches except for a target branch in the at least one first branch to complete MVCC verification, and after waiting for each block except for the target block in the target branch to complete MVCC verification, executing transaction data corresponding to each target transaction to obtain at least one transaction data; determining at least one second branch of the plurality of branches that does not conflict with the target branch; performing MVCC verification in parallel with the at least one first branch and the at least one second branch; when MVCC verification is carried out on at least one first branch, waiting for each block in other branches except for a target branch in the at least one first branch to complete MVCC verification, and after waiting for each block except for the target block in the target branch to complete MVCC verification, executing transaction data corresponding to each target transaction to obtain at least one transaction data; acquiring a data version number corresponding to each transaction data to obtain at least one data version number; comparing each data version number with a preset version number, and if each data version number is the same as the preset version number, determining that MVCC verification on the target block is successful; if the data version number is different from the preset version number, determining that MVCC verification of the target block fails; after MVCC verification is completed on the target block, deleting the write set corresponding to the target block in the target branch. Therefore, the blocks can be classified based on the preset DAG network structure, the blocks corresponding to the associated transaction data are placed in the same branch, and the blocks not corresponding to the associated transaction data are placed in different branches; and when the MVCC high concurrency verification is carried out subsequently, the branches can be verified in parallel, and the branches can be verified in series or in parallel, thereby being beneficial to improving the data verification efficiency. In addition, after the target block MVCC is verified, the write set corresponding to the target block may be deleted to avoid re-verification.
In line with the foregoing, referring to fig. 4, fig. 4 is a schematic structural diagram of a server provided in an embodiment of the present application, as shown in fig. 4, including a processor, a communication interface, a memory, and one or more programs, where the processor, the communication interface, and the memory are connected to each other, and the memory is configured to store a computer program, the computer program includes program instructions, the processor is configured to call the program instructions, and the one or more program programs include instructions for performing the following steps:
acquiring a read set and a write set corresponding to a target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block;
judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is performed on the plurality of branches, performing MVCC verification on the target branch and the plurality of branches in parallel;
if there is a conflict between the target block and at least one block of at least one first branch of the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block into the target branch; and when the MVCC verification is performed on the at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete the MVCC verification, and waiting for each block in the target branch except the target block to complete the MVCC verification, performing MVCC verification on the target block.
It can be seen that, the server described in the embodiments of the present application may obtain a read set and a write set corresponding to the target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block; judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is carried out on a plurality of branches, MVCC verification is carried out on the target branch and the plurality of branches in parallel; if a conflict exists between the target block and at least one block of at least one first branch in the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block into the target branch; and when MVCC verification is carried out on at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete MVCC verification, and after waiting for each block except the target block in the target branch to complete MVCC verification, carrying out MVCC verification on the target block. In this way, the target block is compared with a plurality of branches in a preset DAG network structure in a conflict manner; if no conflict exists between the target block and a plurality of blocks in the plurality of branches, a branch is added for storing the target block; when MVCC verification is performed, the target branch and a plurality of branches are verified in parallel; if a conflict exists between the target block and the block of at least one first branch in the multiple branches, selecting one first branch from the at least one first branch as the target branch; when MVCC verification is performed, at least one first branch can wait for MVCC verification to be completed, and MVCC verification is performed on the target block, so that the block in the branch can be verified in series by verifying the blocks among the branches in parallel while ensuring smooth MVCC verification, thereby being beneficial to improving the data verification efficiency and the performance of a block chain network.
In one possible example, after the acquisition of the read set and the write set corresponding to the target block, the program is configured to execute the following instructions:
acquiring at least one corresponding target transaction in the target block;
respectively carrying out identity authentication and signature authentication on each target transaction;
if the identity authentication and/or signature authentication of any one of the at least one target transaction A fails, executing a data verification step of terminating the target transaction A, wherein the data verification step at least comprises the following steps: the signature authentication or the MVCC verification.
In one possible example, in said determining whether there is a conflict between said target block and at least one block in said each branch according to said read set, said program is configured to execute instructions for:
verifying whether the read set is associated with a write set corresponding to at least one block in each branch according to the read set;
if no association exists between the read set and the write set corresponding to each block, executing to determine that no conflict exists between the target block and at least one block in each branch;
if there is an association between the read set and a write set of at least one block in at least one branch, then performing a determination that a conflict exists between the target block and at least one branch in the plurality of branches.
In one possible example, the program is configured to execute the following instructions in terms of verifying whether there is an association between the read set and a write set corresponding to at least one block in each branch:
determining at least one first key value pair in a read set corresponding to the target block, wherein each first key value corresponds to one target transaction;
determining at least one second key value pair included in each block in each branch, wherein each second key value corresponds to one transaction in one block;
if at least one first key value pair is equal to at least one second key value pair, executing to determine that the read set has a relation with a write set corresponding to at least one block; if any one of the first key value pairs is not equal to any one of the second key value pairs, determining that there is no association between the read set and the write set corresponding to each block is performed.
In one possible example, in terms of the MVCC verification of the target tile, the program is to execute instructions to:
determining transaction data corresponding to each target transaction to obtain at least one transaction data;
acquiring a data version number corresponding to each transaction data to obtain at least one data version number;
Comparing each data version number with a preset version number, and if each data version number is the same as the preset version number, determining that MVCC verification of the target block is successful; if the data version number is different from the preset version number, determining that MVCC verification of the target block fails.
In one possible example, if the read set collides with at least one of the plurality of branches, the program is configured to execute instructions for:
determining at least one second branch of the plurality of branches that does not conflict with the target branch;
the MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
In one possible example, the program is further for executing instructions for:
and after MVCC verification is completed on the target block, deleting the write set corresponding to the target block in the target branch.
The foregoing description of the embodiments of the present application has been presented primarily in terms of a method-side implementation. It will be appreciated that the server, in order to implement the above-described functions, includes corresponding hardware structures and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied as hardware or a combination of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application may divide the functional units of the server according to the above method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated in one processing unit. The integrated units may be implemented in hardware or in software functional units. It should be noted that, in the embodiment of the present application, the division of the units is schematic, which is merely a logic function division, and other division manners may be implemented in actual practice.
In accordance with the foregoing, referring to fig. 5, fig. 5 is a schematic structural diagram of a data verification device disclosed in an embodiment of the present application, applied to a server, the device includes: an acquisition unit 501, a judgment unit 502, and a verification unit 503, wherein,
the acquiring unit 501 is configured to acquire a read set and a write set corresponding to a target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block;
the judging unit 502 is configured to judge, according to the read set, whether there is a conflict between the target block and at least one block in each branch; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is performed on the plurality of branches, performing MVCC verification on the target branch and the plurality of branches in parallel;
The verifying unit 503 is configured to perform selecting any one of the at least one first branch as the target branch if there is a conflict between the target block and at least one block of the at least one first branch in the plurality of branches, and adding the target block to the target branch; and when the MVCC verification is performed on the at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete the MVCC verification, and waiting for each block in the target branch except the target block to complete the MVCC verification, performing MVCC verification on the target block.
It can be seen that the data verification device described in the embodiment of the present application is applied to a server, and can obtain a read set and a write set corresponding to a target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block; judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is carried out on a plurality of branches, MVCC verification is carried out on the target branch and the plurality of branches in parallel; if a conflict exists between the target block and at least one block of at least one first branch in the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block into the target branch; and when MVCC verification is carried out on at least one first branch, waiting for each block in other branches except the target branch in the at least one first branch to complete MVCC verification, and after waiting for each block except the target block in the target branch to complete MVCC verification, carrying out MVCC verification on the target block. In this way, the target block is compared with a plurality of branches in a preset DAG network structure in a conflict manner; if no conflict exists between the target block and a plurality of blocks in the plurality of branches, a branch is added for storing the target block; when MVCC verification is performed, the target branch and a plurality of branches are verified in parallel; if a conflict exists between the target block and the block of at least one first branch in the multiple branches, selecting one first branch from the at least one first branch as the target branch; when MVCC verification is performed, at least one first branch can wait for MVCC verification to be completed, and MVCC verification is performed on the target block, so that the block in the branch can be verified in series by verifying the blocks among the branches in parallel while ensuring smooth MVCC verification, thereby being beneficial to improving the data verification efficiency and the performance of a block chain network.
In one possible example, in the aspect of determining whether there is a conflict between the target block and at least one block in each branch according to the read set, the determining unit 502 is specifically configured to:
verifying whether the read set is associated with a write set corresponding to at least one block in each branch according to the read set;
if no association exists between the read set and the write set corresponding to each block, executing to determine that no conflict exists between the target block and at least one block in each branch;
if there is an association between the read set and a write set of at least one block in at least one branch, then performing a determination that a conflict exists between the target block and at least one branch in the plurality of branches.
In one possible example, the verifying unit 503 is specifically configured to, in terms of verifying whether there is an association between the read set and the write set corresponding to the at least one block in each branch:
determining at least one first key value pair in a read set corresponding to the target block, wherein each first key value corresponds to one target transaction;
determining at least one second key value pair included in each block in each branch, wherein each second key value corresponds to one transaction in one block;
If at least one first key value pair is equal to at least one second key value pair, executing to determine that the read set has a relation with a write set corresponding to at least one block; if any one of the first key value pairs is not equal to any one of the second key value pairs, determining that there is no association between the read set and the write set corresponding to each block is performed.
In one possible example, in terms of the MVCC verification of the target tile, the verification unit 503 is specifically further configured to:
determining transaction data corresponding to each target transaction to obtain at least one transaction data;
acquiring a data version number corresponding to each transaction data to obtain at least one data version number;
comparing each data version number with a preset version number, and if each data version number is the same as the preset version number, determining that MVCC verification of the target block is successful; if the data version number is different from the preset version number, determining that MVCC verification of the target block fails.
In one possible example, if the read set collides with at least one of the plurality of branches, the verification unit 503 is specifically further configured to:
Determining at least one second branch of the plurality of branches that does not conflict with the target branch;
the MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
The present application also provides a computer-readable storage medium storing a computer program for electronic data exchange, the computer program causing a computer to execute some or all of the steps of any one of the data verification methods described in the above method embodiments.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any one of the data verification methods described in the method embodiments above.
It should be noted that, for simplicity of description, the foregoing method embodiments are all expressed as a series of action combinations, but it should be understood by those skilled in the art that the present application is not limited by the order of actions described, as some steps may be performed in other order or simultaneously in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required in the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, such as the division of the units, merely a logical function division, and there may be additional manners of dividing the actual implementation, such as multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units described above may be implemented either in hardware or in software program modules.
The integrated units, if implemented in the form of software program modules, may be stored in a computer-readable memory for sale or use as a stand-alone product. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a memory, including several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present application. And the aforementioned memory includes: a U-disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those of ordinary skill in the art will appreciate that all or a portion of the steps in the various methods of the above embodiments may be implemented by a program that instructs associated hardware, and the program may be stored in a computer readable memory, which may include: flash disk, ROM, RAM, magnetic or optical disk, etc.
The foregoing has outlined rather broadly the more detailed description of embodiments of the present application, wherein specific examples are provided herein to illustrate the principles and embodiments of the present application, the above examples being provided solely to assist in the understanding of the methods of the present application and the core ideas thereof; meanwhile, as those skilled in the art will have modifications in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (8)

1. A data verification method, applied to a server, comprising:
acquiring a read set and a write set corresponding to a target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block;
judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is performed on the plurality of branches, performing MVCC verification on the target branch and the plurality of branches in parallel;
If there is a conflict between the target block and at least one block of at least one first branch of the plurality of branches, executing to select any one of the at least one first branch as the target branch, and adding the target block into the target branch; waiting for each block in the at least one first branch other than the target branch to complete the MVCC verification while the MVCC verification is performed on the at least one first branch, and waiting for each block in the target branch other than the target block to complete the MVCC verification, then performing MVCC verification on the target block;
wherein the determining, according to the read set, whether the target block collides with at least one block in each branch includes: verifying whether a relation exists between the read set and a write set corresponding to at least one block in each branch according to the read set; if no association exists between the read set and the write set corresponding to each block, executing to determine that no conflict exists between the target block and at least one block in each branch; if there is an association between the read set and a write set of at least one block in at least one branch, performing a determination that a conflict exists between the target block and at least one branch in the plurality of branches;
The performing MVCC verification on the target block includes: determining transaction data corresponding to each target transaction in at least one corresponding target transaction in the target block to obtain at least one transaction data; acquiring a data version number corresponding to each transaction data to obtain at least one data version number; comparing each data version number with a preset version number, and if each data version number is the same as the preset version number, determining that MVCC verification of the target block is successful; if the data version number is different from the preset version number, determining that MVCC verification of the target block fails.
2. The method of claim 1, wherein after the obtaining the read set and the write set corresponding to the target block, the method further comprises:
acquiring at least one corresponding target transaction in the target block;
respectively carrying out identity authentication and signature authentication on each target transaction;
if the identity authentication and/or signature authentication of any one of the at least one target transaction A fails, executing a data verification step of terminating the target transaction A, wherein the data verification step at least comprises the following steps: the signature authentication or the MVCC verification.
3. The method of claim 2, wherein verifying whether there is an association between the read set and a write set corresponding to at least one block in each branch comprises:
determining at least one first key value pair in a read set corresponding to the target block, wherein each first key value corresponds to one target transaction;
determining at least one second key value pair included in each block in each branch, wherein each second key value corresponds to one transaction in one block;
if at least one first key value pair is equal to at least one second key value pair, executing to determine that the read set has a relation with a write set corresponding to at least one block; if any one of the first key value pairs is not equal to any one of the second key value pairs, determining that there is no association between the read set and the write set corresponding to each block is performed.
4. A method according to claim 2 or 3, wherein if the read set collides with at least one of the plurality of branches, the method further comprises, upon the MVCC verification of the at least one first branch:
determining at least one second branch of the plurality of branches that does not conflict with the target branch;
The MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
5. The method according to claim 4, wherein the method further comprises:
and after MVCC verification is completed on the target block, deleting the write set corresponding to the target block in the target branch.
6. A data verification apparatus for use with a server, the apparatus comprising: an acquisition unit, a judgment unit and a verification unit, wherein,
the acquisition unit is used for acquiring a read set and a write set corresponding to the target block; acquiring a plurality of branches in a preset DAG network structure, wherein each branch corresponds to at least one block;
the judging unit is used for judging whether the target block conflicts with at least one block in each branch according to the read set; if there is no conflict between the target block and at least one block in each branch, executing a new target branch for storing the write set of the target block; when MVCC verification is performed on the multiple branches, performing MVCC verification on the target branch and the multiple branches in parallel, where in the aspect of determining, according to the read set, whether there is a conflict between the target block and at least one block in each branch, the determining unit is specifically configured to: verifying whether a relation exists between the read set and a write set corresponding to at least one block in each branch according to the read set; if no association exists between the read set and the write set corresponding to each block, executing to determine that no conflict exists between the target block and at least one block in each branch; if there is an association between the read set and a write set of at least one block in at least one branch, performing a determination that a conflict exists between the target block and at least one branch in the plurality of branches;
The verifying unit is configured to execute selecting any one of the at least one first branch as the target branch if there is a conflict between the target block and at least one block of the at least one first branch in the plurality of branches, and adding the target block into the target branch; when the MVCC verification is performed on the at least one first branch, waiting for each block in other branches in the at least one first branch except for the target branch to complete the MVCC verification, and waiting for each block in the target branch except for the target block to complete the MVCC verification, performing MVCC verification on the target block, wherein in terms of MVCC verification on the target block, the verification unit is specifically configured to: determining transaction data corresponding to each target transaction in at least one corresponding target transaction in the target block to obtain at least one transaction data; acquiring a data version number corresponding to each transaction data to obtain at least one data version number; comparing each data version number with a preset version number, and if each data version number is the same as the preset version number, determining that MVCC verification of the target block is successful; if the data version number is different from the preset version number, determining that MVCC verification of the target block fails.
7. A server comprising a processor, a communication interface, a memory and one or more programs, the processor, communication interface and memory being interconnected, wherein the memory is adapted to store a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1-5.
8. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any of claims 1-5.
CN202010883730.6A 2020-08-28 2020-08-28 Data verification method, device and storage medium Active CN112037058B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010883730.6A CN112037058B (en) 2020-08-28 2020-08-28 Data verification method, device and storage medium
PCT/CN2021/097243 WO2022041901A1 (en) 2020-08-28 2021-05-31 Data verification method and apparatus, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010883730.6A CN112037058B (en) 2020-08-28 2020-08-28 Data verification method, device and storage medium

Publications (2)

Publication Number Publication Date
CN112037058A CN112037058A (en) 2020-12-04
CN112037058B true CN112037058B (en) 2024-03-26

Family

ID=73587610

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010883730.6A Active CN112037058B (en) 2020-08-28 2020-08-28 Data verification method, device and storage medium

Country Status (2)

Country Link
CN (1) CN112037058B (en)
WO (1) WO2022041901A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112037058B (en) * 2020-08-28 2024-03-26 平安科技(深圳)有限公司 Data verification method, device and storage medium
CN113746908A (en) * 2021-08-19 2021-12-03 卓尔智联(武汉)研究院有限公司 Data processing method and system, electronic device and computer storage medium
CN114221961B (en) * 2021-12-14 2024-03-26 深圳前海微众银行股份有限公司 Hierarchical DAG blockchain generation method, apparatus, medium, and program product
CN115796874B (en) * 2023-01-09 2023-05-09 杭州安节科技有限公司 Concurrent execution method for blockchain transaction at operation level

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109559226A (en) * 2018-11-28 2019-04-02 杭州有盾网络科技有限公司 Block chain transaction execution method, system and electronic equipment and storage medium
CN110851535A (en) * 2019-11-18 2020-02-28 腾讯科技(深圳)有限公司 Data processing method and device based on block chain, storage medium and terminal
WO2020108289A1 (en) * 2018-11-29 2020-06-04 华为技术有限公司 Database system, node and method
CN111241061A (en) * 2020-01-09 2020-06-05 平安科技(深圳)有限公司 Writing method of state database, data processing device and storage medium

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018161051A1 (en) * 2017-03-02 2018-09-07 Allocrypt, Inc. Cryptographically secure medical test data distribution system using smart testing/diagnostic devices
US10579368B2 (en) * 2017-03-10 2020-03-03 Salesforce.Com, Inc. Blockchain version control systems
US10922692B2 (en) * 2017-04-05 2021-02-16 Samsung Sds Co., Ltd. Method for calculating confirmation reliability for blockchain based transaction and blockchain network monitoring system for performing the method
US10701054B2 (en) * 2018-01-31 2020-06-30 Salesforce.Com, Inc. Systems, methods, and apparatuses for implementing super community and community sidechains with consent management for distributed ledger technologies in a cloud based computing environment
CN110807047A (en) * 2018-07-20 2020-02-18 富士通株式会社 Method and apparatus for managing validity of information processing task
US11521202B2 (en) * 2018-08-30 2022-12-06 International Business Machines Corporation Distributed computing and storage network implementing high integrity, high bandwidth, low latency, secure processing
CN109614206A (en) * 2018-10-25 2019-04-12 深圳壹账通智能科技有限公司 Device, method and the storage medium of block chain issued transaction
US11288280B2 (en) * 2018-10-31 2022-03-29 Salesforce.Com, Inc. Systems, methods, and apparatuses for implementing consumer data validation, matching, and merging across tenants with optional verification prompts utilizing blockchain
US11783024B2 (en) * 2019-01-31 2023-10-10 Salesforce, Inc. Systems, methods, and apparatuses for protecting consumer data privacy using solid, blockchain and IPFS integration
CN110781196A (en) * 2019-09-06 2020-02-11 深圳壹账通智能科技有限公司 Block chain transaction processing method and device, computer equipment and storage medium
CN112037058B (en) * 2020-08-28 2024-03-26 平安科技(深圳)有限公司 Data verification method, device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109559226A (en) * 2018-11-28 2019-04-02 杭州有盾网络科技有限公司 Block chain transaction execution method, system and electronic equipment and storage medium
WO2020108289A1 (en) * 2018-11-29 2020-06-04 华为技术有限公司 Database system, node and method
CN110851535A (en) * 2019-11-18 2020-02-28 腾讯科技(深圳)有限公司 Data processing method and device based on block chain, storage medium and terminal
CN111241061A (en) * 2020-01-09 2020-06-05 平安科技(深圳)有限公司 Writing method of state database, data processing device and storage medium

Also Published As

Publication number Publication date
CN112037058A (en) 2020-12-04
WO2022041901A1 (en) 2022-03-03

Similar Documents

Publication Publication Date Title
CN112037058B (en) Data verification method, device and storage medium
US11196572B2 (en) Blockchain-based content verification
EP3678346B1 (en) Blockchain smart contract verification method and apparatus, and storage medium
US20200294048A1 (en) Blockchain-based data verification method and apparatus, and electronic device
TWI734088B (en) Block chain-based transaction processing method and device, and electronic equipment
Sonnino et al. Replay attacks and defenses against cross-shard consensus in sharded distributed ledgers
CN107077546B (en) System and method for updating possession factor credentials
US9521132B2 (en) Secure data storage
US20210049715A1 (en) Blockchain-based data procesing method, apparatus, and electronic device
CA3030813A1 (en) Method for providing smart contract-based certificate service, and server employing same
KR101937220B1 (en) Method for generating and verifying a digital signature or message authentication code based on a block chain that does not require key management
KR20200105997A (en) System and method for blockchain-based authentication
US11769146B1 (en) Blockchain transactional identity verification
CN115514492A (en) BIOS firmware verification method, device, server, storage medium and program product
CN109033818B (en) Terminal, authentication method, and computer-readable storage medium
CN112015558A (en) Data verification method, device and storage medium
JP6174247B2 (en) Program integrity verification method using hash
CN109063461B (en) Third-party password-free login method and system
US11973878B2 (en) Non-fungible token custody chain for multi-component hardware devices
CN113886894A (en) Digital signature method and digital signature device
KR102625023B1 (en) Secure data processing
CN112732676A (en) Data migration method, device, equipment and storage medium based on block chain
CN111461721A (en) Block chain-based method and device for protecting account and verifying transaction
US11893587B2 (en) System for enhanced authentication using non-fungible tokens (NFTs)
CN109165208A (en) It is a kind of for loading data into the method and system in database

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