Blockchain transaction pre-confirmation verification method, device, system and program product

By using the Merkle tree structure and data proof in blockchain transactions, the verifier device and the builder device verify whether the transaction data is contained in the transaction payload, solving the problem of the builder device tearing up the pre-confirmed commitment and improving the security of blockchain transactions.

CN119477318BActive Publication Date: 2025-09-26HANGZHOU HIGH-TECH ZONE (BINJIANG) INSTITUTE OF BLOCKCHAIN & DATA SECURITY
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In blockchain transactions, the builder device may construct a transaction payload that does not include the transaction data of the target transaction, causing the pre-confirmation commitment of the verifier device to be torn up, thereby reducing the security of the blockchain transaction.

Method used

By using the Merkle tree structure between the verifier device and the builder device, a transaction payload containing transaction data and data proof is constructed, and the transaction payload is verified through the data proof to ensure that the transaction data is included in the transaction payload, ensuring that the pre-confirmed target transaction is included in the transaction payload.

Benefits of technology

Improves the security of blockchain transactions, prevents builder devices from tearing up the pre-confirmed commitments of verifier devices, and ensures that the transaction payload includes the pre-confirmed target transaction before broadcasting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119477318B_ABST
    Figure CN119477318B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of blockchain technology, and provides a verification method, device, system and program product for pre-confirmation of blockchain transactions. The method is applied to the verifier device, including: after receiving a pre-confirmation request for a target transaction, sending the transaction data of the target transaction to the builder device to instruct the builder device to construct a transaction payload containing transaction data and data proof in the form of a Merkle tree based on the transaction data, and sending the transaction payload to the verifier device; after receiving the transaction payload, verifying whether the transaction data is included in the transaction payload based on the data proof. Through the method of the present application, the verifier device can verify whether the transaction payload constructed by the builder includes the pre-confirmed target transaction, so that the transaction payload can be broadcast after ensuring that the pre-confirmed target transaction is included in the transaction payload, thereby improving the security of blockchain transactions.
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 blockchain transactions, users can send a pre-confirmation request for the target transaction to the verifier device to obtain the pre-confirmation commitment of the verifier device and the builder device on 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 construct 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, applied to a verifier device, the method comprising:

[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 based on 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 assisting 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 payload includes the transaction data based on the data proof.

[0008] Optionally, verifying, based on the data proof, whether the transaction payload includes the transaction data includes:

[0009] 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;

[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, applied to a builder device, the method comprising:

[0012] 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 based on 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 based on 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 data proof in the form of a Merkle tree based on the transaction data includes:

[0014] Determining positions of the first node and the second node in the Merkle tree, and determining an index of the first node according to the position of the first node in the Merkle tree, and determining 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 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;

[0018] determining the 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;

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

[0020] Optionally, determining 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 second nodes are the same, the parent nodes are used to replace the any two 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. When the processor executes the computer program, the verification method for pre-confirmation of blockchain transactions as described in any one of the first and second aspects 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 and second aspects 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, the steps in the blockchain transaction pre-confirmation verification method as described in any one of the first and second aspects above are 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 of 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 comprising: after receiving a pre-confirmation request for a target transaction, sending the transaction data of the target transaction to the builder device to instruct the builder device to construct a transaction payload containing transaction data and data proof in the form of a Merkle tree based on the transaction data, and sending the transaction payload to the verifier device. After receiving the transaction payload, the verifier device verifies whether the transaction data is included in the transaction payload based on 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 payload constructed by the builder includes the pre-confirmed target transaction. Therefore, after ensuring that the pre-confirmed target transaction is included in the transaction payload, the transaction payload can be broadcast, thereby preventing the builder device from tearing up the pre-confirmation commitment of the verifier device for 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 following briefly introduces the drawings required for use in the embodiments or descriptions of the prior art. 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 any creative work.

[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 according to 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 structural diagram 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" and "one or more" refer to one, two or more. The terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the definition of "first" and "second" features can explicitly or implicitly include one or more of the features.

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

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

[0042] The execution entities of the blockchain transaction pre-confirmation verification method provided in the embodiments 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-confirmation commitment of the verifier device for the target transaction, the verifier device and the builder device can execute the various steps of the blockchain transaction pre-confirmation verification method provided in the embodiment of the present application, 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 This is a flowchart of an implementation method for pre-confirmation of a blockchain transaction provided in an embodiment of the present application. The pre-confirmation verification method for a blockchain transaction provided in an embodiment of the present application can be applied to a verifier device and can include steps S101 to S102, which are detailed 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 an embodiment of the present application, when a user wishes to pre-confirm a target transaction, the user may send a pre-confirmation request for the target transaction to the verifier device. Specifically, the user may 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 may 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. For example, 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 containing the transaction data and data proof of each target transaction in the form of a Merkle tree based on 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-confirmation 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 where each leaf node contains the hash of the transaction data, while each non-leaf node is the hash of its child node hashes. 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-to-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. 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. In actual applications, the second hash of each second node can be generated according to a preset algorithm, and the position of each second node in the Merkle tree can also be determined according to preset rules.

[0053] See also Figure 2 , Figure 2 This is a schematic diagram of the structure of a Merkle tree provided in an embodiment of the present application. Figure 2 As shown, for example, the node with index number 8 / 11 / 14 in the Merkle tree can 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 the first hash of the transaction data of a target transaction. For example, the first node with index number 8 includes the first hash of the transaction data of the first target transaction, the first node with index number 11 includes the first hash of the transaction data of the second target transaction, and the first node with index number 14 includes the first hash of the 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 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 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 explains how the validator device determines whether the transaction payload includes the target transaction's transaction data based on whether the second hash and the first hash are consistent:

[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 payload containing transaction data and data proof in the form of a Merkle tree based on the transaction data, and sending the transaction payload to the verifier device. After receiving the transaction payload, the verifier device verifies whether the transaction data is included in the transaction payload based on 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 payload constructed by the builder includes the pre-confirmed target transaction. Therefore, after ensuring that the pre-confirmed target transaction is included in the transaction payload, the transaction payload can be broadcast, thereby preventing the builder device from tearing up the pre-confirmation commitment of the verifier device for the target transaction and improving the security of blockchain transactions.

[0066] In the prior art, a builder device typically constructs a transaction payload in the form of a transaction bundle based on the transaction data of a target transaction. A verifier can verify whether the transaction payload includes the transaction data of the target transaction by verifying the hash of the transaction bundle. However, since the individual target transactions in the transaction bundle cannot be independently sorted, the overall value of the blockchain is damaged, and the verifier device is also unclear about the index of each target transaction. However, the blockchain transaction pre-confirmation verification method provided by the embodiment of the present application can enable each different first node to 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 clearly understand the index of each target transaction.

[0067] See also Figure 3 , Figure 3 This is a flowchart of an implementation method for pre-confirmation of a blockchain transaction provided by another embodiment of the present application. The pre-confirmation verification method for a blockchain transaction provided by an embodiment of the present application can be applied to a builder device and can include step S201, which is detailed 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 based on 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 based on 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 payload including the transaction data and the data proof in the form of a Merkle tree based on 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 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, and the second node includes a second hash for auxiliary verification. 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 among 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 to be determined as the first nodes. For example, the nodes with index numbers 8 / 11 / 14 in the Merkle tree can be selected to be determined as the first nodes.

[0072] After determining the first node, the builder device can 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 nodes with index numbers 8 / 11 / 14 in the Merkle tree are the first nodes, the nodes with index numbers 7 / 9 / 10 / 12 / 13 in the Merkle tree can be determined as the second nodes.

[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 parent nodes of two second nodes belonging to the same branch as the second nodes, the amount of calculation required by the builder device to determine the first root hash can be reduced, and the amount of calculation required by 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 based on the position of each first node in the Merkle tree, and can determine the index of each second node based on 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 further 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 further determine data proof based on 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 data is included in the transaction payload 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 as follows: 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 construct a transaction payload including the transaction data and the data proof in the form of a Merkle tree based on 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, the index of the first node, the second hash of the second node, and the index of the second node.

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

[0087] Optionally, the verification unit 42 is specifically configured to:

[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 based on 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 based on 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 positions of the first node and the second node in the Merkle tree, and determine an index of the first node based on the position of the first node in the Merkle tree, and determine an index of the second node based on the position of the second node in the Merkle tree;

[0094] Use 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 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;

[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 among each leaf node of the Merkle tree, and other leaf nodes except the first node among 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 embodiment of the verification method for pre-confirmation of blockchain transactions are implemented, such as 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] For example, the computer program 62 may be divided into one or more modules / units, one or more modules / units being stored in the memory 61 and executed by the processor 60 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing 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. The specific functions of each unit can be found in 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 limit the authenticator device 6 , and may include more or fewer components than shown in the figure, or may combine certain components, or may include different components.

[0106] See also Figure 7 , Figure 7 This is a structural diagram 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 embodiment of the verification method for pre-confirmation of blockchain transactions are implemented, such as Figure 2 As shown in S201, 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, such as Figure 5 The function of the unit 51 is shown.

[0107] For example, the computer program 72 can 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 can 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 can be divided into the second sending unit 2, and the specific functions of each unit can be referred to in the following table. 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 limit the builder device 7 , and may include more or fewer 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, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (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] Memory 61 and memory 71 can be internal storage units of the verifier device 6 and builder device 7, such as the hard disk or memory of the verifier device 6 and builder device 7. Memory 61 and memory 71 can also be external storage devices of the verifier device 6 and builder device 7, such as plug-in hard disks, smart media cards (SMCs), secure digital (SD) cards, or flash cards equipped on the verifier device 6 and builder device 7. Furthermore, memory 61 and memory 71 can include both internal storage units and external storage devices of the verifier device 6 and builder device 7. Memory 61 and memory 71 are used to store computer programs and other programs and data required by electronic devices. Memory 61 and memory 71 can also be used to temporarily store data that has been output or is about 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 distributed and completed by 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 one processing unit, or each unit can exist physically alone, 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 run 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 focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.

[0116] Those skilled 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 beyond the scope of this application.

[0117] The above-described embodiments 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, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.

Claims

1. A blockchain transaction pre-confirmation verification method, characterized in that: Applied to a verifier device, the method includes: 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 based on 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 assisting 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 payload includes the transaction data based on 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 includes: 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; 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 the data proof is constructed in the form of a Merkle tree based on 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 based on 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 based on the transaction data includes: Determining positions of the first node and the second node in the Merkle tree, and determining an index of the first node according to the position of the first node in the Merkle tree, and determining 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 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; determining the 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; The transaction payload is constructed according to the transaction data and the data proof.

5. The method according to claim 4, characterized in that Determining 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 leaf nodes other than the first node among the leaf nodes as the second nodes, the method further includes: If the parent nodes of any two second nodes are the same, the parent nodes are used to replace the any two second nodes.

7. 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 according to 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, wherein: When the processor executes the computer program, it implements the blockchain transaction pre-confirmation verification method as described in any one of claims 3 to 6.

9. A blockchain transaction pre-confirmation verification system, characterized in that: The method comprises the verifier device according to claim 7 and the builder device according to 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

  • Consensus method for collaborative government affair block chain

    CN112819433A

  • Transaction data verification method and device based on block chain

    CN115860746A