WO2022041901A1 - Data verification method and apparatus, and storage medium - Google Patents

Data verification method and apparatus, and storage medium Download PDF

Info

Publication number
WO2022041901A1
WO2022041901A1 PCT/CN2021/097243 CN2021097243W WO2022041901A1 WO 2022041901 A1 WO2022041901 A1 WO 2022041901A1 CN 2021097243 W CN2021097243 W CN 2021097243W WO 2022041901 A1 WO2022041901 A1 WO 2022041901A1
Authority
WO
WIPO (PCT)
Prior art keywords
branch
block
target
verification
mvcc
Prior art date
Application number
PCT/CN2021/097243
Other languages
French (fr)
Chinese (zh)
Inventor
冯世伟
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022041901A1 publication Critical patent/WO2022041901A1/en

Links

Images

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

Definitions

  • the present application relates to the field of blockchain technology, and in particular to a data verification method, device and storage medium.
  • Blockchain is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • the inventor realizes that a node in the blockchain can provide endorsement services to the client, including duplication checking of transaction IDs, generation of transaction read-write sets, and final signatures, etc.; for each transaction in the blockchain
  • a transaction is verified and stored, it can roughly include processes such as identity authentication, signature authentication, and multi-version concurrency control verification.
  • Multi-Version Concurrency Control (MVCC) verification can verify whether the data version in the transaction is correct. At present, most of the transactions are verified one by one using a single thread, resulting in poor data verification efficiency in the blockchain.
  • MVCC Multi-Version Concurrency Control
  • the embodiments of the present application provide a data verification method, device, and storage medium, which are beneficial to improve data verification efficiency.
  • a first aspect of the embodiments of the present application provides a data verification method, applied to a server, including:
  • the read set determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
  • a second aspect of an embodiment of the present application provides a data verification apparatus, which is applied to a server, and the apparatus includes: an acquisition unit, a judgment unit, and a verification unit, wherein,
  • the obtaining unit is used to obtain the read set and the write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
  • the judging unit is configured to judge whether there is a conflict between the target block and at least one block in each branch according to the read set; if the target block and at least one area in each branch If there is no conflict between the blocks, then execute a new target branch for storing the write set of the target block; when MVCC verification is performed on the multiple branches, execute the target branch and all The multiple branches described above perform MVCC verification in parallel;
  • the verification unit is configured to select any one of the at least one first 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.
  • a branch is used as the target branch, and the target block is added to the target branch; when the MVCC verification is performed on the at least one first branch, waiting for the at least one first branch to remove the Each block in the branches other than the target branch completes the MVCC verification, and after each block in the target branch except the target block completes the MVCC verification, execute the The target block is verified by MVCC.
  • a third aspect of the embodiments of the present application provides a server, the server includes a processor, a communication interface, a memory, and one or more programs, the processor, the communication interface, and the memory are connected to each other, wherein the memory is used for A computer program is stored, the computer program includes program instructions, the processor is configured to invoke the program instructions to perform the following method:
  • the read set determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
  • 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 execute the following method:
  • the read set determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
  • Implementing the embodiments of the present application can ensure the smooth progress of MVCC verification, and simultaneously verify the blocks in the branches between the above branches in parallel, which is conducive to improving the efficiency of data verification, and thus, is conducive to improving the blockchain network. performance.
  • FIG. 1A provides a schematic flowchart of a data verification method according to an embodiment of the present application
  • FIG. 1B provides a network structure diagram of a directed acyclic graph according to an embodiment of the present application
  • FIG. 2A provides a schematic flowchart of a data verification method according to an embodiment of the present application
  • FIG. 2B provides a network structure diagram of a DAG graph for an embodiment of the present application
  • FIG. 2C provides a network structure diagram of a DAG graph for an embodiment of the present application
  • FIG. 2D provides a network structure diagram of a DAG graph for an embodiment of the present application
  • FIG. 4 provides a schematic structural diagram of a server according to an embodiment of the present application.
  • FIG. 5 provides a schematic structural diagram of a data verification apparatus according to an embodiment of the present application.
  • the servers mentioned in the embodiments of this application may include but are not limited to background servers, component servers, cloud servers, data verification system servers or data verification software servers, etc.
  • the above are only examples, not exhaustive, including but not limited to the above devices .
  • FIG. 1A is a schematic flowchart of a data verification method provided by an embodiment of the present application, applied to a server, and the above method includes the following steps:
  • a server which may include a blockchain network
  • the blockchain is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the FiMax blockchain platform is a blockchain network composed of S3C as the basic framework.
  • the S3C is composed of blockchain solution modules, districts A framework system composed of blockchain kernel module, blockchain privacy protection module and blockchain network management module.
  • the above-mentioned preset DAG directed acyclic graph, directed acyclic graph
  • the above-mentioned preset DAG directed acyclic graph, directed acyclic graph
  • the above-mentioned preset DAG directed acyclic graph, directed acyclic graph
  • the above-mentioned preset DAG network structure is a directed acyclic graph, as shown in FIG. 1B , which is a network structure diagram of a directed acyclic graph.
  • the directed acyclic graph is only is a possible arrangement and combination, which is not limited here; wherein, each number can correspond to a block, and the directed acyclic graph can include multiple (two or more) branches, each branch can include at least one block, and the preset DAG network structure is used to store write sets and read sets corresponding to multiple blocks.
  • the above-mentioned preset DAG network structure is used to store the above-mentioned multiple blocks, and to classify the above-mentioned multiple block processes, which is conducive to the subsequent MVCC verification of the above-mentioned multiple blocks, and the parallel MVCC verification can be performed according to multiple branches, which is beneficial to improve the The verification efficiency, at the same time, is also conducive to improving the performance of the above-mentioned blockchain.
  • the above-mentioned target block or block may refer to a data organization unit in the blockchain network.
  • the blocks can be connected in series by a linked list.
  • Each block is packaged by at least one transaction, and the transaction is stored in the block.
  • Actual data in a blockchain network that records and confirms when and in what order certain transactions became part of the blockchain.
  • At least one transaction can be stored or packaged in the above-mentioned target block, each transaction can correspond to a set of transaction data, and the transaction data can include at least one of the following: version number, block ID, data key-value pair, certificate information , signature information, public key, etc., which are not limited here; wherein, the at least one transaction may be related or unrelated, which is not limited here.
  • the following steps may be further included: obtaining at least one target transaction corresponding to the target block; Signature authentication; if any target transaction A in the at least one target transaction fails identity authentication and/or signature authentication fails, execute the step of terminating the data verification of the target transaction A, and the data verification step at least includes: the Signature authentication or the MVCC verification.
  • each of the above target transactions 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 key and private key, etc. This is not limited.
  • the above-mentioned identity verification is to verify whether the initiator of the transaction has the authority to initiate the transaction through the corresponding certificate information in the transaction data in the target block.
  • the above signature (Verify Signature Chain Code, VSCC) certification is to verify whether the number of executors of this transaction meets the requirements and whether the signature of the transaction executor included in the transaction data is correct.
  • the above-mentioned multi-version concurrency control (Multi-Version Concurrency Control, MVCC) verification is a method of concurrency control, which is used to verify whether the data version of the transaction data included in the above-mentioned block is correct; Whether the read set is consistent with the version in the current database ledger (that is, there is no change), if there is no change, it means that the modification of the data in the transaction write set is valid, mark the transaction as valid, and the write set of the transaction is updated to the specific database (such as the status database).
  • MVCC Multi-Version Concurrency Control
  • identity authentication, signature authentication, and MVCC verification can be performed on each transaction to verify whether the transaction data is correct and whether the initiating transaction has authority, etc., and then, the verified data can be stored in the corresponding database to ensure the security of transaction data.
  • the above verification may be performed on the transaction data contained in any one of the above target transactions, and if any one of the above signature verification, identity verification, or MVCC verification fails, the subsequent verification is terminated.
  • the read set determine 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 conflict, execute a new target branch to store the write set of the target block; when performing MVCC verification on the multiple branches, execute the target branch in parallel with the multiple branches Perform MVCC verification.
  • the main verification is whether the data version number of the transaction data contained in the block is correct, and the block related information is stored in the database. Therefore, in the specific verification process, the server mainly from the The block is obtained from the database, and the version of the read set of the transaction contained in the block is mainly verified.
  • the server mainly from the The block is obtained from the database, and the version of the read set of the transaction contained in the block is mainly verified.
  • the acquired blocks can be placed in different branches to obtain multiple branches, and the MVCC verification can be directly performed on the above-mentioned multiple branches in parallel.
  • the transaction data in the target block may be related to the transaction data in other blocks stored in the database.
  • a transaction data in the target block is being processed by MVCC
  • the read set of the target block can be compared with the write set corresponding to the block that has been stored in the database, or the stored block information can be obtained from the database, if the target block and each of the above-mentioned blocks can be compared.
  • There is no conflict between each block in a branch indicating that there is no data correlation between the target block and each block in the multiple branches of the above-mentioned preset DAG network structure, and further, a new one can be added.
  • the target branch is used to store the write set of the target block. Since there is no data association between the blocks of all branches, in the subsequent MVCC verification, the above-mentioned multiple branches and the target branch can be processed in parallel MVCC verification, in this way, is beneficial to improve verification efficiency.
  • judging whether there is a conflict between the target block and at least one block in each branch according to the read set may include the following steps: verifying all the blocks according to the read set Whether there is an association between the read set and the write set corresponding to at least one block in the each branch; if there is no association between the read set and the write set corresponding to each block, execute the determination There is no conflict between the target block and at least one block in each branch; if there is an association between the read set and the write set of at least one block in at least one branch, execute determining the There is a conflict between the target block and at least one of the plurality of branches.
  • the verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch may include the following steps: determining the read set corresponding to the target block Collect at least one first key-value pair, each first key value corresponds to a target transaction; determine at least one second key-value pair included in each block in each branch, each second key value The pair corresponds to a transaction in a block; if at least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute a write that determines that the read set corresponds to at least one block There is an association between sets; if any first key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
  • the above-mentioned key-value pair is a mapping set of key and value, and the above-mentioned key-value pair may also be a hash value, which is not specifically limited herein.
  • the above key-value pairs can have data version numbers, and the version of the key-value pair can be recorded in the read set; the latest value of the key-value pair can be stored in the write set, and the database of the blockchain network can record all the records in the ledger
  • the current value of the key-value pair is equivalent to indexing the transaction log of the current ledger.
  • the server can realize whether there is a pair of 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 of each block in the multiple branches conflicting judgments.
  • the read set of the target block can be read from the database.
  • the read set includes at least one target transaction, and each target transaction can correspond to a first key-value pair.
  • the preset DAG network structure can be obtained. and obtain the second key-value pair corresponding to each block in each branch, if there is a difference between a certain target transaction data in the target block and the transaction data corresponding to any one of the above-mentioned blocks If there is an association, then the key-value pairs corresponding to the two transactions will be updated, and the two key-value pairs are equal.
  • any first key-value pair is equal to at least one second key-value pair, then Indicates that the transaction data between the target block and the block corresponding to at least one second key-value pair is related; on the contrary, if there is no situation where any first key-value pair is equal to the second key-value pair, it indicates that There is no relationship between the target block and the above-mentioned multiple blocks.
  • the target branch corresponding to the target block and the conflicting first branch can be serially verified, otherwise, if there is no conflict, the target branch corresponding to the target block can be paralleled with the above-mentioned multiple branches verify.
  • the target block in the target branch if there is a conflict between the target block and at least one block of at least one first branch in the multiple branches, then select any one of the at least one first branch.
  • One branch is used as the target branch; then, when the MVCC verification is performed on the at least one first branch (including the target branch), since the target branch conflicts with the remaining at least one first branch, the remaining at least one first branch can be waited for. After the verification is completed, and after the verification of all remaining blocks in the target branch is completed, the MVCC verification is performed on the target block.
  • the at least one first branch can be verified in parallel, and all the first branches can be verified in parallel.
  • the target block in the above target branch is verified; similarly, for the target branch, if there is no conflict between the remaining blocks in the target branch, the target branch can be verified.
  • Parallel MVCC verification is performed on multiple blocks with conflicts, and MVCC verification is performed on the target block after the verification of multiple blocks without conflicts is completed.
  • the classification of multiple blocks can be realized by presetting the DAG network structure, and the blocks corresponding to the branches do not conflict, while the blocks in the branches may be different from each other. There is a conflict; further, when MVCC verification is performed, MVCC verification can be performed in parallel between branches, and MVCC verification can be performed in series within the branch.
  • the data verification method described in the embodiment of the present application is applied to the server, and the read set and write set corresponding to the target block can be obtained; a plurality of branches in the preset DAG network structure can be obtained, and each branch corresponds to at least A block; according to the read set, determine 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, execute a new target
  • the branch is used to store the write set of the target block; when MVCC verification is performed on multiple branches, MVCC verification is performed on the target branch and multiple branches in parallel; if the target block and at least one of the multiple branches are the first branch There is a conflict between at least one block of the at least one first branch, then select any first branch in the at least one first branch as the target branch, and add the target block to the target branch; when MVCC verification is performed on the at least one first branch , wait for each block in the at least one first branch except the target branch to complete
  • the conflict between the target block and the multiple branches in the preset DAG network structure is compared; if there is no conflict between the target block and multiple blocks in the multiple branches, a new branch is added for Store the target block; when performing the MVCC verification, verify the target branch and multiple branches in parallel; if there is a conflict between the target block and the block of at least one first branch in the multiple branches, from at least one first branch One of the first branches is selected as the target branch; when MVCC verification is performed, it is possible to wait for at least one first branch to complete MVCC verification, and then perform MVCC verification on the target block. Therefore, it can ensure the smooth progress of MVCC verification at the same time. , by verifying the blocks in the branches in parallel and serially verifying the blocks in the branches, it is beneficial to improve the efficiency of data verification, and thus, it is beneficial to improve the performance of the blockchain network.
  • FIG. 2A is an exemplary flowchart of a data verification method disclosed in an embodiment of the present application, applied to a server, and the data verification method may include the following steps:
  • the read set verify whether the read set is associated with a read set corresponding to at least one block in each branch.
  • the above-mentioned second branch does not conflict with the above-mentioned target branch may mean that the transaction data corresponding to any block corresponding to each of the above-mentioned second branches is irrelevant to the target transaction data corresponding to the above-mentioned target block.
  • each of the above-mentioned second branches does not conflict with the above-mentioned first branch and the target branch, when the MVCC verification is performed, the above-mentioned at least one second branch, at least one first branch and the target branch can be verified in parallel, to improve data validation efficiency.
  • the conflicting blocks can be verified serially, and the non-conflicting blocks can be verified in parallel.
  • step 209 may refer to the corresponding description of the data verification method shown in FIG. 1B , which is not repeated here.
  • each number can correspond to a block.
  • the server can obtain block 1 and read block 1 For the corresponding read set and write set, a branch can be established based on the block 1, which is the first branch, and the read set 1 and the write set 1 of the block 1 can be stored in the first branch; then, the block 2 can be obtained, And the read set 2 and the write set 2 corresponding to the block 2, by judging that there is a conflict between the read set 2 and the read set 1, the read set 2 and the write set 2 corresponding to the block 2 are stored in the first branch correspondingly In; obtain block 3, and the corresponding read set 3 and write set 3 of this block 3, by comparing read set 3 and read set 2 and read set 1, determine this read set 3 and above-mentioned read set 2 and read set 1 If there is no conflict, a new branch is added to the above-mentioned preset DGA network structure, that is, the second
  • block 5 and its corresponding reading set 5 and writing set 5 can be obtained, and by comparing the reading set 5 with the above-mentioned reading set 2, reading set 1, reading set 3 and reading set 4, it is determined that the If the reading set 5 conflicts with the above-mentioned reading set 3 and reading set 4, the branch where one reading set is located can be selected as the target branch of the reading set 5. As shown in FIG. 2C, the third branch can be selected as the target branch, and join this third branch.
  • the second branch can be selected as the target branch of the block 5 and the third branch can be added.
  • the first branch, the second branch and the third branch can be verified in parallel, and within the branch, the verification can be performed serially.
  • block 1 can be verified first, and then Re-authenticate block 2; and because block 5 in the third branch also conflicts with block 3 in the second branch, that is, the transaction data in block 5 is associated with both block 3 and block 4 , therefore, when MVCC verification is performed, block 5 can be verified after verification of block 3 and block 4.
  • the data verification method described in the embodiment of the present application is applied to the server to obtain the read set and write set corresponding to the target block; to obtain a plurality of branches in the preset DAG network structure, each branch corresponds to at least one area block; according to the read set, verify whether the read set is related to the read set corresponding to at least one block in each branch; if there is no relationship between the read set and the read set corresponding to each block, execute the determination There is no conflict 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, the execution is performed to determine whether the target block is in multiple branches.
  • MVCC verification is completed for each block in the branches other than the target branch, and after each block in the target branch except the target block completes the MVCC verification, the MVCC verification is performed on the target block.
  • the blocks can be classified based on the above-mentioned preset DAG network structure, and the blocks corresponding to the associated transaction data are placed in the same branch, and the blocks corresponding to the unrelated transaction data are placed in different branches;
  • the branches can be verified in parallel, and the branches can be verified in series or in parallel, which is beneficial to improve the efficiency of data verification.
  • FIG. 3 is an exemplary flowchart of a data verification method disclosed in an embodiment of the present application, applied to a server, and the data verification method may include the following steps:
  • the read set determine 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 conflict, execute a new target branch to store the write set of the target block; when performing MVCC verification on the multiple branches, execute the target branch in parallel with the multiple branches Perform MVCC verification.
  • the transaction data corresponding to each target transaction is determined to obtain at least one transaction data.
  • the above-mentioned preset version number may be set by the user or defaulted by the system, which is not limited herein.
  • the preset version number can be set by the background staff, for example, it can be 100 or 200, etc. If the MVCC verification of a transaction is successful, it means that the transaction is valid, and the block corresponding to the transaction can be stored in the In the local chain, and the corresponding result data of successful verification can be stored in the database.
  • Each block may include at least one transaction.
  • a block may contain hundreds or thousands of transactions correspondingly.
  • the above-mentioned target block may include at least one target transaction.
  • each target transaction is used as a unit. Until the verification of each target transaction is completed, it can be determined that the MVCC verification of the target block is completed. .
  • the version number corresponding to the transaction data corresponding to each target transaction can be stored in the read set corresponding to the block in the database, and the transaction version number can be used to verify whether the transaction is valid, that is, whether the transaction is a normal transaction. If the data version number changes, it indicates that the transaction is invalid, that is to say, the transaction may have timed out or outdated, it can be determined that the transaction is invalid, and it is determined that the MVCC verification of the target block fails; If the version numbers are the same, it can be determined that the transaction is a normal transaction, and it can be determined that the MVCC verification of the target block is successful.
  • the server can delete the write set corresponding to the target block after the MVCC verification of the target block is completed, and write the operation into the database to prevent repeated MVCC verification.
  • the read set corresponding to the new block can be compared with the write set of the above target block to determine the two Whether there is a conflict between them, if there is a conflict, when MVCC verification is performed on the write set of the new block, the above relevant steps can be repeated to complete the MVCC verification of the new block.
  • the data verification method described in the embodiment of the present application is applied to the server to obtain the read set and write set corresponding to the target block; to obtain a plurality of branches in the preset DAG network structure, each branch corresponds to at least one area According to the read set, determine 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, execute a new target branch to A write set used to store the target block; when performing MVCC verification on multiple branches, perform MVCC verification on the target branch and multiple branches in parallel; if the target block and at least one of the first branches in the multiple branches are at least If there is a conflict between a block, select any one of the at least one first branch as the target branch, and add the target block to the target branch.
  • the transaction data corresponding to each target transaction is determined, and at least one transaction data is obtained; at least one second branch among the multiple branches that does not conflict with the target branch is determined; At least one second branch performs MVCC verification in parallel; when performing MVCC verification on at least one first branch, wait for each block in the at least one first branch other than the target branch to complete MVCC verification, and wait for the target branch After the MVCC verification is completed for each block except the target block, the transaction data corresponding to each target transaction is determined, and at least one transaction data is obtained; the data version number corresponding to each transaction data is obtained, and at least one transaction data is obtained.
  • the blocks can be classified based on the above-mentioned preset DAG network structure, and the blocks corresponding to the associated transaction data are placed in the same branch, and the blocks corresponding to the unrelated transaction data are placed in different branches; And in the subsequent high-concurrency verification of MVCC, the branches can be verified in parallel, and the branches can be verified in series or in parallel, which is beneficial to improve the efficiency of data verification. In addition, when the MVCC verification of the target block is completed, the write set corresponding to the target block can be deleted to avoid repeated verification.
  • FIG. 4 is a schematic structural diagram of a server provided by an embodiment of the present application. As shown in FIG. 4, it includes a processor, a communication interface, a memory, and one or more programs.
  • a processor, a communication interface, and a memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, the processor is configured to invoke the program instructions, and the one or more program programs include Instructions to perform the following steps:
  • the read set determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
  • the server described in the embodiment of the present application can obtain the read set and write set corresponding to the target block; obtain multiple branches in the preset DAG network structure, each branch corresponds to at least one block; Set, determine 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, execute a new target branch for storing the target The write set of the block; when MVCC verification is performed on multiple branches, MVCC verification is performed on the target branch and multiple branches in parallel; if the target block and at least one block of at least one first branch in the multiple branches are If there is a conflict between the two, select any one of the at least one first branch as the target branch, and add the target block to the target branch; when MVCC verification is performed on the at least one first branch, wait for at least one first branch.
  • Each block in the branch except the target branch completes the MVCC verification, and after waiting for each block in the target branch except the target block to complete the MVCC verification, then execute the MVCC verification on the target block .
  • the conflict between the target block and the multiple branches in the preset DAG network structure is compared; if there is no conflict between the target block and multiple blocks in the multiple branches, a new branch is added for Store the target block; when performing the MVCC verification, verify the target branch and multiple branches in parallel; if there is a conflict between the target block and the block of at least one first branch in the multiple branches, from at least one first branch One of the first branches is selected as the target branch; when MVCC verification is performed, it is possible to wait for at least one first branch to complete MVCC verification, and then perform MVCC verification on the target block.
  • the program is used to execute the instructions of the following steps:
  • the step of terminating the data verification of the target transaction A is performed, and the data verification step includes at least: the signature authentication or The MVCC verification.
  • the program is used to execute the instructions of the following steps:
  • the read set verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch;
  • the program is used to execute the instructions of the following steps:
  • each branch determining at least one second key-value pair included in each block in each branch, and each second key-value pair corresponds to a transaction in one block;
  • At least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute the determination that there is an association between the read set and the write set corresponding to at least one block; if any one of the first key-value pairs is equal If a key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
  • the program is used to execute the instructions of the following steps:
  • the program is configured to: Instructions to perform the following steps:
  • the MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
  • the program is also used to execute instructions for the following steps:
  • the server includes corresponding hardware structures and/or software modules for executing each function.
  • the present application can be implemented in hardware or in the form of a combination of hardware and computer software, in combination with the units and algorithm steps of each example described in the embodiments provided herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
  • the server may be divided into functional units according to the foregoing method examples.
  • each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and other division methods may be used in actual implementation.
  • FIG. 5 is a schematic structural diagram of a data verification device disclosed in an embodiment of the present application, applied to a server, and the device includes: an acquisition unit 501, a determination unit 502, and a verification unit 503, wherein,
  • the obtaining unit 501 is used to obtain the read set and the write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
  • the judging unit 502 is configured to judge whether there is a conflict between the target block and at least one block in each branch according to the read set; if the target block and at least one block in each branch If there is no conflict between the blocks, then execute a new target branch to store the write set of the target block; when performing MVCC verification on the multiple branches, execute the target branch and the write set.
  • the multiple branches perform MVCC verification in parallel;
  • the verification unit 503 is configured to select any one of the at least one first branch if there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches
  • the first branch is used as the target branch, and the target block is added to the target branch; when the MVCC verification is performed on the at least one first branch, waiting for the at least one first branch to be removed
  • the target block is subjected to MVCC verification.
  • the data verification device described in the embodiment of the present application is applied to the server, and can obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least A block; According to the read set, determine 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, execute a new target
  • the branch is used to store the write set of the target block; when MVCC verification is performed on multiple branches, MVCC verification is performed on the target branch and multiple branches in parallel; if the target block and at least one of the multiple branches are the first branch There is a conflict between at least one block of the at least one first branch, then select any first branch in the at least one first branch as the target branch, and add the target block to the target branch; when MVCC verification is performed on the at least one first branch , wait for each block in the at least one first branch except the target branch to complete the MV
  • the conflict between the target block and the multiple branches in the preset DAG network structure is compared; if there is no conflict between the target block and multiple blocks in the multiple branches, a new branch is added for Store the target block; when performing the MVCC verification, verify the target branch and multiple branches in parallel; if there is a conflict between the target block and the block of at least one first branch in the multiple branches, from at least one first branch One of the first branches is selected as the target branch; when MVCC verification is performed, it is possible to wait for at least one first branch to complete MVCC verification, and then perform MVCC verification on the target block. Therefore, it can ensure the smooth progress of MVCC verification at the same time. , by verifying the blocks in the branches in parallel and serially verifying the blocks in the branches, it is beneficial to improve the efficiency of data verification, and thus, it is beneficial to improve the performance of the blockchain network.
  • the judging unit 502 is specifically configured to:
  • the read set verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch;
  • the verification unit 503 is specifically configured to:
  • each branch determining at least one second key-value pair included in each block in each branch, and each second key-value pair corresponds to a transaction in one block;
  • At least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute the determination that there is an association between the read set and the write set corresponding to at least one block; if any one of the first key-value pairs is equal If a key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
  • the verification unit 503 is further configured to:
  • the verification unit 503 Specifically also used for:
  • the MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
  • Embodiments of the present application further provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute any data as described in the foregoing method embodiments Validate some or all of the steps of the method.
  • the storage medium involved in this application such as a computer-readable storage medium, may be non-volatile or volatile.
  • the embodiments of the present application further provide a computer program product
  • the computer program product includes a non-transitory computer-readable storage medium storing a computer program
  • the computer program is operable to cause a computer to execute the methods described in the foregoing method embodiments. Some or all of the steps of any data validation method.
  • the computer program product may be a software installation package.
  • the disclosed apparatus may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented in the form of hardware, and can also be implemented in the form of software program modules.
  • the integrated unit if implemented in the form of a software program module and sold or used as a stand-alone product, may be stored in a computer readable memory.
  • the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art, or all or part of the technical solution, and the computer software product is stored in a memory.
  • a computer device which may be a personal computer, a server, or a network device, etc.
  • the aforementioned memory includes: U disk, read-only memory (ROM), random access memory (random access memory, RAM), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

Landscapes

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

Abstract

A data verification method and apparatus, and a storage medium, which relate to the field of blockchain technology and are applied to a server. Said method comprises: performing collision comparison on a target block and a plurality of branches in a preset DAG network structure; if there is no collision between the target block and a plurality of blocks in the plurality of branches, adding a new branch for storing the target block; when performing MVCC verification, performing parallel verification on a target branch and the plurality of branches; if there is a collision between the target block and a block of at least one first branch of the plurality of branches, selecting one first branch from the at least one first branch as the target branch; and when performing MVCC verification, waiting for the completion of MVCC verification of the at least one first branch, and then performing MVCC verification on the target block. The method is beneficial for increasing the data verification efficiency.

Description

数据验证方法、装置及存储介质Data verification method, device and storage medium
本申请要求于2020年8月28日提交中国专利局、申请号为202010883730.6,发明名称为“数据验证方法、装置及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202010883730.6 and the invention titled "Data Verification Method, Device and Storage Medium", which was filed with the China Patent Office on August 28, 2020, the entire contents of which are incorporated herein by reference middle.
技术领域technical field
本申请涉及区块链技术领域,具体涉及一种数据验证方法、装置及存储介质。The present application relates to the field of blockchain technology, and in particular to a data verification method, device and storage medium.
背景技术Background technique
区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。发明人意识到,区块链中一个节点可向客户端提供背书服务,包括对交易ID的重复性检查,交易读写集的生成以及最终的签名等等服务;针对区块链中的每笔交易进行验证以及存储时,大致可包括身份认证、签名认证以及多版本并发控制验证等流程,其中,多版本并发控制(Multi-Version Concurrency Control,MVCC)验证可验证交易中的数据版本是否正确,目前,大多采用单线程对所有的交易逐个进行验证,导致区块链中数据验证效率差。Blockchain is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. The inventor realizes that a node in the blockchain can provide endorsement services to the client, including duplication checking of transaction IDs, generation of transaction read-write sets, and final signatures, etc.; for each transaction in the blockchain When a transaction is verified and stored, it can roughly include processes such as identity authentication, signature authentication, and multi-version concurrency control verification. Among them, Multi-Version Concurrency Control (MVCC) verification can verify whether the data version in the transaction is correct. At present, most of the transactions are verified one by one using a single thread, resulting in poor data verification efficiency in the blockchain.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种数据验证方法、装置及存储介质,有利于提高数据验证效率。The embodiments of the present application provide a data verification method, device, and storage medium, which are beneficial to improve data verification efficiency.
本申请实施例第一方面提供了一种数据验证方法,应用于服务器,包括:A first aspect of the embodiments of the present application provides a data verification method, applied to a server, including:
获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;Obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;According to the read set, determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one of the at least one first branch as the target branch , and add the target block to the target branch; when performing the MVCC verification on the at least one first branch, wait for the at least one first branch to be in other branches except the target branch. After each block of the target branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then perform MVCC verification on the target block. .
本申请实施例第二方面提供了一种数据验证装置,应用于服务器,所述装置包括:获取单元、判断单元和验证单元,其中,A second aspect of an embodiment of the present application provides a data verification apparatus, which is applied to a server, and the apparatus includes: an acquisition unit, a judgment unit, and a verification unit, wherein,
所述获取单元,用于获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;The obtaining unit is used to obtain the read set and the write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
所述判断单元,用于根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;The judging unit is configured to judge whether there is a conflict between the target block and at least one block in each branch according to the read set; if the target block and at least one area in each branch If there is no conflict between the blocks, then execute a new target branch for storing the write set of the target block; when MVCC verification is performed on the multiple branches, execute the target branch and all The multiple branches described above perform MVCC verification in parallel;
所述验证单元,用于若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。The verification unit is configured to select any one of the at least one first 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. A branch is used as the target branch, and the target block is added to the target branch; when the MVCC verification is performed on the at least one first branch, waiting for the at least one first branch to remove the Each block in the branches other than the target branch completes the MVCC verification, and after each block in the target branch except the target block completes the MVCC verification, execute the The target block is verified by MVCC.
本申请实施例的第三方面提供一种服务器,所述服务器包括处理器、通信接口、存储 器以及一个或多个程序,所述处理器、通信接口和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行以下方法:A third aspect of the embodiments of the present application provides a server, the server includes a processor, a communication interface, a memory, and one or more programs, the processor, the communication interface, and the memory are connected to each other, wherein the memory is used for A computer program is stored, the computer program includes program instructions, the processor is configured to invoke the program instructions to perform the following method:
获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;Obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;According to the read set, determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one of the at least one first branch as the target branch , and add the target block to the target branch; when performing the MVCC verification on the at least one first branch, wait for the at least one first branch to be in other branches except the target branch. After each block of the target branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then perform MVCC verification on the target block. .
本申请实施例的第四方面提供了一种计算机可读存储介质,其中,上述计算机可读存储介质存储用于电子数据交换的计算机程序,其中,上述计算机程序使得计算机执行以下方法: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 execute the following method:
获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;Obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;According to the read set, determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one of the at least one first branch as the target branch , and add the target block to the target branch; when performing the MVCC verification on the at least one first branch, wait for the at least one first branch to be in other branches except the target branch. After each block of the target branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then perform MVCC verification on the target block. .
实施本申请实施例,可在保证MVCC验证的顺利进行的同时,通过并行验证上述分支之间,串行验证分支内的区块,有利于提高数据验证效率,从而,有利于提高区块链网络的性能。Implementing the embodiments of the present application can ensure the smooth progress of MVCC verification, and simultaneously verify the blocks in the branches between the above branches in parallel, which is conducive to improving the efficiency of data verification, and thus, is conducive to improving the blockchain network. performance.
附图说明Description of drawings
图1A为本申请实施例提供了一种数据验证方法的流程示意图;1A provides a schematic flowchart of a data verification method according to an embodiment of the present application;
图1B为本申请实施例提供了一种有向无环图的网络结构图;FIG. 1B provides a network structure diagram of a directed acyclic graph according to an embodiment of the present application;
图2A为本申请实施例提供了一种数据验证方法的流程示意图;2A provides a schematic flowchart of a data verification method according to an embodiment of the present application;
图2B为本申请实施例提供了一种DAG图的网络结构图;FIG. 2B provides a network structure diagram of a DAG graph for an embodiment of the present application;
图2C为本申请实施例提供了一种DAG图的网络结构图;FIG. 2C provides a network structure diagram of a DAG graph for an embodiment of the present application;
图2D为本申请实施例提供了一种DAG图的网络结构图;FIG. 2D provides a network structure diagram of a DAG graph for an embodiment of the present application;
图3为本申请实施例提供了一种数据验证方法的流程示意图;3 provides a schematic flowchart of a data verification method according to an embodiment of the present application;
图4为本申请实施例提供了一种服务器的结构示意图;FIG. 4 provides a schematic structural diagram of a server according to an embodiment of the present application;
图5为本申请实施例提供了一种数据验证装置的结构示意图。FIG. 5 provides a schematic structural diagram of a data verification apparatus according to an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings in the embodiments of the present application.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其他步骤或单元。The terms "first", "second" and the like in the description and claims of the present application and the above drawings are used to distinguish different objects, rather than to describe a specific order. Furthermore, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes unlisted steps or units, or optionally also includes For other steps or units inherent to these processes, methods, products or devices.
在本申请中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本申请所描述的实施例可以与其它实施例相结合。Reference in this application to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor a separate or alternative embodiment that is mutually exclusive of other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application 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 introduced below.
本申请实施例中提到的服务器可以包括但不限于后台服务器、组件服务器、云端服务器、数据验证系统服务器或数据验证软件服务器等,上述仅是举例,而非穷举,包含但不限于上述装置。The servers mentioned in the embodiments of this application may include but are not limited to background servers, component servers, cloud servers, data verification system servers or data verification software servers, etc. The above are only examples, not exhaustive, including but not limited to the above devices .
请参见图1A,图1A是本申请实施例提供的一种数据验证方法的流程示意图,应用于服务器,上述方法包括以下步骤:Please refer to FIG. 1A. FIG. 1A is a schematic flowchart of a data verification method provided by an embodiment of the present application, applied to a server, and the above method includes the following steps:
101、获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块。101. Obtain a read set and a write set corresponding to the target block; obtain a plurality of branches in a preset DAG network structure, and each branch corresponds to at least one block.
其中,本申请实施例应用于服务器,该服务器可包括区块链网络,区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层。The embodiments of the present application are applied to a server, which may include a blockchain network, and the blockchain is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
其中,本申请实施例具体可应用于FiMax区块链平台中,该FiMax区块链平台是一种以S3C为基础框架组成的区块链网络,该S3C是由区块链解决方案模块、区块链内核模块、区块链隐私保护模块和区块链网络管理模块组成的框架系统。Among them, the embodiments of the present application can be specifically applied to the FiMax blockchain platform. The FiMax blockchain platform is a blockchain network composed of S3C as the basic framework. The S3C is composed of blockchain solution modules, districts A framework system composed of blockchain kernel module, blockchain privacy protection module and blockchain network management module.
其中,在本申请实施例中,上述预设DAG(Directed acyclic graph,有向无环图)网络结构可为用户自行设置或者系统默认,在此不作限定。Wherein, in the embodiment of the present application, the above-mentioned preset DAG (Directed acyclic graph, directed acyclic graph) network structure can be set by the user or the system defaults, which is not limited herein.
其中,上述预设DAG网络结构是一种有向无环图,如图1B所示,为一种有向无环图的网络结构图,在本申请实施例中,该有向无环图仅为一种可能的排列组合方式,在此不作限定;其中,每一数字可对应代表一个区块,该有向无环图中可包括多条(两条或两条以上)分支,每一分支中可包括至少一个区块,该预设DAG网络结构用于存储多个区块对应的写集和读集。通过上述预设DAG网络结构存储上述多个区块,对上述多个区块进程分类,有利于在后续对上述多个区块进行MVCC验证时,可根据多个分支并行MVCC验证,有利于提高验证效率,同时,也有利于提高上述区块链的性能。The above-mentioned preset DAG network structure is a directed acyclic graph, as shown in FIG. 1B , which is a network structure diagram of a directed acyclic graph. In this embodiment of the present application, the directed acyclic graph is only is a possible arrangement and combination, which is not limited here; wherein, each number can correspond to a block, and the directed acyclic graph can include multiple (two or more) branches, each branch can include at least one block, and the preset DAG network structure is used to store write sets and read sets corresponding to multiple blocks. The above-mentioned preset DAG network structure is used to store the above-mentioned multiple blocks, and to classify the above-mentioned multiple block processes, which is conducive to the subsequent MVCC verification of the above-mentioned multiple blocks, and the parallel MVCC verification can be performed according to multiple branches, which is beneficial to improve the The verification efficiency, at the same time, is also conducive to improving the performance of the above-mentioned blockchain.
其中,上述目标区块或者区块可指区块链网络中的一个数据组织单元,可由链表来将区块进行串联,每一区块中由有至少一个交易打包而成,交易是存储在区块链网络中的实际数据,该区块可记录确认某些交易是在何时以及何种顺序成为区块链中的一部分。Among them, the above-mentioned target block or block may refer to a data organization unit in the blockchain network. The blocks can be connected in series by a linked list. Each block is packaged by at least one transaction, and the transaction is stored in the block. Actual data in a blockchain network that records and confirms when and in what order certain transactions became part of the blockchain.
其中,上述目标区块中可存储或者打包有至少一个交易,每一交易可对应一组交易数据,该交易数据可包括以下至少一项:版本号、区块ID、数据键值对、证书信息、签名信息、公钥等等,在此不作限定;其中,上述至少一个交易之间可相关或不相关,在此不作限定。Wherein, at least one transaction can be stored or packaged in the above-mentioned target block, each transaction can correspond to a set of transaction data, and the transaction data can include at least one of the following: version number, block ID, data key-value pair, certificate information , signature information, public key, etc., which are not limited here; wherein, the at least one transaction may be related or unrelated, which is not limited here.
可选地,在所述获取目标区块对应的读集和写集之后,还可包括如下步骤:获取所述目标区块中对应的至少一个目标交易;对每一目标交易分别进行身份认证和签名认证;若 所述至少一个目标交易中任意一个目标交易A身份认证失败和/或签名认证失败,则执行终止对所述目标交易A的数据验证步骤,所述数据验证步骤至少包括:所述签名认证或者所述MVCC验证。Optionally, after obtaining the read set and write set corresponding to the target block, the following steps may be further included: obtaining at least one target transaction corresponding to the target block; Signature authentication; if any target transaction A in the at least one target transaction fails identity authentication and/or signature authentication fails, execute the step of terminating the data verification of the target transaction A, and the data verification step at least includes: the Signature authentication or the MVCC verification.
其中,上述每一目标交易中可包括交易数据,该交易数据可包括以下至少一种:版本号、区块ID、数据键值对、证书信息、签名信息、公钥和私钥等等,在此不做限定。Wherein, each of the above target transactions 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 key and private key, etc. This is not limited.
其中,上述身份(Verify Authority Chain Code,VACC)认证,即通过目标区块中交易数据中对应的证书信息验证这笔交易的发起者是否有权限发起此笔交易。Among them, the above-mentioned identity verification (Verify Authority Chain Code, VACC) is to verify whether the initiator of the transaction has the authority to initiate the transaction through the corresponding certificate information in the transaction data in the target block.
其中,上述签名(Verify Signature Chain Code,VSCC)认证,即验证此交易的执行者数量是否满足需求以及验证交易数据中包括的交易执行者的签名是否正确。Among them, the above signature (Verify Signature Chain Code, VSCC) certification is to verify whether the number of executors of this transaction meets the requirements and whether the signature of the transaction executor included in the transaction data is correct.
其中,上述多版本并发控制(Multi-Version Concurrency Control,MVCC)验证是一种并发控制的方法,用于验证上述区块中包括的交易数据的数据版本是否正确;即校验区块中交易的读集是否和当前数据库账本中的版本一致(即没有变化),如果没有改变,说明交易写集中对数据的修改有效,把该交易标注为有效,交易的写集更新到具体的数据库(如状态数据库)中。Among them, the above-mentioned multi-version concurrency control (Multi-Version Concurrency Control, MVCC) verification is a method of concurrency control, which is used to verify whether the data version of the transaction data included in the above-mentioned block is correct; Whether the read set is consistent with the version in the current database ledger (that is, there is no change), if there is no change, it means that the modification of the data in the transaction write set is valid, mark the transaction as valid, and the write set of the transaction is updated to the specific database (such as the status database).
其中,一般的,可对每笔交易分别进行身份认证、签名认证和MVCC验证等,以验证交易数据是否正确以及发起交易者是否有权限等等,进而,可将验证以后的数据存储到对应的数据库中,从而保证交易数据的安全性。Among them, in general, identity authentication, signature authentication, and MVCC verification can be performed on each transaction to verify whether the transaction data is correct and whether the initiating transaction has authority, etc., and then, the verified data can be stored in the corresponding database to ensure the security of transaction data.
具体实现中,可对上述任意一个目标交易中包含的交易数据分别进行上述验证,若上述签名认证或者身份认证或者MVCC验证中任意一种认证失败,则终止后续认证。In a specific implementation, the above verification may be performed on the transaction data contained in any one of the above target transactions, and if any one of the above signature verification, identity verification, or MVCC verification fails, the subsequent verification is terminated.
102、根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证。102. According to the read set, determine 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 conflict, execute a new target branch to store the write set of the target block; when performing MVCC verification on the multiple branches, execute the target branch in parallel with the multiple branches Perform MVCC verification.
其中,由于在进行MVCC验证时,主要验证区块中包含的交易数据的数据版本号是否正确,而区块相关信息都是存储于数据库中的,因此,在具体的验证过程中,服务器主要从数据库中获取区块,并主要验证该区块中包含的交易的读集的版本,但是,当需要验证的区块较多时,若一个一个从数据库中获取区块,并单线程实现MVCC验证,效率不高,为了克服上述缺陷,可将获取到的多个区块置于不同的分支中,得到多个分支,并直接对上述多个分支并行进行MVCC验证。Among them, during the MVCC verification, the main verification is whether the data version number of the transaction data contained in the block is correct, and the block related information is stored in the database. Therefore, in the specific verification process, the server mainly from the The block is obtained from the database, and the version of the read set of the transaction contained in the block is mainly verified. However, when there are many blocks to be verified, if the blocks are obtained from the database one by one, and the MVCC verification is implemented in a single thread, The efficiency is not high. In order to overcome the above-mentioned defects, the acquired blocks can be placed in different branches to obtain multiple branches, and the MVCC verification can be directly performed on the above-mentioned multiple branches in parallel.
其中,在本申请实施例中,仅以服务器从数据库中获取的任意一个区块,即目标区块为例,进行数据验证方法的说明。Wherein, in the embodiment of the present application, only any block acquired by the server from the database, that is, the target block, is taken as an example to describe the data verification method.
其中,由于在获取上述目标区块以后,该目标区块中的交易数据可能与数据库中其他存储的区块中的交易数据相关联,例如,该目标区块中的一笔交易数据在进行MVCC验证时,可能需要使用上述区块中的交易数据作为参考数据等情况;如此,在进行MVCC验证时,与该目标区块相关联的区块可能会对其的MVCC验证的过程产生冲突或者影响;因此,可在进行MVCC验证之前,对该目标区块与其余多个区块进行冲突判断。Among them, after obtaining the above target block, the transaction data in the target block may be related to the transaction data in other blocks stored in the database. For example, a transaction data in the target block is being processed by MVCC When verifying, it may be necessary to use the transaction data in the above blocks as reference data; in this way, when MVCC verification is performed, the block associated with the target block may conflict or affect its MVCC verification process. ; Therefore, before the MVCC verification is performed, the conflict judgment between the target block and the other blocks can be performed.
具体实现中,可将该目标区块的读集与数据库中已经存储的区块对应的写集进行比较,以或者可从数据库中获取已经存储的区块信息,若该目标区块与上述每一分支中每一区块之间均不存在冲突,则表明该目标区块与上述预设DAG网络结构的多个分支中每一区块之间不存在数据关联性,进而,可新增一个目标分支,以用来存储该目标区块的写集,由于所有分支的区块之间均不存在数据关联,因此,在后续的MVCC验证时,可对上述多个分支以及该目标分支并行进行MVCC验证,如此,有利于提高验证效率。In the specific implementation, the read set of the target block can be compared with the write set corresponding to the block that has been stored in the database, or the stored block information can be obtained from the database, if the target block and each of the above-mentioned blocks can be compared. There is no conflict between each block in a branch, indicating that there is no data correlation between the target block and each block in the multiple branches of the above-mentioned preset DAG network structure, and further, a new one can be added. The target branch is used to store the write set of the target block. Since there is no data association between the blocks of all branches, in the subsequent MVCC verification, the above-mentioned multiple branches and the target branch can be processed in parallel MVCC verification, in this way, is beneficial to improve verification efficiency.
在一种可能的示例中,所述根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突,可包括如下步骤:根据所述读集,验证所述读集与所述每一分支 中的至少一个区块对应的写集之间是否有关联;若所述读集与所述每一区块对应的写集之间均无关联,则执行确定所述目标区块与所述每一分支中至少一个区块之间不存在冲突;若存在所述读集与至少一个分支中至少一个区块的写集之间有关联,则执行确定所述目标区块与所述多个分支中至少一个分支之间存在冲突。In a possible example, judging whether there is a conflict between the target block and at least one block in each branch according to the read set may include the following steps: verifying all the blocks according to the read set Whether there is an association between the read set and the write set corresponding to at least one block in the each branch; if there is no association between the read set and the write set corresponding to each block, execute the determination There is no conflict between the target block and at least one block in each branch; if there is an association between the read set and the write set of at least one block in at least one branch, execute determining the There is a conflict between the target block and at least one of the plurality of branches.
在一个可能的示例中,所述验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联,可包括如下步骤:确定所述目标区块对应的读集中至少一个第一键值对,每一第一键值对应一笔所述目标交易;确定所述每一分支中每一区块包括的至少一个第二键值对,每一第二键值对对应一个区块中的一个交易;若出现至少一个所述第一键值对与至少一个所述第二键值对相等的情况,则执行确定所述读集与至少一个区块对应的写集之间有关联;若任意一个第一键值对与任意一个第二键值对均不相等,则执行确定所述读集与每一区块对应的写集之间无关联。In a possible example, the verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch may include the following steps: determining the read set corresponding to the target block Collect at least one first key-value pair, each first key value corresponds to a target transaction; determine at least one second key-value pair included in each block in each branch, each second key value The pair corresponds to a transaction in a block; if at least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute a write that determines that the read set corresponds to at least one block There is an association between sets; if any first key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
其中,上述键值对是一个key和value的映射集,上述键值对也可为哈希值,具体的在此不做限定。The above-mentioned key-value pair is a mapping set of key and value, and the above-mentioned key-value pair may also be a hash value, which is not specifically limited herein.
其中,上述键值对都可带有数据版本号,该键值对的版本可记录在读集中;该键值对的最新值可存储在写集中,在区块链网络的数据库可记录账本中所有键值对的当前值,相当于对当前账本的交易日志做了索引,每当交易发生变化时,其对应的键值对也会相应的更新,并且其对应的数据库中的数据也会发生更新;因此,服务器可通过比较目标区块中的读集中第一键值对与多个分支中每一区块的写集中存储的第二键值对的最新值来实现对区块之间是否存在冲突的判断。Among them, the above key-value pairs can have data version numbers, and the version of the key-value pair can be recorded in the read set; the latest value of the key-value pair can be stored in the write set, and the database of the blockchain network can record all the records in the ledger The current value of the key-value pair is equivalent to indexing the transaction log of the current ledger. Whenever the transaction changes, the corresponding key-value pair will also be updated accordingly, and the data in the corresponding database will also be updated. Therefore, the server can realize whether there is a pair of 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 of each block in the multiple branches conflicting judgments.
具体实现中,可从数据库中读取目标区块的读集,该读集中包括至少一个目标交易,每一目标交易可对应一个第一键值对,同样的,可获取预设DAG网络结构中的多个分支,并获取每一分支中每一区块对应的第二键值对,若目标区块中某一目标交易数据与上述多个区块中任意一个区块对应的交易数据之间有关联,那么,这两个交易对应的键值对都会进行更新,并且两个键值对是相等的,因此,若出现任意一个第一键值对与至少一个第二键值对相等,则表明目标区块与至少一个第二键值对对应的区块之间的交易数据之间有关联;反之,若不存在任意一个第一键值对与第二键值对相等的情况,则表明目标区块与上述多个区块之间没有关联。In the specific implementation, the read set of the target block can be read from the database. The read set includes at least one target transaction, and each target transaction can correspond to a first key-value pair. Similarly, the preset DAG network structure can be obtained. and obtain the second key-value pair corresponding to each block in each branch, if there is a difference between a certain target transaction data in the target block and the transaction data corresponding to any one of the above-mentioned blocks If there is an association, then the key-value pairs corresponding to the two transactions will be updated, and the two key-value pairs are equal. Therefore, if any first key-value pair is equal to at least one second key-value pair, then Indicates that the transaction data between the target block and the block corresponding to at least one second key-value pair is related; on the contrary, if there is no situation where any first key-value pair is equal to the second key-value pair, it indicates that There is no relationship between the target block and the above-mentioned multiple blocks.
103、若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。103. If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one first branch in the at least one first branch as the target branch, and add the target block to the target branch; when the MVCC verification is performed on the at least one first branch, wait for the at least one first branch other than the target branch Each block in the branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then executes the target block. MVCC verification.
其中,若上述目标区块与上述多个分支中任意一个第一分支之间存在冲突,则表明该目标区块与上述产生冲突的第一分支中的区块有相关交易数据,那么在后续进行MVCC验证时,可对该目标区块对应的目标分支与相冲突的第一分支之间串行验证,反之,若无冲突,则可将该目标区块对应的目标分支与上述多个分支并行验证。Wherein, if there is a conflict between the above-mentioned target block and any one of the first branches of the above-mentioned multiple branches, it indicates that the target block has relevant transaction data with the block in the above-mentioned first branch in which the conflict occurs, then follow-up During MVCC verification, the target branch corresponding to the target block and the conflicting first branch can be serially verified, otherwise, if there is no conflict, the target branch corresponding to the target block can be paralleled with the above-mentioned multiple branches verify.
进一步地,以目标分支中的目标区块为例,若目标区块与多个分支中至少一个第一分支的至少一个区块之间存在冲突,则选取至少一个第一分支中的任意一个第一分支作为目标分支;那么,在后续对上述至少一个第一分支(包含目标分支)进行MVCC验证时,由于该目标分支与其余至少一个第一分支均发生冲突,可等待其余至少一个第一分支验证完成以后,以及该目标分支中其余所有区块验证完成以后,对该目标区块进行MVCC验证。Further, taking the 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, then select any one of the at least one first branch. One branch is used as the target branch; then, when the MVCC verification is performed on the at least one first branch (including the target branch), since the target branch conflicts with the remaining at least one first branch, the remaining at least one first branch can be waited for. After the verification is completed, and after the verification of all remaining blocks in the target branch is completed, the MVCC verification is performed on the target block.
可选地,若上述除目标分支以外的至少一个第一分支之间是不存在冲突的,可在MVCC的验证过程中,对上述至少一个第一分支进行并行验证,并在所有第一分支中每一区块验 证完成以后,再对上述目标分支中的目标区块进行验证;同样地,针对目标分支来说,若目标分支中其余区块之间不存在冲突,则可对目标分支中不存在冲突的多个区块进行并行MVCC验证,并在不存在冲突的多个区块验证完成以后,再对该目标区块进行MVCC验证。Optionally, if there is no conflict between the at least one first branch except the target branch, in the verification process of the MVCC, the at least one first branch can be verified in parallel, and all the first branches can be verified in parallel. After the verification of each block is completed, the target block in the above target branch is verified; similarly, for the target branch, if there is no conflict between the remaining blocks in the target branch, the target branch can be verified. Parallel MVCC verification is performed on multiple blocks with conflicts, and MVCC verification is performed on the target block after the verification of multiple blocks without conflicts is completed.
可见,采用本申请实施例,可通过预设DAG网络结构实现对多个区块的分类,分支与分支之间对应的区块之间是不冲突的,而分支内的区块之间可能是存在冲突的;进而,在进行MVCC验证时,可将分支与分支之间并行进行MVCC验证,而分支内可串行进行MVCC验证,It can be seen that, by adopting the embodiment of the present application, the classification of multiple blocks can be realized by presetting the DAG network structure, and the blocks corresponding to the branches do not conflict, while the blocks in the branches may be different from each other. There is a conflict; further, when MVCC verification is performed, MVCC verification can be performed in parallel between branches, and MVCC verification can be performed in series within the branch.
可以看出,本申请实施例中所描述的数据验证方法,应用于服务器,可获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;根据读集,判断目标区块与每一分支中至少一个区块是否存在冲突;若目标区块与每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储目标区块的写集;在对多个分支进行MVCC验证时,则执行对目标分支与多个分支并行进行MVCC验证;若目标区块与多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取至少一个第一分支中的任意一个第一分支作为目标分支,并将目标区块加入目标分支中;在对至少一个第一分支进行MVCC验证时,等待至少一个第一分支中除目标分支以外的其他分支中的每一区块完成MVCC验证,并等待目标分支中的除目标区块之外的每一区块完成MVCC验证以后,则执行对目标区块进行MVCC验证。如此,将目标区块和预设DAG网络结构中的多个分支进行冲突比较;若该目标区块与多个分支中的多个区块之间不存在冲突,则新增一个分支,用于存储该目标区块;在进行MVCC验证时,将目标分支与多个分支并行验证;若目标区块与多个分支中至少一个第一分支的区块之间存在冲突,则从至少一个第一分支中选取一个第一分支为目标分支;在进行MVCC验证时,可等待至少一个第一分支完成MVCC验证,则对该目标区块进行MVCC验证,因此,可在保证MVCC验证的顺利进行的同时,通过并行验证上述分支之间,串行验证分支内的区块,有利于提高数据验证效率,从而,有利于提高区块链网络的性能。It can be seen that the data verification method described in the embodiment of the present application is applied to the server, and the read set and write set corresponding to the target block can be obtained; a plurality of branches in the preset DAG network structure can be obtained, and each branch corresponds to at least A block; according to the read set, determine 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, execute a new target The branch is used to store the write set of the target block; when MVCC verification is performed on multiple branches, MVCC verification is performed on the target branch and multiple branches in parallel; if the target block and at least one of the multiple branches are the first branch There is a conflict between at least one block of the at least one first branch, then select any first branch in the at least one first branch as the target branch, and add the target block to the target branch; when MVCC verification is performed on the at least one first branch , wait for each block in the at least one first branch except the target branch to complete the MVCC verification, and wait for each block in the target branch except the target block to complete the MVCC verification, then execute the The target block undergoes MVCC verification. In this way, the conflict between the target block and the multiple branches in the preset DAG network structure is compared; if there is no conflict between the target block and multiple blocks in the multiple branches, a new branch is added for Store the target block; when performing the MVCC verification, verify the target branch and multiple branches in parallel; if there is a conflict between the target block and the block of at least one first branch in the multiple branches, from at least one first branch One of the first branches is selected as the target branch; when MVCC verification is performed, it is possible to wait for at least one first branch to complete MVCC verification, and then perform MVCC verification on the target block. Therefore, it can ensure the smooth progress of MVCC verification at the same time. , by verifying the blocks in the branches in parallel and serially verifying the blocks in the branches, it is beneficial to improve the efficiency of data verification, and thus, it is beneficial to improve the performance of the blockchain network.
与上述一致地,请参阅图2A,图2A是本申请实施例公开的一种数据验证方法的流程示例图,应用于服务器,该数据验证方法可包括如下步骤:Consistent with the above, please refer to FIG. 2A. FIG. 2A is an exemplary flowchart of a data verification method disclosed in an embodiment of the present application, applied to a server, and the data verification method may include the following steps:
201、获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块。201. Obtain a read set and a write set corresponding to the target block; obtain a plurality of branches in a preset DAG network structure, and each branch corresponds to at least one block.
202、根据所述读集,验证所述读集与所述每一分支中的至少一个区块对应的读集之间是否有关联。202. According to the read set, verify whether the read set is associated with a read set corresponding to at least one block in each branch.
203、若所述读集与所述每一区块对应的读集之间均无关联,则执行确定所述目标区块与所述每一分支中至少一个区块之间不存在冲突。203. If there is no correlation between the read set and the read set corresponding to each block, perform determining that there is no conflict between the target block and at least one block in each branch.
204、若存在所述读集与至少一个分支中至少一个区块的读集之间有关联,则执行确定所述目标区块与所述多个分支中至少一个分支之间存在冲突。204. If there is an association between the read set and the read set of at least one block in at least one branch, perform determining that there is a conflict between the target block and at least one branch of the plurality of branches.
205、若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中。205. If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one of the at least one first branch as the target branch, and add the target block to the target branch.
206、若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证。206. If there is no conflict between the target block and at least one block in each branch, execute a new target branch for storing the write set of the target block; When the MVCC verification is performed on the multiple branches, the MVCC verification is performed on the target branch and the multiple branches in parallel.
其中,上述步骤201-206的具体描述可以参照图1B所述的数据验证方法的相应描述,在此不再赘述。For the specific description of the above steps 201-206, reference may be made to the corresponding description of the data verification method shown in FIG. 1B , which will not be repeated here.
207、确定所述多个分支中与所述目标分支不冲突的至少一个第二分支。207. Determine at least one second branch among the multiple branches that does not conflict with the target branch.
其中,上述第二分支与上述目标分支不冲突可指,上述每一第二分支中对应的任意一 个区块对应的交易数据均与上述目标区块对应的目标交易数据不相关。Wherein, that the above-mentioned second branch does not conflict with the above-mentioned target branch may mean that the transaction data corresponding to any block corresponding to each of the above-mentioned second branches is irrelevant to the target transaction data corresponding to the above-mentioned target block.
208、将所述至少一个第一分支与所述至少一个第二分支并行进行所述MVCC验证。208. Perform the MVCC verification on the at least one first branch and the at least one second branch in parallel.
其中,由于上述每一第二分支与上述第一分支以及目标分支均不冲突,因此,在进行MVCC验证时,可将上述至少一个第二分支、至少一个第一分支以及目标分支进行并行验证,以提高数据验证效率。Wherein, since each of the above-mentioned second branches does not conflict with the above-mentioned first branch and the target branch, when the MVCC verification is performed, the above-mentioned at least one second branch, at least one first branch and the target branch can be verified in parallel, to improve data validation efficiency.
此外,在分支内部,由于分支内部的区块可能是存在冲突的,因此,可将存在冲突的区块进行串行验证,不存在冲突的区块进行并行验证。In addition, within the branch, since the blocks within the branch may conflict, the conflicting blocks can be verified serially, and the non-conflicting blocks can be verified in parallel.
209、在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。209. When performing the MVCC verification on the at least one first branch, wait for each block in the at least one first branch other than the target branch to complete the MVCC verification, and wait for After each block in the target branch except the target block completes the MVCC verification, the MVCC verification is performed on the target block.
其中,上述步骤209的具体描述可以参照图1B所述的数据验证方法的相应描述,在此不再赘述。The specific description of the above-mentioned step 209 may refer to the corresponding description of the data verification method shown in FIG. 1B , which is not repeated here.
举例来说,如图2B所示,为一种DAG图的网络结构图,每一数字可对应一个区块,首先,在做MVCC验证之前,服务器可获取区块1,并读取区块1对应的读集以及写集,可基于该区块1建立一条分支,为第一分支,该第一分支中可存储区块1的读集1以及写集1;接着,可获取区块2,以及该区块2对应的读集2和写集2,通过判断读集2与读集1之间存在冲突,则将该区块2对应的读集2和写集2对应存储到第一分支中;获取区块3,以及该区块3对应的读集3以及写集3,通过比较读集3与读集2以及读集1,确定该读集3与上述读集2和读集1均不存在冲突,则在上述预设DGA网络结构中新增一条分支,即第二分支,用于存储区块3对应的读集3与写集4;同样的,可获取区块4以及该区块4对应的读集4和写集4,比较读集4与上述读集1、读集2、读集3均不冲突,则新增第三分支,用于存储区块4的写集4以及读集4。For example, as shown in Figure 2B, which is a network structure diagram of a DAG graph, each number can correspond to a block. First, before doing MVCC verification, the server can obtain block 1 and read block 1 For the corresponding read set and write set, a branch can be established based on the block 1, which is the first branch, and the read set 1 and the write set 1 of the block 1 can be stored in the first branch; then, the block 2 can be obtained, And the read set 2 and the write set 2 corresponding to the block 2, by judging that there is a conflict between the read set 2 and the read set 1, the read set 2 and the write set 2 corresponding to the block 2 are stored in the first branch correspondingly In; obtain block 3, and the corresponding read set 3 and write set 3 of this block 3, by comparing read set 3 and read set 2 and read set 1, determine this read set 3 and above-mentioned read set 2 and read set 1 If there is no conflict, a new branch is added to the above-mentioned preset DGA network structure, that is, the second branch, which is used to store the read set 3 and write set 4 corresponding to block 3; similarly, block 4 and the For the read set 4 and write set 4 corresponding to block 4, if the read set 4 does not conflict with the above-mentioned read set 1, read set 2, and read set 3, a third branch is added to store the write set of block 4 4 and read episode 4.
再进一步地,此时,可获取区块5以及其对应的读集5和写集5,通过比较读集5分别与上述读集2、读集1、读集3和读集4,确定该读集5与上述读集3以及读集4均发生冲突,则可任选一个读集所在的分支作为该读集5的目标分支,如图2C所示,可选取第三分支为目标分支,并加入该第三分支。Still further, at this time, block 5 and its corresponding reading set 5 and writing set 5 can be obtained, and by comparing the reading set 5 with the above-mentioned reading set 2, reading set 1, reading set 3 and reading set 4, it is determined that the If the reading set 5 conflicts with the above-mentioned reading set 3 and reading set 4, the branch where one reading set is located can be selected as the target branch of the reading set 5. As shown in FIG. 2C, the third branch can be selected as the target branch, and join this third branch.
此外,如图2D所示,若此时将上述区块5加入第二分支,则可选取第二分支为该区块5的目标分支,并加入该第三分支。In addition, as shown in FIG. 2D , if the above-mentioned block 5 is added to the second branch at this time, the second branch can be selected as the target branch of the block 5 and the third branch can be added.
进而,在后续进行MVCC验证时,可并行验证第一分支和第二分支以及第三分支,在分支内部,可串行验证,例如,对于第一分支来说,可先验证区块1,然后再认证区块2;又由于第三分支中的区块5也与第二分支中的区块3冲突,也就是说,区块5中的交易数据与区块3和区块4均有关联,因此,在进行MVCC验证时,可在验证完区块3和区块4以后,再验证区块5。Furthermore, in the subsequent MVCC verification, the first branch, the second branch and the third branch can be verified in parallel, and within the branch, the verification can be performed serially. For example, for the first branch, block 1 can be verified first, and then Re-authenticate block 2; and because block 5 in the third branch also conflicts with block 3 in the second branch, that is, the transaction data in block 5 is associated with both block 3 and block 4 , therefore, when MVCC verification is performed, block 5 can be verified after verification of block 3 and block 4.
可以看出,本申请实施例所描述的数据验证方法,应用于服务器,获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;根据读集,验证读集与每一分支中的至少一个区块对应的读集之间是否有关联;若读集与每一区块对应的读集之间均无关联,则执行确定目标区块与每一分支中至少一个区块之间不存在冲突;若存在读集与至少一个分支中至少一个区块的读集之间有关联,则执行确定目标区块与多个分支中至少一个分支之间存在冲突;若目标区块与多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取至少一个第一分支中的任意一个第一分支作为目标分支,并将目标区块加入目标分支中。确定多个分支中与目标分支不冲突的至少一个第二分支;若目标区块与每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储目标区块的写集;在对多个分支进行MVCC验证时,则执行对目标分支 与多个分支并行进行MVCC验证;在对至少一个第一分支进行MVCC验证时,等待至少一个第一分支中除目标分支以外的其他分支中的每一区块完成MVCC验证,并等待目标分支中的除目标区块之外的每一区块完成MVCC验证以后,则执行对目标区块进行MVCC验证。如此,可基于上述预设DAG网络结构,对区块进行分类,将相关联的交易数据对应的区块放置于同一分支中,将不相关联的交易数据对应的区块放置于不同分支中;并在后续进行MVCC高并发验证时,可将分支与分支之间并行验证,而分支内可串行或并行验证,有利于提高数据验证效率。It can be seen that the data verification method described in the embodiment of the present application is applied to the server to obtain the read set and write set corresponding to the target block; to obtain a plurality of branches in the preset DAG network structure, each branch corresponds to at least one area block; according to the read set, verify whether the read set is related to the read set corresponding to at least one block in each branch; if there is no relationship between the read set and the read set corresponding to each block, execute the determination There is no conflict 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, the execution is performed to determine whether the target block is in multiple branches. There is a conflict between at least one branch; if there is a conflict between the target block and at least one block of at least one first branch in the multiple branches, then execute the selection of any first branch in the at least one first branch as the target branch , and add the target block to the target branch. Determine at least one second branch in 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, execute a new target branch for storing the target block When performing MVCC verification on multiple branches, perform MVCC verification on the target branch and multiple branches in parallel; when performing MVCC verification on at least one first branch, wait for the target branch to be removed from at least one first branch. MVCC verification is completed for each block in the branches other than the target branch, and after each block in the target branch except the target block completes the MVCC verification, the MVCC verification is performed on the target block. In this way, the blocks can be classified based on the above-mentioned preset DAG network structure, and the blocks corresponding to the associated transaction data are placed in the same branch, and the blocks corresponding to the unrelated transaction data are placed in different branches; And in the subsequent high-concurrency verification of MVCC, the branches can be verified in parallel, and the branches can be verified in series or in parallel, which is beneficial to improve the efficiency of data verification.
与上述一致地,请参阅图3,图3是本申请实施例公开的一种数据验证方法的流程示例图,应用于服务器,该数据验证方法可包括如下步骤:Consistent with the above, please refer to FIG. 3 . FIG. 3 is an exemplary flowchart of a data verification method disclosed in an embodiment of the present application, applied to a server, and the data verification method may include the following steps:
301、获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块。301. Obtain a read set and a write set corresponding to the target block; obtain a plurality of branches in a preset DAG network structure, and each branch corresponds to at least one block.
302、根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证。302. According to the read set, determine 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 conflict, execute a new target branch to store the write set of the target block; when performing MVCC verification on the multiple branches, execute the target branch in parallel with the multiple branches Perform MVCC verification.
303、若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中。303. If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one first branch in the at least one first branch as the target branch, and add the target block to the target branch.
其中,上述步骤301-303的具体描述可以参照图1B所述的数据验证方法的相应描述,在此不再赘述。For the specific description of the above steps 301-303, reference may be made to the corresponding description of the data verification method shown in FIG. 1B , which will not be repeated here.
304、确定所述多个分支中与所述目标分支不冲突的至少一个第二分支。304. Determine at least one second branch among the multiple branches that does not conflict with the target branch.
305、将所述至少一个第一分支与所述至少一个第二分支并行进行所述MVCC验证。305. Perform the MVCC verification on the at least one first branch and the at least one second branch in parallel.
其中,上述步骤304-305的具体描述可以参照图2A所述的数据验证方法的相应描述,在此不再赘述。For the specific description of the above steps 304-305, reference may be made to the corresponding description of the data verification method shown in FIG. 2A, which is not repeated here.
306、在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行确定每一所述目标交易对应的交易数据,得到至少一个交易数据。306. When performing the MVCC verification on the at least one first branch, wait for each block in the at least one first branch other than the target branch to complete the MVCC verification, and wait for After each block in the target branch other than the target block completes the MVCC verification, the transaction data corresponding to each target transaction is determined to obtain at least one transaction data.
307、获取每一所述交易数据对应的数据版本号,得到至少一个数据版本号。307. Obtain a data version number corresponding to each of the transaction data, and obtain at least one data version number.
308、将每一数据版本号与预设版本号进行比较,若每一数据版本号与所述预设版本号相同,则确定对所述目标区块进行MVCC验证成功;若存在一个数据版本号与所述预设版本号不同,则确定对所述目标区块进行MVCC验证失败。308. Compare each data version number with a preset version number, and if each data version number is the same as the preset version number, then determine that the target block is successfully verified by MVCC; if there is a data version number If it is different from the preset version number, it is determined that the MVCC verification of the target block fails.
其中,上述预设版本号可为用户自行设置或者系统默认,在此不作限定。该预设版本号可为后台工作人员进行设置,例如,可为100或者200等,若针对一个交易进行MVCC验证成功,则表明该笔交易是有效的,则该交易对应的区块可存储到本地链中,且验证成功的对应的结果数据可存储到数据库中。The above-mentioned preset version number may be set by the user or defaulted by the system, which is not limited herein. The preset version number can be set by the background staff, for example, it can be 100 or 200, etc. If the MVCC verification of a transaction is successful, it means that the transaction is valid, and the block corresponding to the transaction can be stored in the In the local chain, and the corresponding result data of successful verification can be stored in the database.
本申请实施例仅以其中一个区块为例作数据验证的说明,每一区块中可包括至少一个交易,一般情况下,区块中可对应打包有成百上千个交易。上述目标区块中可包括至少一个目标交易,在对目标区块进行MVCC验证时,是以每个目标交易为单位的,直到每一目标交易验证完成,则可确定该目标区块MVCC验证完成。The embodiments of the present application only take one of the blocks as an example for data verification. Each block may include at least one transaction. In general, a block may contain hundreds or thousands of transactions correspondingly. The above-mentioned target block may include at least one target transaction. When MVCC verification is performed on the target block, each target transaction is used as a unit. Until the verification of each target transaction is completed, it can be determined that the MVCC verification of the target block is completed. .
具体实现中,上述每一目标交易对应的交易数据对应的版本号可对应存储在数据库中该区块对应的读集中,可通过交易版本号验证交易是否有效,也就是交易是否为正常交易,若数据版本号发生变化,则表明该交易无效,也就是说该交易可能已经超时或者过时,则可确定该交易无效,并确定该目标区块进行MVCC验证失败;若交易对应的数据版本号与 预设版本号相同,则可确定该交易为正常交易,则可确定对该目标区块MVCC验证成功。In the specific implementation, the version number corresponding to the transaction data corresponding to each target transaction can be stored in the read set corresponding to the block in the database, and the transaction version number can be used to verify whether the transaction is valid, that is, whether the transaction is a normal transaction. If the data version number changes, it indicates that the transaction is invalid, that is to say, the transaction may have timed out or outdated, it can be determined that the transaction is invalid, and it is determined that the MVCC verification of the target block fails; If the version numbers are the same, it can be determined that the transaction is a normal transaction, and it can be determined that the MVCC verification of the target block is successful.
309、当对所述目标区块完成进行MVCC验证完成以后,则执行在所述目标分支中删除所述目标区块对应的所述写集。309. After the MVCC verification of the target block is completed, delete the write set corresponding to the target block in the target branch.
其中,服务器可在对该目标区块进行MVCC验证完成以后,删除该目标区块对应的写集,并将该操作写入数据库中,以防止重复进行MVCC验证,此外,在进行下一次的MVCC验证时,从数据库获取新的区块以后,由于写集中可存储有最新的键值对,可将该新的区块对应的读集与上述目标区块的写集进行比较,以确定其两者之间是否有冲突,若有冲突,则在对新的区块的写集进行MVCC验证的时候,可重复上述相关步骤,以完成该新的区块的MVCC的验证。The server can delete the write set corresponding to the target block after the MVCC verification of the target block is completed, and write the operation into the database to prevent repeated MVCC verification. During verification, after a new block is obtained from the database, since the latest key-value pair can be stored in the write set, the read set corresponding to the new block can be compared with the write set of the above target block to determine the two Whether there is a conflict between them, if there is a conflict, when MVCC verification is performed on the write set of the new block, the above relevant steps can be repeated to complete the MVCC verification of the new block.
可以看出,本申请实施例所描述的数据验证方法,应用于服务器,获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;根据读集,判断目标区块与每一分支中至少一个区块是否存在冲突;若目标区块与每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储目标区块的写集;在对多个分支进行MVCC验证时,则执行对目标分支与多个分支并行进行MVCC验证;若目标区块与多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取至少一个第一分支中的任意一个第一分支作为目标分支,并将目标区块加入目标分支中。在对至少一个第一分支进行MVCC验证时,等待至少一个第一分支中除目标分支以外的其他分支中的每一区块完成MVCC验证,并等待目标分支中的除目标区块之外的每一区块完成MVCC验证以后,则执行确定每一目标交易对应的交易数据,得到至少一个交易数据;确定多个分支中与目标分支不冲突的至少一个第二分支;将至少一个第一分支与至少一个第二分支并行进行MVCC验证;在对至少一个第一分支进行MVCC验证时,等待至少一个第一分支中除目标分支以外的其他分支中的每一区块完成MVCC验证,并等待目标分支中的除目标区块之外的每一区块完成MVCC验证以后,则执行确定每一目标交易对应的交易数据,得到至少一个交易数据;获取每一交易数据对应的数据版本号,得到至少一个数据版本号;将每一数据版本号与预设版本号进行比较,若每一数据版本号与预设版本号相同,则确定对目标区块进行MVCC验证成功;若存在一个数据版本号与预设版本号不同,则确定对目标区块进行MVCC验证失败;当对目标区块完成进行MVCC验证完成以后,则执行在目标分支中删除目标区块对应的写集。如此,可基于上述预设DAG网络结构,对区块进行分类,将相关联的交易数据对应的区块放置于同一分支中,将不相关联的交易数据对应的区块放置于不同分支中;并在后续进行MVCC高并发验证时,可将分支与分支之间并行验证,而分支内可串行或并行验证,有利于提高数据验证效率。此外,当对目标区块MVCC验证完成以后,可删除该目标区块对应的写集,以避免再一次重复验证。It can be seen that the data verification method described in the embodiment of the present application is applied to the server to obtain the read set and write set corresponding to the target block; to obtain a plurality of branches in the preset DAG network structure, each branch corresponds to at least one area According to the read set, determine 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, execute a new target branch to A write set used to store the target block; when performing MVCC verification on multiple branches, perform MVCC verification on the target branch and multiple branches in parallel; if the target block and at least one of the first branches in the multiple branches are at least If there is a conflict between a block, select any one of the at least one first branch as the target branch, and add the target block to the target branch. When performing MVCC verification on at least one first branch, wait for each block in the at least one first branch other than the target branch to complete the MVCC verification, and wait for each block in the target branch except the target branch to complete the MVCC verification After a block completes the MVCC verification, the transaction data corresponding to each target transaction is determined, and at least one transaction data is obtained; at least one second branch among the multiple branches that does not conflict with the target branch is determined; At least one second branch performs MVCC verification in parallel; when performing MVCC verification on at least one first branch, wait for each block in the at least one first branch other than the target branch to complete MVCC verification, and wait for the target branch After the MVCC verification is completed for each block except the target block, the transaction data corresponding to each target transaction is determined, and at least one transaction data is obtained; the data version number corresponding to each transaction data is obtained, and at least one transaction data is obtained. Data version number; compare each data version number with the preset version number, if each data version number is the same as the preset version number, it is determined that the MVCC verification of the target block is successful; If the version numbers are different, it is determined that the MVCC verification of the target block fails; when the MVCC verification of the target block is completed, the write set corresponding to the target block is deleted in the target branch. In this way, the blocks can be classified based on the above-mentioned preset DAG network structure, and the blocks corresponding to the associated transaction data are placed in the same branch, and the blocks corresponding to the unrelated transaction data are placed in different branches; And in the subsequent high-concurrency verification of MVCC, the branches can be verified in parallel, and the branches can be verified in series or in parallel, which is beneficial to improve the efficiency of data verification. In addition, when the MVCC verification of the target block is completed, the write set corresponding to the target block can be deleted to avoid repeated verification.
与上述一致地,请参阅图4,图4为本申请实施例提供的一种服务器的结构示意图,如图4所示,包括处理器、通信接口、存储器以及一个或多个程序,所述处理器、通信接口和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,上述一个或多个程序程序包括用于执行以下步骤的指令:Consistent with the above, please refer to FIG. 4. FIG. 4 is a schematic structural diagram of a server provided by an embodiment of the present application. As shown in FIG. 4, it includes a processor, a communication interface, a memory, and one or more programs. A processor, a communication interface, and a memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, the processor is configured to invoke the program instructions, and the one or more program programs include Instructions to perform the following steps:
获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;Obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;According to the read set, determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突, 则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one of the at least one first branch as the target branch , and add the target block to the target branch; when performing the MVCC verification on the at least one first branch, wait for the at least one first branch to be in other branches except the target branch. After each block of the target branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then perform MVCC verification on the target block. .
可以看出,本申请实施例中所描述的服务器,可获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;根据读集,判断目标区块与每一分支中至少一个区块是否存在冲突;若目标区块与每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储目标区块的写集;在对多个分支进行MVCC验证时,则执行对目标分支与多个分支并行进行MVCC验证;若目标区块与多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取至少一个第一分支中的任意一个第一分支作为目标分支,并将目标区块加入目标分支中;在对至少一个第一分支进行MVCC验证时,等待至少一个第一分支中除目标分支以外的其他分支中的每一区块完成MVCC验证,并等待目标分支中的除目标区块之外的每一区块完成MVCC验证以后,则执行对目标区块进行MVCC验证。如此,将目标区块和预设DAG网络结构中的多个分支进行冲突比较;若该目标区块与多个分支中的多个区块之间不存在冲突,则新增一个分支,用于存储该目标区块;在进行MVCC验证时,将目标分支与多个分支并行验证;若目标区块与多个分支中至少一个第一分支的区块之间存在冲突,则从至少一个第一分支中选取一个第一分支为目标分支;在进行MVCC验证时,可等待至少一个第一分支完成MVCC验证,则对该目标区块进行MVCC验证,因此,可在保证MVCC验证的顺利进行的同时,通过并行验证上述分支之间,串行验证分支内的区块,有利于提高数据验证效率,从而,有利于提高区块链网络的性能。It can be seen that the server described in the embodiment of the present application can obtain the read set and write set corresponding to the target block; obtain multiple branches in the preset DAG network structure, each branch corresponds to at least one block; Set, determine 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, execute a new target branch for storing the target The write set of the block; when MVCC verification is performed on multiple branches, MVCC verification is performed on the target branch and multiple branches in parallel; if the target block and at least one block of at least one first branch in the multiple branches are If there is a conflict between the two, select any one of the at least one first branch as the target branch, and add the target block to the target branch; when MVCC verification is performed on the at least one first branch, wait for at least one first branch. Each block in the branch except the target branch completes the MVCC verification, and after waiting for each block in the target branch except the target block to complete the MVCC verification, then execute the MVCC verification on the target block . In this way, the conflict between the target block and the multiple branches in the preset DAG network structure is compared; if there is no conflict between the target block and multiple blocks in the multiple branches, a new branch is added for Store the target block; when performing the MVCC verification, verify the target branch and multiple branches in parallel; if there is a conflict between the target block and the block of at least one first branch in the multiple branches, from at least one first branch One of the first branches is selected as the target branch; when MVCC verification is performed, it is possible to wait for at least one first branch to complete MVCC verification, and then perform MVCC verification on the target block. Therefore, it can ensure the smooth progress of MVCC verification at the same time. , by verifying the blocks in the branches in parallel and serially verifying the blocks in the branches, it is beneficial to improve the efficiency of data verification, and thus, it is beneficial to improve the performance of the blockchain network.
在一个可能的示例中,在所述获取目标区块对应的读集和写集之后,所述程序用于执行以下步骤的指令:In a possible example, after the acquisition of the read set and the write set corresponding to the target block, the program is used to execute the instructions of the following steps:
获取所述目标区块中对应的至少一个目标交易;Obtain at least one target transaction corresponding to the target block;
对每一目标交易分别进行身份认证和签名认证;Perform identity authentication and signature authentication for each target transaction;
若所述至少一个目标交易中任意一个目标交易A身份认证失败和/或签名认证失败,则执行终止对所述目标交易A的数据验证步骤,所述数据验证步骤至少包括:所述签名认证或者所述MVCC验证。If any target transaction A in the at least one target transaction fails the identity authentication and/or the signature authentication fails, the step of terminating the data verification of the target transaction A is performed, and the data verification step includes at least: the signature authentication or The MVCC verification.
在一个可能的示例中,在所述根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突方面,所述程序用于执行以下步骤的指令:In a possible example, in the aspect of judging whether there is a conflict between the target block and at least one block in each branch according to the read set, the program is used to execute the instructions of the following steps:
根据所述读集,验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联;According to the read set, verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch;
若所述读集与所述每一区块对应的写集之间均无关联,则执行确定所述目标区块与所述每一分支中至少一个区块之间不存在冲突;If there is no association between the read set and the write set corresponding to each block, perform determining that there is no conflict between the target block and at least one block in each branch;
若存在所述读集与至少一个分支中至少一个区块的写集之间有关联,则执行确定所述目标区块与所述多个分支中至少一个分支之间存在冲突。If there is an association between the read set and the write set of at least one block in the at least one branch, perform determining that there is a conflict between the target block and at least one branch of the plurality of branches.
在一个可能的示例中,在所述验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联方面,所述程序用于执行以下步骤的指令:In a possible example, in the aspect of verifying whether there is an association between the read set and the write set corresponding to at least one block in the each branch, the program is used to execute the instructions of the following steps:
确定所述目标区块对应的读集中至少一个第一键值对,每一第一键值对应一笔所述目标交易;Determine at least one first key-value pair in the read set corresponding to the target block, and each first key value corresponds to a target transaction;
确定所述每一分支中每一区块包括的至少一个第二键值对,每一第二键值对对应一个区块中的一个交易;determining at least one second key-value pair included in each block in each branch, and each second key-value pair corresponds to a transaction in one block;
若出现至少一个所述第一键值对与至少一个所述第二键值对相等的情况,则执行确定 所述读集与至少一个区块对应的写集之间有关联;若任意一个第一键值对与任意一个第二键值对均不相等,则执行确定所述读集与每一区块对应的写集之间无关联。If at least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute the determination that there is an association between the read set and the write set corresponding to at least one block; if any one of the first key-value pairs is equal If a key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
在一个可能的示例中,在所述对所述目标区块进行MVCC验证方面,所述程序用于执行以下步骤的指令:In a possible example, in the aspect of performing MVCC verification on the target block, the program is used to execute the instructions of the following steps:
确定每一所述目标交易对应的交易数据,得到至少一个交易数据;Determine the transaction data corresponding to each of the target transactions, and obtain at least one transaction data;
获取每一所述交易数据对应的数据版本号,得到至少一个数据版本号;Obtain the data version number corresponding to each of the transaction data, and obtain at least one data version number;
将每一数据版本号与预设版本号进行比较,若每一数据版本号与所述预设版本号相同,则确定对所述目标区块进行MVCC验证成功;若存在一个数据版本号与所述预设版本号不同,则确定对所述目标区块进行MVCC验证失败。Compare each data version number with the preset version number, if each data version number is the same as the preset version number, then determine that the target block is successfully verified by MVCC; If the preset version numbers are different, it is determined that the MVCC verification of the target block fails.
在一个可能的示例中,若所述读集与所述多个分支中的至少一个分支有冲突,在所述在对所述至少一个第一分支进行所述MVCC验证方面,所述程序用于执行以下步骤的指令:In a possible example, if the read set conflicts with at least one of the plurality of branches, in the aspect of performing the MVCC verification on the at least one first branch, the program is configured to: Instructions to perform the following steps:
确定所述多个分支中与所述目标分支不冲突的至少一个第二分支;determining at least one second branch of the plurality of branches that does not conflict with the target branch;
将所述至少一个第一分支与所述至少一个第二分支并行进行所述MVCC验证。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 also used to execute instructions for the following steps:
当对所述目标区块完成进行MVCC验证完成以后,则执行在所述目标分支中删除所述目标区块对应的所述写集。After the MVCC verification of the target block is completed, delete the write set corresponding to the target block in the target branch.
上述主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,服务器为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所提供的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The foregoing mainly introduces the solutions of the embodiments of the present application from the perspective of the method-side execution process. It can be understood that, in order to implement the above-mentioned functions, the server includes corresponding hardware structures and/or software modules for executing each function. Those skilled in the art should easily realize that the present application can be implemented in hardware or in the form of a combination of hardware and computer software, in combination with the units and algorithm steps of each example described in the embodiments provided herein. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
本申请实施例可以根据上述方法示例对服务器进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In this embodiment of the present application, the server may be divided into functional units according to the foregoing method examples. For example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and other division methods may be used in actual implementation.
与上述一致地,请参阅图5,图5是本申请实施例公开的一种数据验证装置的结构示意图,应用于服务器,该装置包括:获取单元501、判断单元502和验证单元503,其中,Consistent with the above, please refer 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, and the device includes: an acquisition unit 501, a determination unit 502, and a verification unit 503, wherein,
所述获取单元501,用于获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;The obtaining unit 501 is used to obtain the read set and the write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
所述判断单元502,用于根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;The judging unit 502 is configured to judge whether there is a conflict between the target block and at least one block in each branch according to the read set; if the target block and at least one block in each branch If there is no conflict between the blocks, then execute a new target branch to store the write set of the target block; when performing MVCC verification on the multiple branches, execute the target branch and the write set. The multiple branches perform MVCC verification in parallel;
所述验证单元503,用于若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。The verification unit 503 is configured to select any one of the at least one first branch if there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches The first branch is used as the target branch, and the target block is added to the target branch; when the MVCC verification is performed on the at least one first branch, waiting for the at least one first branch to be removed After each block in the other branches other than the target branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then execute the verification. The target block is subjected to MVCC verification.
可以看出,本申请实施例中所描述的数据验证装置,应用于服务器,可获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块; 根据读集,判断目标区块与每一分支中至少一个区块是否存在冲突;若目标区块与每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储目标区块的写集;在对多个分支进行MVCC验证时,则执行对目标分支与多个分支并行进行MVCC验证;若目标区块与多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取至少一个第一分支中的任意一个第一分支作为目标分支,并将目标区块加入目标分支中;在对至少一个第一分支进行MVCC验证时,等待至少一个第一分支中除目标分支以外的其他分支中的每一区块完成MVCC验证,并等待目标分支中的除目标区块之外的每一区块完成MVCC验证以后,则执行对目标区块进行MVCC验证。如此,将目标区块和预设DAG网络结构中的多个分支进行冲突比较;若该目标区块与多个分支中的多个区块之间不存在冲突,则新增一个分支,用于存储该目标区块;在进行MVCC验证时,将目标分支与多个分支并行验证;若目标区块与多个分支中至少一个第一分支的区块之间存在冲突,则从至少一个第一分支中选取一个第一分支为目标分支;在进行MVCC验证时,可等待至少一个第一分支完成MVCC验证,则对该目标区块进行MVCC验证,因此,可在保证MVCC验证的顺利进行的同时,通过并行验证上述分支之间,串行验证分支内的区块,有利于提高数据验证效率,从而,有利于提高区块链网络的性能。It can be seen that the data verification device described in the embodiment of the present application is applied to the server, and can obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least A block; According to the read set, determine 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, execute a new target The branch is used to store the write set of the target block; when MVCC verification is performed on multiple branches, MVCC verification is performed on the target branch and multiple branches in parallel; if the target block and at least one of the multiple branches are the first branch There is a conflict between at least one block of the at least one first branch, then select any first branch in the at least one first branch as the target branch, and add the target block to the target branch; when MVCC verification is performed on the at least one first branch , wait for each block in the at least one first branch except the target branch to complete the MVCC verification, and wait for each block in the target branch except the target block to complete the MVCC verification, then execute the The target block undergoes MVCC verification. In this way, the conflict between the target block and the multiple branches in the preset DAG network structure is compared; if there is no conflict between the target block and multiple blocks in the multiple branches, a new branch is added for Store the target block; when performing the MVCC verification, verify the target branch and multiple branches in parallel; if there is a conflict between the target block and the block of at least one first branch in the multiple branches, from at least one first branch One of the first branches is selected as the target branch; when MVCC verification is performed, it is possible to wait for at least one first branch to complete MVCC verification, and then perform MVCC verification on the target block. Therefore, it can ensure the smooth progress of MVCC verification at the same time. , by verifying the blocks in the branches in parallel and serially verifying the blocks in the branches, it is beneficial to improve the efficiency of data verification, and thus, it is beneficial to improve the performance of the blockchain network.
在一种可能的示例中,在所述根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突方面,所述判断单元502具体用于:In a possible example, in the aspect of judging whether there is a conflict between the target block and at least one block in each branch according to the read set, the judging unit 502 is specifically configured to:
根据所述读集,验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联;According to the read set, verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch;
若所述读集与所述每一区块对应的写集之间均无关联,则执行确定所述目标区块与所述每一分支中至少一个区块之间不存在冲突;If there is no association between the read set and the write set corresponding to each block, perform determining that there is no conflict between the target block and at least one block in each branch;
若存在所述读集与至少一个分支中至少一个区块的写集之间有关联,则执行确定所述目标区块与所述多个分支中至少一个分支之间存在冲突。If there is an association between the read set and the write set of at least one block in the at least one branch, perform determining that there is a conflict between the target block and at least one branch of the plurality of branches.
在一个可能的示例中,在所述验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联方面,所述验证单元503具体用于:In a possible example, in the aspect of verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch, the verification unit 503 is specifically configured to:
确定所述目标区块对应的读集中至少一个第一键值对,每一第一键值对应一笔所述目标交易;Determine at least one first key-value pair in the read set corresponding to the target block, and each first key value corresponds to a target transaction;
确定所述每一分支中每一区块包括的至少一个第二键值对,每一第二键值对对应一个区块中的一个交易;determining at least one second key-value pair included in each block in each branch, and each second key-value pair corresponds to a transaction in one block;
若出现至少一个所述第一键值对与至少一个所述第二键值对相等的情况,则执行确定所述读集与至少一个区块对应的写集之间有关联;若任意一个第一键值对与任意一个第二键值对均不相等,则执行确定所述读集与每一区块对应的写集之间无关联。If at least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute the determination that there is an association between the read set and the write set corresponding to at least one block; if any one of the first key-value pairs is equal If a key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
在一个可能的示例中,在所述对所述目标区块进行MVCC验证方面,所述验证单元503具体还用于:In a possible example, in the aspect of performing the MVCC verification on the target block, the verification unit 503 is further configured to:
确定每一所述目标交易对应的交易数据,得到至少一个交易数据;Determine the transaction data corresponding to each of the target transactions, and obtain at least one transaction data;
获取每一所述交易数据对应的数据版本号,得到至少一个数据版本号;Obtain the data version number corresponding to each of the transaction data, and obtain at least one data version number;
将每一数据版本号与预设版本号进行比较,若每一数据版本号与所述预设版本号相同,则确定对所述目标区块进行MVCC验证成功;若存在一个数据版本号与所述预设版本号不同,则确定对所述目标区块进行MVCC验证失败。Compare each data version number with the preset version number, if each data version number is the same as the preset version number, then determine that the target block is successfully verified by MVCC; If the preset version numbers are different, it is determined that the MVCC verification of the target block fails.
在一个可能的示例中,若所述读集与所述多个分支中的至少一个分支有冲突,在所述在对所述至少一个第一分支进行所述MVCC验证方面,所述验证单元503具体还用于:In a possible example, if the read set conflicts with at least one of the multiple branches, in the aspect of performing the MVCC verification on the at least one first branch, the verification unit 503 Specifically also used for:
确定所述多个分支中与所述目标分支不冲突的至少一个第二分支;determining at least one second branch of the plurality of branches that does not conflict with the target branch;
将所述至少一个第一分支与所述至少一个第二分支并行进行所述MVCC验证。The MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
本申请实施例还提供一种计算机可读存储介质,其中,该计算机可读存储介质存储用 于电子数据交换的计算机程序,该计算机程序使得计算机执行如上述方法实施例中记载的任何一种数据验证方法的部分或全部步骤。Embodiments of the present application further provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute any data as described in the foregoing method embodiments Validate some or all of the steps of the method.
可选的,本申请涉及的存储介质如计算机可读存储介质可以是非易失性的,也可以是易失性的。Optionally, the storage medium involved in this application, such as a computer-readable storage medium, may be non-volatile or volatile.
本申请实施例还提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如上述方法实施例中记载的任何一种数据验证方法的部分或全部步骤。该计算机程序产品可以为一个软件安装包。The embodiments of the present application further provide a computer program product, the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute the methods described in the foregoing method embodiments. Some or all of the steps of any data validation method. The computer program product may be a software installation package.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with the present application, certain steps may be performed in other orders or concurrently. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to the relevant 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 manners. For example, the apparatus embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件程序模块的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, and can also be implemented in the form of software program modules.
所述集成的单元如果以软件程序模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software program module and sold or used as a stand-alone product, may be stored in a computer readable memory. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art, or all or part of the technical solution, and the computer software product is stored in a memory, Several instructions are included to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (random access memory, RAM), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、ROM、RAM、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash disk , ROM, RAM, disk or CD, etc.
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The embodiments of the present application have been introduced in detail above, and the principles and implementations of the present application are described in this paper by using specific examples. The descriptions of the above embodiments are only used to help understand the methods and core ideas of the present application; at the same time, for Persons of ordinary skill in the art, based on the idea of the present application, will have changes in the specific implementation manner and application scope. In summary, the contents of this specification should not be construed as limitations on the present application.

Claims (20)

  1. 一种数据验证方法,应用于服务器,包括:A data validation method, applied to the server, including:
    获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;Obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
    根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;According to the read set, determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
    若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one of the at least one first branch as the target branch , and add the target block to the target branch; when performing the MVCC verification on the at least one first branch, wait for the at least one first branch to be in other branches except the target branch. After each block of the target branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then perform MVCC verification on the target block. .
  2. 根据权利要求1所述的方法,其中,在所述获取目标区块对应的读集和写集之后,所述方法还包括:The method according to claim 1, wherein, after the acquisition of the read set and the write set corresponding to the target block, the method further comprises:
    获取所述目标区块中对应的至少一个目标交易;Obtain at least one target transaction corresponding to the target block;
    对每一目标交易分别进行身份认证和签名认证;Perform identity authentication and signature authentication for each target transaction;
    若所述至少一个目标交易中任意一个目标交易A身份认证失败和/或签名认证失败,则执行终止对所述目标交易A的数据验证步骤,所述数据验证步骤至少包括:所述签名认证或者所述MVCC验证。If any target transaction A in the at least one target transaction fails the identity authentication and/or the signature authentication fails, the step of terminating the data verification of the target transaction A is performed, and the data verification step includes at least: the signature authentication or The MVCC verification.
  3. 根据权利要求1所述的方法,其中,所述根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突,包括:The method according to claim 1, wherein, according to the read set, judging whether there is a conflict between the target block and at least one block in each branch comprises:
    根据所述读集,验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联;According to the read set, verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch;
    若所述读集与所述每一区块对应的写集之间均无关联,则执行确定所述目标区块与所述每一分支中至少一个区块之间不存在冲突;If there is no association between the read set and the write set corresponding to each block, perform determining that there is no conflict between the target block and at least one block in each branch;
    若存在所述读集与至少一个分支中至少一个区块的写集之间有关联,则执行确定所述目标区块与所述多个分支中至少一个分支之间存在冲突。If there is an association between the read set and the write set of at least one block in the at least one branch, perform determining that there is a conflict between the target block and at least one branch of the plurality of branches.
  4. 根据权利要求3所述的方法,其中,所述验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联,包括:The method according to claim 3, wherein the verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch comprises:
    确定所述目标区块对应的读集中至少一个第一键值对,每一第一键值对应一笔所述目标交易;Determine at least one first key-value pair in the read set corresponding to the target block, and each first key value corresponds to a target transaction;
    确定所述每一分支中每一区块包括的至少一个第二键值对,每一第二键值对对应一个区块中的一个交易;determining at least one second key-value pair included in each block in each branch, and each second key-value pair corresponds to a transaction in one block;
    若出现至少一个所述第一键值对与至少一个所述第二键值对相等的情况,则执行确定所述读集与至少一个区块对应的写集之间有关联;若任意一个第一键值对与任意一个第二键值对均不相等,则执行确定所述读集与每一区块对应的写集之间无关联。If at least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute the determination that there is an association between the read set and the write set corresponding to at least one block; if any one of the first key-value pairs is equal If a key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
  5. 根据权利要求1所述的方法,其中,所述对所述目标区块进行MVCC验证,包括:The method according to claim 1, wherein the performing MVCC verification on the target block comprises:
    确定每一所述目标交易对应的交易数据,得到至少一个交易数据;Determine the transaction data corresponding to each of the target transactions, and obtain at least one transaction data;
    获取每一所述交易数据对应的数据版本号,得到至少一个数据版本号;Obtain the data version number corresponding to each of the transaction data, and obtain at least one data version number;
    将每一数据版本号与预设版本号进行比较,若每一数据版本号与所述预设版本号相同,则确定对所述目标区块进行MVCC验证成功;若存在一个数据版本号与所述预设版本号不同,则确定对所述目标区块进行MVCC验证失败。Compare each data version number with the preset version number, if each data version number is the same as the preset version number, then determine that the target block is successfully verified by MVCC; If the preset version numbers are different, it is determined that the MVCC verification of the target block fails.
  6. 根据权利要求1所述的方法,其中,若所述读集与所述多个分支中的至少一个分支有冲突,所述在对所述至少一个第一分支进行所述MVCC验证时,所述方法还包括:The method of claim 1 , wherein, if the read set conflicts with at least one branch of the plurality of branches, when performing the MVCC verification on the at least one first branch, the Methods also include:
    确定所述多个分支中与所述目标分支不冲突的至少一个第二分支;determining at least one second branch of the plurality of branches that does not conflict with the target branch;
    将所述至少一个第一分支与所述至少一个第二分支并行进行所述MVCC验证。The MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
  7. 根据权利要求1-6任一项所述的方法,其中,所述方法还包括:The method according to any one of claims 1-6, wherein the method further comprises:
    当对所述目标区块完成进行MVCC验证完成以后,则执行在所述目标分支中删除所述目标区块对应的所述写集。After the MVCC verification of the target block is completed, delete the write set corresponding to the target block in the target branch.
  8. 一种数据验证装置,应用于服务器,所述装置包括:获取单元、判断单元和验证单元,其中,A data verification device, applied to a server, the device comprises: an acquisition unit, a judgment unit and a verification unit, wherein,
    所述获取单元,用于获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;The obtaining unit is used to obtain the read set and the write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
    所述判断单元,用于根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;The judging unit is configured to judge whether there is a conflict between the target block and at least one block in each branch according to the read set; if the target block and at least one area in each branch If there is no conflict between the blocks, then execute a new target branch for storing the write set of the target block; when MVCC verification is performed on the multiple branches, execute the target branch and all The multiple branches described above perform MVCC verification in parallel;
    所述验证单元,用于若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。The verification unit is configured to select any one of the at least one first 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. A branch is used as the target branch, and the target block is added to the target branch; when the MVCC verification is performed on the at least one first branch, waiting for the at least one first branch to remove the Each block in the branches other than the target branch completes the MVCC verification, and after each block in the target branch except the target block completes the MVCC verification, execute the The target block is verified by MVCC.
  9. 一种服务器,包括处理器、通信接口、存储器以及一个或多个程序,所述处理器、通信接口和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行以下方法:A server comprising a processor, a communication interface, a memory and one or more programs, the processor, the communication interface and the memory being interconnected, wherein the memory is used to store a computer program, the computer program comprising program instructions, The processor is configured to invoke the program instructions to perform the following methods:
    获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;Obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
    根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;According to the read set, determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
    若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。If there is a conflict between the target block and at least one block of at least one first branch in the plurality of branches, execute selecting any one of the at least one first branch as the target branch , and add the target block to the target branch; when performing the MVCC verification on the at least one first branch, wait for the at least one first branch to be in other branches except the target branch. After each block of the target branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then perform MVCC verification on the target block. .
  10. 根据权利要求9所述的服务器,其中,在所述获取目标区块对应的读集和写集之后,所述处理器还用于执行:The server according to claim 9, wherein, after obtaining the read set and write set corresponding to the target block, the processor is further configured to execute:
    获取所述目标区块中对应的至少一个目标交易;Obtain at least one target transaction corresponding to the target block;
    对每一目标交易分别进行身份认证和签名认证;Perform identity authentication and signature authentication for each target transaction;
    若所述至少一个目标交易中任意一个目标交易A身份认证失败和/或签名认证失败,则执行终止对所述目标交易A的数据验证步骤,所述数据验证步骤至少包括:所述签名认证或者所述MVCC验证。If any target transaction A in the at least one target transaction fails the identity authentication and/or the signature authentication fails, the step of terminating the data verification of the target transaction A is performed, and the data verification step includes at least: the signature authentication or The MVCC verification.
  11. 根据权利要求9所述的服务器,其中,执行所述根据所述读集,判断所述目标区 块与所述每一分支中至少一个区块是否存在冲突,包括:The server according to claim 9, wherein, according to the read set, it is judged whether there is a conflict between the target block and at least one block in each branch, comprising:
    根据所述读集,验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联;According to the read set, verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch;
    若所述读集与所述每一区块对应的写集之间均无关联,则执行确定所述目标区块与所述每一分支中至少一个区块之间不存在冲突;If there is no association between the read set and the write set corresponding to each block, perform determining that there is no conflict between the target block and at least one block in each branch;
    若存在所述读集与至少一个分支中至少一个区块的写集之间有关联,则执行确定所述目标区块与所述多个分支中至少一个分支之间存在冲突。If there is an association between the read set and the write set of at least one block in the at least one branch, perform determining that there is a conflict between the target block and at least one branch of the plurality of branches.
  12. 根据权利要求11所述的服务器,其中,执行所述验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联,包括:The server of claim 11, wherein performing the verifying whether there is an association between the read set and a write set corresponding to at least one block in each branch comprises:
    确定所述目标区块对应的读集中至少一个第一键值对,每一第一键值对应一笔所述目标交易;Determine at least one first key-value pair in the read set corresponding to the target block, and each first key value corresponds to a target transaction;
    确定所述每一分支中每一区块包括的至少一个第二键值对,每一第二键值对对应一个区块中的一个交易;determining at least one second key-value pair included in each block in each branch, and each second key-value pair corresponds to a transaction in one block;
    若出现至少一个所述第一键值对与至少一个所述第二键值对相等的情况,则执行确定所述读集与至少一个区块对应的写集之间有关联;若任意一个第一键值对与任意一个第二键值对均不相等,则执行确定所述读集与每一区块对应的写集之间无关联。If at least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute the determination that there is an association between the read set and the write set corresponding to at least one block; if any one of the first key-value pairs is equal If a key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
  13. 根据权利要求9所述的服务器,其中,执行所述对所述目标区块进行MVCC验证,包括:The server of claim 9, wherein performing the MVCC verification on the target block comprises:
    确定每一所述目标交易对应的交易数据,得到至少一个交易数据;Determine the transaction data corresponding to each of the target transactions, and obtain at least one transaction data;
    获取每一所述交易数据对应的数据版本号,得到至少一个数据版本号;Obtain the data version number corresponding to each of the transaction data, and obtain at least one data version number;
    将每一数据版本号与预设版本号进行比较,若每一数据版本号与所述预设版本号相同,则确定对所述目标区块进行MVCC验证成功;若存在一个数据版本号与所述预设版本号不同,则确定对所述目标区块进行MVCC验证失败。Compare each data version number with the preset version number, if each data version number is the same as the preset version number, then determine that the target block is successfully verified by MVCC; If the preset version numbers are different, it is determined that the MVCC verification of the target block fails.
  14. 根据权利要求9或13所述的服务器,其中,若所述读集与所述多个分支中的至少一个分支有冲突,所述在对所述至少一个第一分支进行所述MVCC验证时,所述处理器还用于执行:The server according to claim 9 or 13, wherein, if the read set conflicts with at least one branch in the plurality of branches, when performing the MVCC verification on the at least one first branch, The processor is also used to execute:
    确定所述多个分支中与所述目标分支不冲突的至少一个第二分支;determining at least one second branch of the plurality of branches that does not conflict with the target branch;
    将所述至少一个第一分支与所述至少一个第二分支并行进行所述MVCC验证。The MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行以下方法:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, the computer program comprising program instructions that, when executed by a processor, cause the processor to perform the following method:
    获取目标区块对应的读集和写集;获取预设DAG网络结构中的多个分支,每一分支对应至少一个区块;Obtain the read set and write set corresponding to the target block; obtain a plurality of branches in the preset DAG network structure, and each branch corresponds to at least one block;
    根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突;若所述目标区块与所述每一分支中至少一个区块之间不存在冲突,则执行新增一个目标分支以用于存储所述目标区块的所述写集;在对所述多个分支进行MVCC验证时,则执行对所述目标分支与所述多个分支并行进行MVCC验证;According to the read set, determine 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, Then execute a new target branch for storing the write set of the target block; when performing MVCC verification on the multiple branches, execute MVCC on the target branch and the multiple branches in parallel verify;
    若所述目标区块与所述多个分支中至少一个第一分支的至少一个区块之间存在冲突,则执行选取所述至少一个第一分支中的任意一个第一分支作为所述目标分支,并将所述目标区块加入所述目标分支中;在对所述至少一个第一分支进行所述MVCC验证时,等待所述至少一个第一分支中除所述目标分支以外的其他分支中的每一区块完成所述MVCC验证,并等待所述目标分支中的除所述目标区块之外的每一区块完成所述MVCC验证以后,则执行对所述目标区块进行MVCC验证。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, execute selecting any first branch of the at least one first branch as the target branch , and add the target block to the target branch; when performing the MVCC verification on the at least one first branch, wait for the at least one first branch to be in other branches except the target branch After each block of the target branch completes the MVCC verification, and waits for each block in the target branch except the target block to complete the MVCC verification, then perform MVCC verification on the target block. .
  16. 根据权利要求15所述的计算机可读存储介质,其中,在所述获取目标区块对应的 读集和写集之后,所述程序指令当被处理器执行时还使所述处理器执行:The computer-readable storage medium according to claim 15, wherein, after the acquisition of the read set and the write set corresponding to the target block, the program instructions, when executed by the processor, further cause the processor to execute:
    获取所述目标区块中对应的至少一个目标交易;obtaining at least one target transaction corresponding to the target block;
    对每一目标交易分别进行身份认证和签名认证;Perform identity authentication and signature authentication for each target transaction;
    若所述至少一个目标交易中任意一个目标交易A身份认证失败和/或签名认证失败,则执行终止对所述目标交易A的数据验证步骤,所述数据验证步骤至少包括:所述签名认证或者所述MVCC验证。If any one of the at least one target transaction fails the identity authentication and/or the signature authentication fails, execute the step of terminating the data verification of the target transaction A, and the data verification step includes at least: the signature authentication or The MVCC verification.
  17. 根据权利要求15所述的计算机可读存储介质,其中,执行所述根据所述读集,判断所述目标区块与所述每一分支中至少一个区块是否存在冲突,包括:The computer-readable storage medium according to claim 15, wherein performing the determining whether there is a conflict between the target block and at least one block in each branch according to the read set comprises:
    根据所述读集,验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联;According to the read set, verifying whether there is an association between the read set and the write set corresponding to at least one block in each branch;
    若所述读集与所述每一区块对应的写集之间均无关联,则执行确定所述目标区块与所述每一分支中至少一个区块之间不存在冲突;If there is no association between the read set and the write set corresponding to each block, perform determining that there is no conflict between the target block and at least one block in each branch;
    若存在所述读集与至少一个分支中至少一个区块的写集之间有关联,则执行确定所述目标区块与所述多个分支中至少一个分支之间存在冲突。If there is an association between the read set and the write set of at least one block in the at least one branch, perform determining that there is a conflict between the target block and at least one branch of the plurality of branches.
  18. 根据权利要求17所述的计算机可读存储介质,其中,执行所述验证所述读集与所述每一分支中的至少一个区块对应的写集之间是否有关联,包括:The computer-readable storage medium of claim 17, wherein performing the verifying whether there is an association between the read set and a write set corresponding to at least one block in each branch comprises:
    确定所述目标区块对应的读集中至少一个第一键值对,每一第一键值对应一笔所述目标交易;Determine at least one first key-value pair in the read set corresponding to the target block, and each first key value corresponds to a target transaction;
    确定所述每一分支中每一区块包括的至少一个第二键值对,每一第二键值对对应一个区块中的一个交易;determining at least one second key-value pair included in each block in the each branch, and each second key-value pair corresponds to a transaction in a block;
    若出现至少一个所述第一键值对与至少一个所述第二键值对相等的情况,则执行确定所述读集与至少一个区块对应的写集之间有关联;若任意一个第一键值对与任意一个第二键值对均不相等,则执行确定所述读集与每一区块对应的写集之间无关联。If at least one of the first key-value pairs is equal to at least one of the second key-value pairs, execute the determination that there is an association between the read set and the write set corresponding to at least one block; if any one of the first key-value pairs is equal If a key-value pair is not equal to any second key-value pair, it is determined that there is no association between the read set and the write set corresponding to each block.
  19. 根据权利要求15所述的计算机可读存储介质,其中,执行所述对所述目标区块进行MVCC验证,包括:The computer-readable storage medium of claim 15, wherein performing the MVCC verification on the target block comprises:
    确定每一所述目标交易对应的交易数据,得到至少一个交易数据;Determine the transaction data corresponding to each of the target transactions, and obtain at least one transaction data;
    获取每一所述交易数据对应的数据版本号,得到至少一个数据版本号;Obtain the data version number corresponding to each of the transaction data, and obtain at least one data version number;
    将每一数据版本号与预设版本号进行比较,若每一数据版本号与所述预设版本号相同,则确定对所述目标区块进行MVCC验证成功;若存在一个数据版本号与所述预设版本号不同,则确定对所述目标区块进行MVCC验证失败。Compare each data version number with the preset version number, if each data version number is the same as the preset version number, then determine that the target block is successfully verified by MVCC; If the preset version numbers are different, it is determined that the MVCC verification of the target block fails.
  20. 根据权利要求15或19所述的计算机可读存储介质,其中,若所述读集与所述多个分支中的至少一个分支有冲突,所述在对所述至少一个第一分支进行所述MVCC验证时,所述程序指令当被处理器执行时还使所述处理器执行:19. The computer-readable storage medium of claim 15 or 19, wherein if the read set conflicts with at least one of the plurality of branches, the performing the said at least one first branch Upon MVCC verification, the program instructions, when executed by the processor, also cause the processor to execute:
    确定所述多个分支中与所述目标分支不冲突的至少一个第二分支;determining at least one second branch of the plurality of branches that does not conflict with the target branch;
    将所述至少一个第一分支与所述至少一个第二分支并行进行所述MVCC验证。The MVCC verification is performed in parallel with the at least one first branch and the at least one second branch.
PCT/CN2021/097243 2020-08-28 2021-05-31 Data verification method and apparatus, and storage medium WO2022041901A1 (en)

Applications Claiming Priority (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
CN202010883730.6 2020-08-28

Publications (1)

Publication Number Publication Date
WO2022041901A1 true WO2022041901A1 (en) 2022-03-03

Family

ID=73587610

Family Applications (1)

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

Country Status (2)

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

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115796874A (en) * 2023-01-09 2023-03-14 杭州安节科技有限公司 Operation-level block chain transaction concurrent execution method

Families Citing this family (3)

* 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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180293583A1 (en) * 2017-04-05 2018-10-11 Samsung Sds Co., Ltd. Method for calculating confirmation reliability for blockchain based transaction and blockchain network monitoring system for performing the method
CN109614206A (en) * 2018-10-25 2019-04-12 深圳壹账通智能科技有限公司 Device, method and the storage medium of block chain issued transaction
CN110781196A (en) * 2019-09-06 2020-02-11 深圳壹账通智能科技有限公司 Block chain transaction processing method and device, computer 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
CN110874739A (en) * 2018-08-30 2020-03-10 国际商业机器公司 Distributed computing and storage network implementing high integrity, high bandwidth, low latency, secure processing
CN112037058A (en) * 2020-08-28 2020-12-04 平安科技(深圳)有限公司 Data verification method, device and storage medium

Family Cites Families (9)

* 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
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
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
CN109559226B (en) * 2018-11-28 2021-03-02 连连银加信息技术有限公司 Block chain transaction execution method and system, electronic device and storage medium
WO2020108289A1 (en) * 2018-11-29 2020-06-04 华为技术有限公司 Database system, node and method
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
CN111241061B (en) * 2020-01-09 2023-04-07 平安科技(深圳)有限公司 Writing method of state database, data processing device and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180293583A1 (en) * 2017-04-05 2018-10-11 Samsung Sds Co., Ltd. Method for calculating confirmation reliability for blockchain based transaction and blockchain network monitoring system for performing the method
CN110874739A (en) * 2018-08-30 2020-03-10 国际商业机器公司 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
CN110781196A (en) * 2019-09-06 2020-02-11 深圳壹账通智能科技有限公司 Block chain transaction processing method and device, computer 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
CN112037058A (en) * 2020-08-28 2020-12-04 平安科技(深圳)有限公司 Data verification method, device and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115796874A (en) * 2023-01-09 2023-03-14 杭州安节科技有限公司 Operation-level block chain transaction concurrent execution method

Also Published As

Publication number Publication date
CN112037058B (en) 2024-03-26
CN112037058A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
WO2022041901A1 (en) Data verification method and apparatus, and storage medium
US10776786B2 (en) Method for creating, registering, revoking authentication information and server using the same
WO2020119506A1 (en) Identity authentication method based on alliance chain, and terminal device
EP3627431A1 (en) Cross-chain trading method and apparatus
US9635035B2 (en) Managing user authentication in association with application access
WO2021018088A1 (en) Trusted authentication method, network device, system and storage medium
CN110311958B (en) Block chain network system
US20190050598A1 (en) Secure data storage
US20200389455A1 (en) Authentication system and authentication method
US20200364212A1 (en) System and method of supporting reflection of transactions between blockchain networks
WO2014018811A1 (en) Automatic transaction retry after session failure
US10755237B2 (en) Method for creating, registering, revoking authentication information and server using the same
US11366932B2 (en) Consensus method and data verification method, apparatus, and system of consortium blockchain
WO2023045617A1 (en) Transaction data processing method and apparatus, device and medium
WO2022041900A1 (en) Method and apparatus for storing blocks of blockchain, and node device and storage medium
WO2022206437A1 (en) Method and apparatus for querying ledger data of fabric blockchain
JP2014524204A (en) Method and system for storing and retrieving data from key-value storage
CN112989380A (en) Resource exchange processing method, device, equipment and storage medium
CN111339551B (en) Data verification method and related device and equipment
CN113037505B (en) Method and system for realizing trusted Web application
CN112015558A (en) Data verification method, device and storage medium
US20210365433A1 (en) Method and apparatus for managing data based on blockchain
WO2009140911A1 (en) Method for interactive authentication
CN109409899B (en) Transaction verification method, device and system
WO2022206432A1 (en) Method and apparatus for querying ledger data in fabric blockchain

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21859745

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21859745

Country of ref document: EP

Kind code of ref document: A1