Verification method, device and system for block chain transaction pre-confirmation, and program product

By using Merkel Tree and Data Proof in Blockchain Transactions, the Verifier Device can ensure that the transaction load contains pre-confirmed target transactions, solving the problem that the builder device may tear down pre-confirm commitments and improving blocks Security of chain transactions.

CN119477318AActive Publication Date: 2025-02-18HANGZHOU HIGH-TECH ZONE (BINJIANG) INSTITUTE OF BLOCKCHAIN & DATA SECURITY
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411455042.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-18
Estimated Expiration
2044-10-17

AI Technical Summary

Technical Problem

In blockchain transactions, the builder device may build a transaction load that does not include transaction data of the target transaction, thereby tearing down the verification device's pre-confirmation commitment for the target transaction, reducing the security of the blockchain transaction.

Method used

After the verifier device receives a pre-confirmation request for the target transaction, the transaction data of the target transaction is sent to the builder device, instructing the builder device to build a transaction load containing transaction data and data proof in the form of a Merkel tree, and Send the transaction load to the verifier device. The verifier device verifies whether transaction data is included in the transaction load based on the data proof.

Benefits of technology

Ensure that the builder device builds the transaction load including pre-confirmed target transactions, thereby preventing tearing down pre-confirmation commitments and improving the security of blockchain transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119477318A_ABST
    Figure CN119477318A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of block chains, and provides a block chain transaction pre-confirmation verification method, device and system, and a program product. The method is applied to verifier equipment, and comprises the following steps: after a pre-confirmation request for a target transaction is received, sending transaction data of the target transaction to constructor equipment so as to indicate the constructor equipment to construct a transaction load containing the transaction data and data proof in a Merkel tree form according to the transaction data, the transaction load is sent to verifier equipment; and after the transaction load is received, verifying whether the transaction load comprises transaction data according to the data proof. Through the method provided by the invention, the verifier equipment can verify whether the transaction load constructed by the constructor comprises the pre-confirmed target transaction or not, so that the transaction load can be broadcasted after the transaction load comprises the pre-confirmed target transaction, and the security of the block chain transaction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of blockchain technology, and in particular, relates to a verification method, device, system and program product for pre-confirmation of blockchain transactions. Background Art

[0002] In a blockchain transaction, a user can send a pre-confirmation request for a target transaction to a verifier device to obtain the pre-confirmation commitment of the verifier device and the builder device to the target transaction. After receiving the pre-confirmation request sent by the user, the verifier device can pre-confirm the target transaction and send the pre-confirmed target transaction to the builder device. The builder can build a transaction payload including the transaction data of the target transaction based on the pre-confirmed target transaction and then send it to the verifier device. The verifier device then broadcasts the received transaction payload.

[0003] However, after receiving the pre-confirmed target transaction, the builder device may construct a transaction payload that does not include the transaction data of the target transaction, thereby tearing up the pre-confirmation commitment of the verifier device to the target transaction and reducing the security of the blockchain transaction. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a blockchain transaction pre-confirmation verification method, device, system and program product to solve the technical problem of low security of existing blockchain transactions.

[0005] In a first aspect, an embodiment of the present application provides a blockchain transaction pre-confirmation verification method, which is applied to a verifier device, and the method includes:

[0006] After receiving a pre-confirmation request for a target transaction, the transaction data of the target transaction is sent to a builder device to instruct the builder device to construct a transaction payload including the transaction data and a data proof in the form of a Merkle tree according to the transaction data, and send the transaction payload to the verifier device; wherein the data proof is used to prove that the transaction payload includes the transaction data, the Merkle tree includes a first node and a second node, the first node includes a first hash of the transaction data, the second node includes a second hash for auxiliary verification, and the data proof includes a first root hash, the first hash of the first node, an index of the first node, the second hash of the second node, and an index of the second node;

[0007] After receiving the transaction payload, verify whether the transaction data is included in the transaction payload according to the data proof.

[0008] Optionally, verifying, according to the data proof, whether the transaction payload includes the transaction data includes:

[0009] Determine a second root hash according to the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node;

[0010] If the second root hash is consistent with the first root hash, it is determined that the transaction payload includes the transaction data.

[0011] In a second aspect, an embodiment of the present application provides a blockchain transaction pre-confirmation verification method, which is applied to a builder device, and the method includes:

[0012] After receiving the transaction data of the target transaction sent by the verifier device, a transaction payload including the transaction data and a data proof is constructed in the form of a Merkle tree according to the transaction data, and the transaction payload is sent to the verifier device to instruct the verifier device to verify whether the transaction data is included in the transaction payload according to the data proof; wherein the transaction data is sent by the verifier device to the builder device after receiving a pre-confirmation request for the target transaction, the data proof is used to prove that the transaction data is included in the transaction payload, the Merkle tree includes a first node and a second node, the first node includes a first hash of the transaction data, the second node includes a second hash for auxiliary verification, and the data proof includes a first root hash, the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node.

[0013] Optionally, constructing a transaction payload including the transaction data and the data proof in the form of a Merkle tree according to the transaction data includes:

[0014] Determine positions of the first node and the second node in the Merkle tree, and determine an index of the first node according to the position of the first node in the Merkle tree, and determine an index of the second node according to the position of the second node in the Merkle tree;

[0015] Using the hash of the transaction data as the first hash of the first node;

[0016] Generating the second hash of the second node in a preset manner;

[0017] Determine the first root hash according to the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node;

[0018] determining the data proof according to the first root hash, the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node;

[0019] The transaction payload is constructed according to the transaction data and the data proof.

[0020] Optionally, determining the positions of the first node and the second node in the Merkle tree includes:

[0021] The first node is determined among the leaf nodes of the Merkle tree, and the other leaf nodes among the leaf nodes except the first node are determined as the second nodes.

[0022] Optionally, after determining the leaf nodes other than the first node among the leaf nodes as the second nodes, the method further includes:

[0023] If the parent nodes of any two of the second nodes are the same, the parent nodes are used to replace the any two of the second nodes.

[0024] In a third aspect, an embodiment of the present application provides a verifier device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the blockchain transaction pre-confirmation verification method as described in any one of the first aspect and the second aspect is implemented.

[0025] In a fourth aspect, an embodiment of the present application provides a builder device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the blockchain transaction pre-confirmation verification method as described in any one of the first aspect and the second aspect is implemented.

[0026] In a fifth aspect, an embodiment of the present application provides a blockchain transaction pre-confirmation verification system, comprising a verifier device as described in the third aspect and a builder device as described in the fourth aspect.

[0027] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, each step in the blockchain transaction pre-confirmation verification method as described in any one of the first and second aspects above is implemented.

[0028] In the seventh aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes each step in the blockchain transaction pre-confirmation verification method as described in any one of the first and second aspects above.

[0029] The blockchain transaction pre-confirmation verification method, device, system and program product provided by the embodiments of the present application have the following beneficial effects:

[0030] The blockchain transaction pre-confirmation verification method provided by the embodiment of the present application can be applied to the verifier device, specifically including: after receiving the pre-confirmation request for the target transaction, sending the transaction data of the target transaction to the builder device to instruct the builder device to construct a transaction load including the transaction data and the data proof in the form of a Merkle tree according to the transaction data, and sending the transaction load to the verifier device. After receiving the transaction load, the verifier device verifies whether the transaction data is included in the transaction load according to the data proof. Through the blockchain transaction pre-confirmation verification method provided by the embodiment of the present application, the verifier device can verify whether the transaction load constructed by the builder includes the pre-confirmed target transaction, so that the transaction load can be broadcast after ensuring that the pre-confirmed target transaction is included in the transaction load, thereby preventing the builder device from tearing up the pre-confirmation commitment of the verifier device to the target transaction, and improving the security of blockchain transactions. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0032] Figure 1 A flowchart of a blockchain transaction pre-confirmation verification method provided in an embodiment of the present application;

[0033] Figure 2 A schematic diagram of the structure of a Merkle tree provided in an embodiment of the present application;

[0034] Figure 3 A flowchart of a blockchain transaction pre-confirmation verification method provided in another embodiment of the present application;

[0035] Figure 4 A schematic diagram of the structure of a verifier device provided in an embodiment of the present application;

[0036] Figure 5 A schematic diagram of the structure of a builder device provided in an embodiment of the present application;

[0037] Figure 6 A schematic diagram of the structure of a verifier device provided in another embodiment of the present application;

[0038] Figure 7A schematic structural diagram of a builder device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0039] It should be noted that the terms used in the embodiments of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application. In the description of the embodiments of the present application, unless otherwise specified, "multiple" refers to two or more than two, and "at least one", "one or more" refers to one, two or more. The terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, it is defined that the "first" and "second" features can explicitly or implicitly include one or more of the features.

[0040] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0041] The blockchain transaction pre-confirmation verification method provided in the embodiment of the present application can be applied to blockchain transaction scenarios where transaction pre-confirmation is required.

[0042] The execution subject of the blockchain transaction pre-confirmation verification method provided in the embodiment of the present application may include a verifier device and a builder device. The verifier device and the builder device may be included in electronic devices such as mobile phones, tablet computers, laptops, and desktop computers.

[0043] When it is necessary to prevent the builder device from tearing up the pre-confirmed commitment of the verifier device to the target transaction, the various steps of the blockchain transaction pre-confirmation verification method provided in the embodiment of the present application can be executed by the verifier device and the builder device, thereby ensuring that the transaction payload constructed by the builder device includes the pre-confirmed target transaction, thereby improving the security of the blockchain transaction.

[0044] See also Figure 1 , Figure 1 The present invention provides a flowchart of a blockchain transaction pre-confirmation verification method provided in an embodiment of the present invention. The blockchain transaction pre-confirmation verification method provided in an embodiment of the present invention can be applied to a verifier device and may include steps S101 to S102, which are described in detail as follows:

[0045] In S101, after receiving a pre-confirmation request for a target transaction, the transaction data of the target transaction is sent to the builder device to instruct the builder device to construct a transaction payload including the transaction data and data proof in the form of a Merkle tree based on the transaction data, and send the transaction payload to the verifier device.

[0046] In the embodiment of the present application, when the user wants to pre-confirm the target transaction, the user can send a pre-confirmation request for the target transaction to the verifier device. Specifically, the user can send the transaction data of the target transaction and the pre-confirmation request for the target transaction to the verifier device. The number of target transactions can be one or more.

[0047] After receiving pre-confirmation requests for several target transactions, the verifier device can pre-confirm each target transaction and send the transaction data of each target transaction to the builder device. Exemplarily, the verifier device can send the first hash of the transaction data of each target transaction to the builder device.

[0048] The verifier device sends the transaction data of several target transactions to the builder device, which can be used to instruct the builder device to build a transaction payload including the transaction data and data proof of each target transaction in the form of a Merkle tree according to the transaction data of each target transaction, and send the transaction payload to the verifier device.

[0049] It should be noted that the verifier device only instructs the builder device to construct a transaction payload containing the transaction data of each target transaction. In actual applications, the builder device may not execute the instructions of the verifier device, thereby constructing a transaction payload that does not include transaction data to tear up the verifier device's pre-confirmed commitment to the target transaction. Based on this, the builder device needs to generate a data proof to prove that the transaction payload constructed by the builder device includes the transaction data of each target transaction, so that the verifier device can determine that the transaction payload includes the transaction data of each target transaction based on the data proof.

[0050] Among them, the data proof in the transaction payload can be used to prove to the verifier device that the transaction payload includes the transaction data of each target transaction, that is, the verifier device can verify whether the transaction payload includes the transaction data of the target transaction based on the data proof in the transaction payload.

[0051] The Merkle Tree is a binary tree in which each leaf node contains the hash of the transaction data, and each non-leaf node is the hash value of its child node hash value. This structure allows for quick verification of data integrity and consistency.

[0052] Among them, the Merkle tree may include several first nodes and several second nodes, the first node may include the first hash of the transaction data of the target transaction, the first node may correspond to the target transaction one by one, that is, the number of first nodes may be the same as the number of target transactions, each first node may include the first hash of the transaction data of a target transaction, and in actual applications, the position of each first node in the Merkle tree can be determined according to preset rules; the second node may include a second hash for auxiliary verification, and in actual applications, the second hash of each second node may be generated according to a preset algorithm, and the position of each second node in the Merkle tree may also be determined according to preset rules.

[0053] See also Figure 2 , Figure 2 A schematic diagram of the structure of a Merkle tree provided in an embodiment of the present application. Figure 2 As shown, illustratively, the node with index number 8 / 11 / 14 in the Merkle tree may be the first node (i.e. Figure 2 In the Merkle tree, the nodes with index numbers 7 / 9 / 10 / 12 / 13 can be the second nodes (i.e. Figure 2 "hash[7]", "hash[9]", "hash

[10] ", "hash

[12] ", and "hash

[13] ").

[0054] Each first node includes a first hash of transaction data of a target transaction. For example, the first node with index number 8 includes the first hash of transaction data of the first target transaction, the first node with index number 11 includes the first hash of transaction data of the second target transaction, and the first node with index number 14 includes the first hash of transaction data of the third target transaction. In addition, each second node includes a second hash for auxiliary verification.

[0055] It should be noted that Figure 2 The index of each first node in the Merkle tree (that is, the position of each first node in the Merkle tree) and the index of each second node (that is, the position of each second node in the Merkle tree) are only used as examples. In actual applications, the index of each first node and the index of each second node in the Merkle tree can be set by the builder device according to actual needs.

[0056] The data proof in the transaction payload includes the first hash of each first node, the index of each first node, the second hash of each second node, the index of each second node, and the first root hash in the Merkle tree. The first root hash is calculated by the builder device according to the first hash of each first node, the index of each first node, the second hash of each second node, and the index of each second node after the builder device determines the first hash of each first node, the index of each first node, the second hash of each second node, and the index of each second node.

[0057] In S102, after receiving the transaction payload, it is verified based on the data proof whether the transaction payload includes the transaction data.

[0058] In an embodiment of the present application, after receiving the transaction payload sent by the builder device, the verifier device can verify whether the transaction payload includes transaction data based on the data proof in the transaction payload.

[0059] Specifically, the verifier device can determine the second root hash based on the first hash of each first node, the index of each first node, the second hash of each second node and the index of each second node included in the data proof. After determining the second root hash, the verifier device can compare the second root hash with the first root hash included in the data proof.

[0060] If the second root hash determined by the verifier device is consistent with the first root hash in the data proof, the verifier device can determine that the transaction payload includes the transaction data of the target transaction.

[0061] If the second root hash determined by the verifier device is inconsistent with the first root hash in the data proof, the verifier device can determine that the transaction payload does not include the transaction data of the target transaction.

[0062] The following is an explanation of the principle by which the verifier device can determine whether the transaction payload includes the transaction data of the target transaction based on whether the second root hash is consistent with the first root hash:

[0063] Since the hash of any node in the Merkle tree changes, the root hash of the Merkle tree will also change. Therefore, if the second root hash calculated by the verifier device based on the first hash of each first node, the index of each first node, the second hash of each second node and the index of each second node is consistent with the first root hash given by the builder, then it can be considered that the first hash of each first node, the index of each first node, the second hash of each second node and the index of each second node in the Merkle tree are correct, and it can be proved that the first node in the Merkle tree includes the first hash of the transaction data of the target transaction.

[0064] After the verifier device determines that the transaction payload includes the transaction data of the target transaction, the verifier device may broadcast the transaction payload.

[0065] From the above, it can be seen that the blockchain transaction pre-confirmation verification method provided by the embodiment of the present application can be applied to the verifier device, specifically including: after receiving the pre-confirmation request for the target transaction, sending the transaction data of the target transaction to the builder device to instruct the builder device to construct a transaction load including transaction data and data proof in the form of a Merkle tree according to the transaction data, and send the transaction load to the verifier device. After receiving the transaction load, the verifier device verifies whether the transaction data is included in the transaction load according to the data proof. Through the blockchain transaction pre-confirmation verification method provided by the embodiment of the present application, the verifier device can verify whether the transaction load constructed by the builder includes the pre-confirmed target transaction, so that the transaction load can be broadcast after ensuring that the pre-confirmed target transaction is included in the transaction load, thereby preventing the builder device from tearing up the pre-confirmation commitment of the verifier device to the target transaction, and improving the security of blockchain transactions.

[0066] In the prior art, the builder device usually builds a transaction load in the form of a transaction bundle based on the transaction data of the target transaction. The verifier can verify whether the transaction load includes the transaction data of the target transaction by verifying the hash of the transaction bundle. However, since the target transactions in the transaction bundle cannot be sorted independently, the overall value of the blockchain is damaged, and the verifier device is not clear about the index of each target transaction. The blockchain transaction pre-confirmation verification method provided by the embodiment of the present application can make each different first node store the first hash of the transaction data of each target transaction, thereby improving the overall value of the blockchain. In addition, the verifier device can also know the index of each target transaction.

[0067] See also Figure 3 , Figure 3 This is a flowchart of an implementation method of a blockchain transaction pre-confirmation verification method provided by another embodiment of the present application. The blockchain transaction pre-confirmation verification method provided by the embodiment of the present application can be applied to a builder device and may include step S201, which is described in detail as follows:

[0068] In S201, after receiving the transaction data of the target transaction sent by the verifier device, a transaction payload including the transaction data and the data proof is constructed in the form of a Merkle tree according to the transaction data, and the transaction payload is sent to the verifier device to instruct the verifier device to verify whether the transaction data is included in the transaction payload according to the data proof.

[0069] In an embodiment of the present application, after receiving the transaction data of the target transaction sent by the verifier device, the builder device can construct a transaction load including transaction data and data proof in the form of a Merkle tree according to the transaction data of each target transaction. The transaction data of the target transaction is sent to the builder device by the verifier device after receiving the pre-confirmation request for the target transaction, the data proof is used to prove that the transaction load includes the transaction data, the Merkle tree includes a first node and a second node, the first node includes a first hash of the transaction data, the second node includes a second hash for auxiliary verification, and the data proof includes a first root hash, a first hash of the first node, an index of the first node, a second hash of the second node, and an index of the second node.

[0070] Specifically, the builder device can first determine the positions of each first node and each second node in the Merkle tree. In one possible implementation, the first node can be first determined in each leaf node in the Merkle tree, wherein the number of determined first nodes can be the same as the number of target transactions.

[0071] by Figure 2 Taking the Merkle tree in as an example, if the number of target transactions is 3, any three leaf nodes among the leaf nodes can be selected as the first nodes. For example, the nodes with index numbers 8 / 11 / 14 in the Merkle tree can be selected as the first nodes.

[0072] After determining the first node, the builder device may determine the other leaf nodes except the first node among the leaf nodes as the second node. Figure 2 Taking the Merkle tree in as an example, after determining that the node with index number 8 / 11 / 14 in the Merkle tree is the first node, the node with index number 7 / 9 / 10 / 12 / 13 in the Merkle tree can be determined as the second node.

[0073] In addition, if the parent nodes of any two second nodes are the same, the parent nodes are used to replace the any two second nodes.

[0074] by Figure 2 Taking the Merkle tree in as an example, after the node with index number 7 / 9 / 10 / 12 / 13 in the Merkle tree is determined as the second node, it is found that the parent node of the second node with index number 9 / 10 in the Merkle tree is the same (the node with index number 4), then the node with index number 4 can replace the node with index number 9 / 10 as the second node, that is, the node with index number 7 / 4 / 12 / 13 can be determined as the second node.

[0075] By replacing the two second nodes belonging to the same branch with their parent nodes as the second nodes, the amount of calculation for the builder device to determine the first root hash can be reduced, and the amount of calculation for the verifier device to determine the second root hash can also be reduced, thereby improving the verification efficiency of blockchain transaction pre-confirmation.

[0076] After determining the positions of each first node and each second node in the Merkle tree in the above manner, the builder device can determine the index of each first node according to the position of each first node in the Merkle tree, and can determine the index of each second node according to the position of each second node in the Merkle tree.

[0077] After determining the positions of each first node and each second node in the Merkle tree, the builder device may also use the hash of the transaction data of the target transaction as the first hash of the first node. If there are multiple target transactions and first nodes, the builder device may use the hash of the transaction data of each target transaction as the first hash of the corresponding first node.

[0078] After determining the positions of each first node and each second node in the Merkle tree, the builder device may also generate a second hash of each second node in a preset manner.

[0079] After determining the first hash of each first node, the index of each first node, the second hash of each second node, and the index of each second node, the builder device can determine the first root hash based on the first hash of each first node, the index of each first node, the second hash of each second node, and the index of each second node.

[0080] After determining the first root hash, the builder device may also determine data proof according to the first root hash, the first hash of each first node, the index of each first node, the second hash of each second node, and the index of each second node.

[0081] After determining the data proof, the builder device can construct a transaction payload based on the transaction data and data proof of each target transaction, thereby constructing a transaction payload containing the transaction data and data proof, and send the transaction payload to the verifier device to instruct the verifier device to verify whether the transaction data is included in the transaction payload based on the data proof.

[0082] The specific implementation method of the verifier device verifying whether the transaction payload includes transaction data based on the data proof can be referred to Figure 1 The corresponding embodiments will not be described in detail here.

[0083] Based on the blockchain transaction pre-confirmation verification method provided in the above embodiment, the embodiments of the present application further provide a verifier device and a builder device for implementing the above method embodiments.

[0084] See also Figure 4 , Figure 4 A schematic diagram of the structure of a verifier device provided in an embodiment of the present application is shown in FIG. Figure 4 As shown, the verifier device 40 may include a first sending unit 41 and a verification unit 42, wherein:

[0085] The first sending unit 41 is used to send the transaction data of the target transaction to the builder device after receiving a pre-confirmation request for the target transaction, so as to instruct the builder device to build a transaction payload including the transaction data and the data proof in the form of a Merkle tree according to the transaction data, and send the transaction payload to the verifier device; wherein the data proof is used to prove that the transaction payload includes the transaction data, the Merkle tree includes a first node and a second node, the first node includes a first hash of the transaction data, the second node includes a second hash for auxiliary verification, and the data proof includes a first root hash, a first hash of the first node, an index of the first node, a second hash of the second node, and an index of the second node.

[0086] The verification unit 42 is used to verify whether the transaction payload includes transaction data based on the data certificate after receiving the transaction payload.

[0087] Optionally, the verification unit 42 is specifically used for:

[0088] Determine a second root hash based on the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node;

[0089] If the second hash is consistent with the first hash, it is determined that the transaction payload includes transaction data.

[0090] See also Figure 5 , Figure 5 A schematic diagram of the structure of a builder device provided in an embodiment of the present application is shown in FIG. Figure 5 As shown, the builder device 50 may include a second sending unit 51, wherein:

[0091] The second sending unit 51 is used to construct a transaction payload including transaction data and data proof in the form of a Merkle tree according to the transaction data after receiving the transaction data of the target transaction sent by the verifier device, and send the transaction payload to the verifier device to instruct the verifier device to verify whether the transaction data is included in the transaction payload according to the data proof; wherein the transaction data is sent by the verifier device to the builder device after receiving the pre-confirmation request for the target transaction, the data proof is used to prove that the transaction payload includes the transaction data, the Merkle tree includes a first node and a second node, the first node includes a first hash of the transaction data, the second node includes a second hash for auxiliary verification, and the data proof includes a first root hash, a first hash of the first node, an index of the first node, a second hash of the second node, and an index of the second node.

[0092] Optionally, the second sending unit 51 is specifically configured to:

[0093] Determine the positions of the first node and the second node in the Merkle tree, and determine the index of the first node according to the position of the first node in the Merkle tree, and determine the index of the second node according to the position of the second node in the Merkle tree;

[0094] Using the hash of the transaction data as the first hash of the first node;

[0095] Generating a second hash of the second node in a predetermined manner;

[0096] Determine a first root hash according to a first hash of the first node, an index of the first node, a second hash of the second node, and an index of the second node;

[0097] Determining a data proof based on the first root hash, the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node;

[0098] Build transaction payload based on transaction data and data proof.

[0099] Optionally, the second sending unit 51 is specifically configured to:

[0100] A first node is determined in each leaf node of the Merkle tree, and other leaf nodes except the first node in each leaf node are determined as second nodes.

[0101] Optionally, the second sending unit 51 is specifically configured to:

[0102] If the parent nodes of any two second nodes are the same, the parent nodes are used to replace the any two second nodes.

[0103] See also Figure 6 , Figure 6This is a schematic diagram of the structure of a verifier device provided in another embodiment of the present application. Figure 6 As shown, the verifier device 6 provided in this embodiment may include: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60. For example, a program corresponding to the verification method for pre-confirmation of blockchain transactions. When the processor 60 executes the computer program 62, the steps in the verification method embodiment for pre-confirmation of blockchain transactions are implemented, for example Figure 1 In S101 to S102 shown, the processor 60 executes the computer program 62 to implement the functions of each module / unit in the embodiment corresponding to the above-mentioned verifier device 50, for example Figure 4 The functions of the units 41-42 are shown.

[0104] Exemplarily, the computer program 62 may be divided into one or more modules / units, one or more modules / units are stored in the memory 61, and are executed by the processor 60 to complete the present application. The one or more modules / units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 62 in the verifier device 6. For example, the computer program 62 may be divided into the first sending unit 41 and the verification unit 42. For the specific functions of each unit, please refer to Figure 4 The relevant descriptions in the corresponding embodiments are not repeated here.

[0105] Those skilled in the art will understand that Figure 6 The authenticator device 6 is merely an example and does not constitute a limitation on the authenticator device 6 , which may include more or less components than those shown in the figure, or may combine certain components, or may include different components.

[0106] See also Figure 7 , Figure 7 This is a schematic diagram of the structure of a builder device provided in another embodiment of the present application. Figure 7 As shown, the builder device 7 provided in this embodiment may include: a processor 70, a memory 71, and a computer program 72 stored in the memory 71 and executable on the processor 70. For example, a program corresponding to the verification method for pre-confirmation of blockchain transactions. When the processor 70 executes the computer program 72, the steps in the verification method embodiment for pre-confirmation of blockchain transactions are implemented, for example Figure 2 In S201 shown, the processor 70 executes the computer program 72 to implement the functions of each module / unit in the embodiment corresponding to the builder device 60, for example Figure 5 The functionality of unit 51 is shown.

[0107] Exemplarily, the computer program 72 may be divided into one or more modules / units, one or more modules / units are stored in the memory 71 and executed by the processor 70 to complete the present application. One or more modules / units may be a series of computer program instruction segments that can complete specific functions, and the instruction segments are used to describe the execution process of the computer program 72 in the builder device 7. For example, the computer program 72 may be divided into the second sending unit 2, and the specific functions of each unit may be referred to in Figure 5 The relevant descriptions in the corresponding embodiments are not repeated here.

[0108] Those skilled in the art will understand that Figure 7 The builder device 7 is merely an example and does not constitute a limitation of the builder device 7 , and may include more or less components than shown in the figure, or combine certain components, or different components.

[0109] The processor 60 and the processor 70 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0110] The memory 61 and the memory 71 may be internal storage units of the verifier device 6 and the builder device 7, such as a hard disk or memory of the verifier device 6 and the builder device 7. The memory 61 and the memory 71 may also be external storage devices of the verifier device 6 and the builder device 7, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card or a flash card, etc., equipped on the verifier device 6 and the builder device 7. Further, the memory 61 and the memory 71 may also include both internal storage units and external storage devices of the verifier device 6 and the builder device 7. The memory 61 and the memory 71 are used to store computer programs and other programs and data required by electronic devices. The memory 61 and the memory 71 may also be used to temporarily store data that has been output or is to be output.

[0111] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units as needed, that is, the internal structure of the verifier device and the builder device can be divided into different functional units to complete all or part of the functions described above. The functional units in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0112] An embodiment of the present application also provides a blockchain transaction pre-confirmation verification system, which may include a verifier device 6 and a builder device 7.

[0113] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0114] An embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device, the terminal device implements the steps in the above-mentioned various method embodiments.

[0115] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0116] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0117] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A blockchain transaction pre-confirmation verification method, characterized in that: Applied to a verifier device, the method comprises: After receiving a pre-confirmation request for a target transaction, the transaction data of the target transaction is sent to a builder device to instruct the builder device to construct a transaction payload including the transaction data and a data proof in the form of a Merkle tree according to the transaction data, and send the transaction payload to the verifier device; wherein the data proof is used to prove that the transaction payload includes the transaction data, the Merkle tree includes a first node and a second node, the first node includes a first hash of the transaction data, the second node includes a second hash for auxiliary verification, and the data proof includes a first root hash, the first hash of the first node, an index of the first node, the second hash of the second node, and an index of the second node; After receiving the transaction payload, verify whether the transaction data is included in the transaction payload according to the data proof.

2. The method according to claim 1, characterized in that The verifying, based on the data proof, whether the transaction payload includes the transaction data comprises: Determine a second root hash according to the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node; If the second root hash is consistent with the first root hash, it is determined that the transaction payload includes the transaction data.

3. A blockchain transaction pre-confirmation verification method, characterized in that: Applied to a builder device, the method comprises: After receiving the transaction data of the target transaction sent by the verifier device, a transaction payload including the transaction data and a data proof is constructed in the form of a Merkle tree according to the transaction data, and the transaction payload is sent to the verifier device to instruct the verifier device to verify whether the transaction data is included in the transaction payload according to the data proof; wherein the transaction data is sent by the verifier device to the builder device after receiving a pre-confirmation request for the target transaction, the data proof is used to prove that the transaction data is included in the transaction payload, the Merkle tree includes a first node and a second node, the first node includes a first hash of the transaction data, the second node includes a second hash for auxiliary verification, and the data proof includes a first root hash, the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node.

4. The method according to claim 3, characterized in that The step of constructing a transaction payload including the transaction data and the data proof in the form of a Merkle tree according to the transaction data includes: Determine positions of the first node and the second node in the Merkle tree, and determine an index of the first node according to the position of the first node in the Merkle tree, and determine an index of the second node according to the position of the second node in the Merkle tree; Using the hash of the transaction data as the first hash of the first node; Generating the second hash of the second node in a preset manner; Determine the first root hash according to the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node; determining the data proof according to the first root hash, the first hash of the first node, the index of the first node, the second hash of the second node, and the index of the second node; The transaction payload is constructed according to the transaction data and the data proof.

5. The method according to claim 4, characterized in that The determining the positions of the first node and the second node in the Merkle tree includes: The first node is determined among the leaf nodes of the Merkle tree, and the other leaf nodes among the leaf nodes except the first node are determined as the second nodes.

6. The method according to claim 5, characterized in that After determining the other leaf nodes among the leaf nodes except the first node as the second node, the method further includes: If the parent nodes of any two of the second nodes are the same, the parent nodes are used to replace the any two of the second nodes.

7. A verifier device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the blockchain transaction pre-confirmation verification method as described in any one of claims 1 to 2 is implemented.

8. A builder device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the blockchain transaction pre-confirmation verification method as described in any one of claims 3 to 6 is implemented.

9. A blockchain transaction pre-confirmation verification system, characterized in that: It comprises a verifier device as claimed in claim 7 and a builder device as claimed in claim 8.

10. A computer program product, when the computer program product is run on a computer device, enables the computer device to execute the blockchain transaction pre-confirmation verification method as described in any one of claims 1 to 2, or implement the blockchain transaction pre-confirmation verification method as described in any one of claims 3 to 6.

Citation Information

Patent Citations

  • Blockchain cross-chain transaction verification method based on multistage Merkel tree

    CN112702400A

  • Consensus method for collaborative government affair block chain

    CN112819433A

  • Block formation device and block formation method, node device and block confirmation method

    CN112955891A

  • Transaction data verification method and device based on block chain

    CN115860746A

  • Method and system for dynamic addition of blocks in a blockchain

    US20230128039A1