Transaction confirmation method, system, device and computer equipment
By using multiple verification mechanisms and intelligent manager verification in blockchain transactions, the problem of inaccurate transaction verification caused by malicious consensus nodes is solved and the reliability and security of transactions are improved.
Patent Information
- Application Number
- CN202011345706.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-26
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2040-11-26
AI Technical Summary
In blockchain transactions, malicious consensus nodes lead to inaccurate transaction verification results and lack of reliability and security.
Verify twice through the voting mechanism of multiple councilor nodes and target nodes to ensure that both the first and second verification results of the transaction pass, generate blocks and add them to the blockchain, and use smart managers for smart contract verification and node identity verification to improve the reliability and security of transactions.
It improves the reliability and security of transaction confirmation, prevents malicious operations, and ensures the accuracy and integrity of transaction results.
Smart Images

Figure CN112398949B
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a transaction confirmation method, system, device, computer equipment and storage medium. Background Art
[0002] When conducting blockchain-based transactions, it is usually necessary to verify the transactions through a blockchain consensus algorithm to improve the security of the transactions in the event of errors in some blockchain nodes.
[0003] With current technology, there is a situation where most users collude to form malicious consensus nodes, resulting in inaccurate verification results of transactions. Summary of the invention
[0004] Based on this, it is necessary to provide a transaction confirmation method, system, device, computer equipment and storage medium to address the technical problem of inaccurate transaction verification results in current technologies.
[0005] A transaction confirmation method, the method comprising:
[0006] Get pending transactions;
[0007] The transaction to be confirmed is first verified by multiple councillor nodes, and the transaction to be confirmed is second verified by multiple target nodes; the multiple councillor nodes are selected from multiple nodes of the blockchain based on a voting mechanism; the multiple target nodes are randomly determined from multiple node groups, and the multiple target nodes correspond to the multiple node groups one by one;
[0008] If the verification results of the first verification and the second verification are both passed, a block corresponding to the transaction to be confirmed is generated and added to the blockchain.
[0009] In one embodiment, the first verification process of the transaction to be confirmed by multiple councillor nodes includes:
[0010] From the multiple nodes, multiple councillor nodes are determined based on voting;
[0011] Sorting the plurality of councillor nodes, and determining a chairperson node and a plurality of rotating councillor nodes from the plurality of councillor nodes according to the sorting result;
[0012] For the pending transaction, the corresponding proposal block is generated and broadcasted through the speaker node;
[0013] Obtain the verification result information of each rotating member node on the proposal block broadcast;
[0014] If the ratio of the number of rotating councillor nodes that publish the broadcast message of passed verification to the number of current rotating councillor nodes reaches a first threshold, it is determined that the first verification result of the transaction to be confirmed is passed verification.
[0015] In one embodiment, the sorting of the plurality of councillor nodes comprises:
[0016] Obtain address hash values corresponding to the multiple congressman nodes respectively;
[0017] The multiple councillor nodes are sorted according to the address hash values.
[0018] In one embodiment, the performing a second verification process on the transaction to be confirmed by multiple target nodes includes:
[0019] The nodes in the blockchain are grouped, and the nodes that meet the preset association relationship are grouped into one group to obtain multiple node groups;
[0020] A target node is randomly selected from each node group to obtain multiple target nodes;
[0021] For the transaction to be confirmed, if the ratio of the number of target nodes that publish broadcast messages with passed verification among the multiple target nodes relative to all target nodes reaches a second threshold, it is determined that the second verification result for the transaction to be confirmed is passed.
[0022] In one embodiment, if the verification results of the first verification and the second verification are both passed, generating a block corresponding to the transaction to be confirmed and adding it to the blockchain includes:
[0023] If the results of the first verification and the second verification are both verified to be passed, the smart contract verification, the identity of the councillor node and the identity of the target node corresponding to the transaction to be confirmed are performed through the preset smart manager. If all the verifications are successful, a message of successful verification is broadcast;
[0024] If the intelligent manager broadcasts a verification success message for the transaction to be confirmed, it controls the machine with a preset intelligent contract to execute the corresponding intelligent contract to generate a block corresponding to the transaction to be confirmed and add it to the blockchain.
[0025] In one embodiment, before controlling a machine preset with a smart contract to execute a corresponding smart contract, the method further includes:
[0026] Acquire a machine verified by the smart manager;
[0027] Send the corresponding smart contract to the verified machine.
[0028] A transaction confirmation system, comprising: a verifier, an intelligent manager and a machine with a preset intelligent contract; the verifier comprises a plurality of councillor nodes and a plurality of target nodes;
[0029] The plurality of councillor nodes are selected from a plurality of nodes of the blockchain based on a voting mechanism and are used to perform a first verification process on the transaction to be confirmed;
[0030] The multiple target nodes are randomly determined from multiple node groups, and the multiple target nodes correspond to the multiple node groups one by one; the multiple target nodes are used to perform a second verification process on the transaction to be confirmed;
[0031] The smart manager is used to perform corresponding smart contract verification, congressman node identity and target node identity verification on the transaction to be confirmed if the verification results of the first verification and the second verification are both passed, and broadcast a verification success message if all the verifications are successful;
[0032] The machine is used to execute the corresponding smart contract to generate a block corresponding to the transaction to be confirmed and add it to the blockchain if the message broadcast by the smart manager for the transaction to be confirmed is a successful verification message.
[0033] A transaction confirmation device, comprising:
[0034] Transaction acquisition module, used to obtain transactions to be confirmed;
[0035] A transaction verification module, configured to perform a first verification process on the transaction to be confirmed through a plurality of councillor nodes, and to perform a second verification process on the transaction to be confirmed through a plurality of target nodes; the plurality of councillor nodes are selected from a plurality of nodes of the blockchain based on a voting mechanism; the plurality of target nodes are randomly selected from a plurality of node groups, and the plurality of target nodes correspond one to one to the plurality of node groups;
[0036] The block generation module is used to generate a block corresponding to the transaction to be confirmed and add it to the blockchain if the verification results of the first verification and the second verification are both passed.
[0037] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the transaction confirmation method in any of the above embodiments when executing the computer program.
[0038] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the transaction confirmation method in any of the above embodiments.
[0039] The transaction confirmation method, system, device, computer equipment and storage medium obtain the transaction to be confirmed, perform a first verification process on the transaction to be confirmed through multiple councilor nodes, and perform a second verification process on the transaction to be confirmed through multiple target nodes. If the verification results of the first verification and the second verification are both verified, a block corresponding to the transaction to be confirmed is generated and added to the blockchain, wherein the multiple councilor nodes are selected from multiple nodes of the blockchain based on a voting mechanism, and the multiple councilor nodes are randomly determined from multiple node groups, so that the transaction to be confirmed is verified twice by a combination of nodes from different sources, thereby improving the reliability of transaction confirmation. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A structural diagram of a transaction confirmation system in one embodiment;
[0041] Figure 2 A flowchart of a transaction confirmation method in one embodiment;
[0042] Figure 3 A flowchart of a transaction confirmation method in another embodiment;
[0043] Figure 4 A schematic diagram of blockchain system authentication in one embodiment;
[0044] Figure 5 A schematic diagram of blockchain system authentication in another embodiment;
[0045] Figure 6 A schematic diagram of a blockchain system authentication process in one embodiment;
[0046] Figure 7 is a structural block diagram of a transaction confirmation device in one embodiment;
[0047] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] It should be noted that the terms "first\second" involved in the embodiments of the present invention are only used to distinguish similar objects, and do not represent a specific order for the objects. It is understandable that "first\second" can be interchanged with a specific order or sequence where permitted. It should be understood that the objects distinguished by "first\second" can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.
[0050] In one embodiment, Figure 1 As shown, a transaction confirmation system is provided, including a verifier, an intelligent manager, and a machine with a preset intelligent contract.
[0051] Among them, blockchain transactions can be transactions based on smart contracts. Smart contracts can be contracts that specify operations that must be performed under proven conditions. For example, it can be a document that specifies "what should be delivered to whom" according to a group of rules to obtain the correct result. Transactions based on smart contracts can be conducted free of charge. For example, user A pays user B $2 for bill exchange. User A must first pay $2 according to the established rules, and then the smart contract checks whether the $2 has reached user B. If it has, the bill will be handed over to user A.
[0052] The verifier may be a blockchain node in the blockchain system that has been verified by the intelligent manager, and is used to confirm transactions generated in the blockchain. Depending on the verification stage and generation mechanism of each blockchain node in transaction confirmation, multiple councilor nodes and multiple target nodes may be included. Multiple councilor nodes may be selected from multiple nodes of the blockchain based on a voting mechanism, and used to perform a first verification process on the transaction to be confirmed. Multiple target nodes may be randomly determined from multiple node groups of the blockchain, and multiple target nodes may correspond one-to-one to multiple node groups, and multiple target nodes may be used to perform a second verification process on the transaction to be confirmed. In some embodiments, the first verification may be performed in the private chain generated by the transaction to be confirmed, and the second verification may be performed in multiple node groups of the entire blockchain system.
[0053] The smart manager can manage the relationship between the blockchain and the machine. On the one hand, the smart manager can confirm whether the smart contract has been verified by the verifier, and on the other hand, it can confirm whether the verifier is authorized to prevent malicious operations and ensure the correct execution of the smart contract. If the verification results of the first verification and the second verification are both passed, the smart manager can perform corresponding smart contract verification, congressman node identity and target node identity verification on the transaction to be confirmed. If all verifications are successful, the verification success message will be broadcast on the blockchain.
[0054] Machines can be used to obtain preset smart contracts and execute verified smart contracts in the blockchain. They can include iot devices (Internet of Things), low-power devices and small storage devices, as well as devices with small storage space to perform simple functions according to commands. If the smart manager broadcasts a successful verification message for the pending transaction, the machine can execute the corresponding smart contract to generate a block corresponding to the pending transaction and add it to the blockchain. In addition, the machine needs to be verified by the administrator of the smart manager before it can participate in blockchain transactions.
[0055] The above transaction confirmation system performs two verifications through a combination of nodes from different sources, which improves the reliability of transaction verification, further verifies smart contracts and verifiers based on the smart manager, and authenticates the machines involved in the transaction to avoid unnecessary access operations, further improving transaction security and integrity.
[0056] In one embodiment, Figure 2 As shown, a transaction confirmation method is provided, which is described by taking the method applied to the intelligent manager as an example, and includes the following steps:
[0057] Step S201, obtaining transactions to be confirmed.
[0058] In a specific implementation, the intelligent manager can obtain the corresponding transactions to be confirmed from each machine in the blockchain system.
[0059] Step S202, performing a first verification process on the transaction to be confirmed through multiple councilor nodes, and performing a second verification process on the transaction to be confirmed through multiple target nodes;
[0060] Among them, the blockchain system may include multiple nodes, and two verification processes are performed based on the multiple nodes. The blockchain nodes used in the two verification processes may be different or partially repeated. Multiple councilor nodes may be selected from multiple nodes of the blockchain based on a voting mechanism. The multiple councilor nodes may be nodes of a private chain where the transaction to be confirmed is located, or nodes in the blockchain system. Multiple target nodes may be randomly determined from multiple node groups, and the multiple target nodes correspond to the multiple node groups one by one. Multiple node groups may be generated based on the grouping of each node of the blockchain according to preset rules. The multiple node groups may include nodes used for the first verification and other nodes, or may not include nodes used for the first verification, so that the nodes participating in the two verifications are distinguished from each other, which increases the randomness of node selection, avoids malicious collusion, and improves the reliability of the verification results.
[0061] In a specific implementation, the intelligent manager can select multiple councilor nodes for the first verification process based on the voting mechanism according to the transaction to be confirmed, and select one-to-one corresponding target nodes from multiple node groups for the second verification process to obtain the verification results of the first verification and the second verification.
[0062] Step S203: If the verification results of the first verification and the second verification are both passed, a block corresponding to the transaction to be confirmed is generated and added to the blockchain.
[0063] Among them, the verification results of the first verification and the second verification can be determined according to the voting situation of the corresponding nodes in each verification process. The intelligent manager can pre-set the consensus mechanism. If the verification result of the verification meets the consensus mechanism, the verification is passed. For example, the intelligent manager can set the nodes participating in the verification to meet the majority of consent for the verification to pass.
[0064] In a specific implementation, the intelligent manager can generate a corresponding block based on the verification results of the first verification and the second verification, and if both verifications are successful, the transaction to be confirmed is successful. The intelligent manager can generate a corresponding block based on the transaction to be confirmed and add it to the blockchain for storage.
[0065] In the above transaction confirmation method, by obtaining the transaction to be confirmed, a first verification process is performed on the transaction to be confirmed through multiple councilor nodes, and a second verification process is performed on the transaction to be confirmed through multiple target nodes. If the verification results of the first verification and the second verification are both verified, a block corresponding to the transaction to be confirmed is generated and added to the blockchain, wherein the multiple councilor nodes are selected from multiple nodes of the blockchain based on a voting mechanism, and the multiple councilor nodes are randomly determined from multiple node groups, so that the transaction to be confirmed is verified twice by a combination of nodes from different sources, thereby improving the reliability of transaction confirmation.
[0066] In one embodiment, the step of determining to perform a first verification process on the transaction to be confirmed through multiple councillor nodes in step S202 includes:
[0067] Determine multiple councilor nodes from multiple nodes based on voting; sort the multiple councilor nodes, and determine a speaker node and several rotating councilor nodes from the multiple councilor nodes based on the sorting result; generate and broadcast a corresponding proposal block through the speaker node for the transaction to be confirmed; obtain verification result information of the proposal block broadcast by each rotating councilor node; if the ratio of the number of rotating councilor nodes that publish the broadcast message of passed verification relative to the number of current rotating councilor nodes reaches a first threshold, determine that the first verification result of the transaction to be confirmed is passed verification.
[0068] In this embodiment, the intelligent manager can determine multiple councilor nodes based on voting, and perform the first verification based on multiple councilor nodes. The ranking of councilor nodes can be performed based on the characteristic parameters of the nodes, and the speaker node and multiple rotating councilor nodes can be determined based on the ranking results. The characteristic parameters can be the address hash value of each councilor node, the voting results of the previous round, etc. The speaker node can be used to package the transactions to be confirmed, generate a proposal block, and broadcast it to all councilor nodes. The speaker node can also calculate the councilor nodes for the next round based on the current voting situation. The speaker node can rotate, and multiple councilor nodes other than the speaker node can be rotating councilor nodes. Each rotating councilor node can verify the received proposal block, and after verification, sign and broadcast the verification result message. The first threshold can represent the proportion of the number of councilor nodes that have passed the signature required for the first verification to pass. For example, the intelligent manager can set that when two-thirds of the councilor nodes pass the signature, the proposal block passes. The intelligent manager can generate a formal block based on the proposal block after the first transaction verification passes.
[0069] In one embodiment, the first verification can be verified by the DBFT algorithm (Delegated Byzantine Fault Tolerant). DBFT can select dedicated validators (consensus nodes) based on the proportion of equity held, and then the validators reach a consensus through the Byzantine fault tolerance algorithm (i.e., the voting mechanism of minority obeys majority) to determine the dynamic participating nodes. DBFT can tolerate any type of errors, and multiple dedicated validators make each block final and will not fork.
[0070] The scheme of the above-mentioned embodiment selects multiple councilor nodes by voting, determines the speaker node to generate a proposal block corresponding to the transaction to be confirmed according to the sorting result, and determines the rotating councilor node to verify the proposal block. The verification is passed when the ratio of the number of verified nodes of each rotating councilor reaches a first threshold. The transaction to be confirmed is verified by multiple councilor nodes, thereby improving the reliability of verification.
[0071] In one embodiment, the step of sorting the plurality of councillor nodes includes:
[0072] Obtain the address hash values corresponding to multiple councilor nodes respectively; sort the multiple councilor nodes according to the address hash values.
[0073] In this embodiment, a node may correspond to a node address, which may be represented by a hash value. The intelligent manager may sort the address hash values of each node in ascending or descending order to obtain a sorting result, and select the desired speaker node from the sorting result. For example, the intelligent manager may sort the address hash values of each member node in descending order, select the first one as the speaker node, and the other members nodes as rotating members nodes.
[0074] The scheme of the above embodiment is to sort the address hash values of the parliamentarian nodes to obtain the sorting results, determine the corresponding speaker node, and improve the objectivity of obtaining the sorting results.
[0075] In one embodiment, the step of performing a second verification process on the transaction to be confirmed by multiple target nodes in step S202 includes:
[0076] The nodes in the blockchain are grouped, and the nodes satisfying a preset association relationship are grouped together to obtain a plurality of node groups; a target node is randomly selected from each node group to obtain a plurality of target nodes; for a transaction to be confirmed, if the ratio of the number of target nodes that publish broadcast messages that pass the verification relative to the number of all target nodes among the plurality of target nodes reaches a second threshold, it is determined that the second verification result for the transaction to be confirmed is passed.
[0077] In this embodiment, the intelligent manager can perform a second verification on the transaction to be confirmed. The second verification can be performed after the first verification is passed, or it can be performed separately from the first verification.
[0078] The intelligent manager can group the nodes in the blockchain based on the grouping algorithm, and the preset association relationship can be the association relationship between the nodes corresponding to the grouping algorithm, such as the node logical relationship, etc. Each node group can include multiple nodes, and the intelligent manager randomly determines a target node from them. The multiple target nodes obtained by the intelligent manager are highly random, avoiding the possibility of collusion between nodes and improving the reliability of verification. The intelligent manager can broadcast the transaction to be confirmed to each target node and obtain the verification information of each target node. The second verification can also set a corresponding second threshold to characterize the proportion of the number of target nodes that have passed the signature required for the second verification to pass. For example, the intelligent manager can set that when two-thirds of the target nodes pass the signature, the second verification is verified.
[0079] In one embodiment, the second verification may be performed by using a DBFT algorithm.
[0080] The solution of the above embodiment is to group blockchain nodes, randomly select a target node in each node group, and verify the transaction to be confirmed on each target node, so that the nodes participating in the verification are highly random, avoiding collusion between nodes and improving the reliability of verification.
[0081] In one embodiment, if the verification results of the first verification and the second verification in step S203 are both passed, the step of generating a block corresponding to the transaction to be confirmed and adding it to the blockchain includes:
[0082] If the verification results of the first verification and the second verification are both passed, the smart contract verification, the congressman node identity and the target node identity verification corresponding to the transaction to be confirmed are performed through the preset smart manager. If all the verifications are successful, a message of successful verification is broadcast; if the smart manager broadcasts a message of successful verification for the transaction to be confirmed, the machine with the preset smart contract is controlled to execute the corresponding smart contract to generate a block corresponding to the transaction to be confirmed and add it to the blockchain.
[0083] In this embodiment, the smart manager can verify the smart contract for the transaction to ensure that the content of the transaction to be confirmed meets the conditions of the smart contract. It can also authenticate the members' nodes and target nodes involved in the verification to ensure that the node has been authenticated and is legally connected to the blockchain system.
[0084] If the verification results of the first verification and the second verification are both passed, the pending transaction is verified. The smart manager can control the machine corresponding to the pending transaction through the smart manager, execute the corresponding smart contract, and generate a block corresponding to the pending transaction and add it to the blockchain. The smart manager can broadcast transaction information and update the blockchain.
[0085] In some embodiments, when the verification results of the first verification and the second verification are both passed, the intelligent manager can also generate a formal block based on the proposal block and upload it to the blockchain to improve the integrity of the transaction confirmation data.
[0086] In the scheme of the above embodiment, after both verifications are passed, the smart manager can perform smart contract verification, congressman node identity and target node identity verification through the smart manager, and control the corresponding machine to execute the corresponding smart contract, generate blocks, add them to the blockchain, and further verify the nodes involved in the verification and the content of the transactions to be confirmed, thereby ensuring the accuracy and security of transaction confirmation.
[0087] In one embodiment, before controlling a machine preset with a smart contract to execute a corresponding smart contract, the method further includes:
[0088] Get the machines that have passed the verification by the smart manager; send the corresponding smart contract to the verified machines.
[0089] In this embodiment, the machine that has passed the verification of the smart manager can execute the corresponding smart contract. The smart manager can send the smart contract required to execute the transaction to the machine. When the transaction to be confirmed passes the verification, the smart manager can control the machine to execute the corresponding smart contract, thereby improving the security and reliability of transaction execution.
[0090] In one embodiment, Figure 3 As shown, a transaction confirmation method is provided, the method comprising:
[0091] Step S301, obtaining transactions to be confirmed;
[0092] Step S302, performing a first verification process on the transaction to be confirmed, the first verification includes: determining multiple councilor nodes from multiple nodes based on voting; sorting the multiple councilor nodes according to the address hash values of the multiple councilor nodes, and determining a speaker node and several rotating councilor nodes from the multiple councilor nodes according to the sorting result; generating and broadcasting a corresponding proposal block through the speaker node for the transaction to be confirmed; obtaining verification result information broadcast by each rotating councilor node on the proposal block; if the ratio of the rotating councilor nodes that publish the broadcast message of passed verification relative to the current rotating councilor nodes reaches a first threshold, determining that the first verification result of the transaction to be confirmed is passed verification; the multiple councilor nodes are selected from multiple nodes of the blockchain based on a voting mechanism.
[0093] Step S303, performing a second verification process on the transaction to be confirmed, the second verification includes: grouping the nodes in the blockchain, grouping the nodes that meet the preset association relationship into one group, and obtaining multiple node groups; randomly selecting a target node from each node group to obtain multiple target nodes; for the transaction to be confirmed, if the ratio of the number of target nodes that publish the broadcast message of passed verification relative to the number of all target nodes among the multiple target nodes reaches a second threshold, the second verification result for the transaction to be confirmed is determined to be passed.
[0094] Step S304, if the verification results of the first verification and the second verification are both passed, the smart contract verification, the congressman node identity and the target node identity verification corresponding to the transaction to be confirmed are performed through the preset smart manager. If all the verifications are successful, a message of successful verification is broadcast; if the smart manager broadcasts a message of successful verification for the transaction to be confirmed, the machine with the preset smart contract is controlled to execute the corresponding smart contract to generate a block corresponding to the transaction to be confirmed and add it to the blockchain.
[0095] In the above-mentioned embodiment, by obtaining the transaction to be confirmed, a first verification process is performed by multiple councilor nodes, and a second verification process is performed by multiple target nodes, and according to the verification results of the first verification and the second verification, the smart contract corresponding to the transaction to be confirmed, the councilor node identity and the target node identity are verified, and the corresponding machine is controlled to execute the smart contract to generate a block, wherein the multiple councilor nodes are selected from multiple nodes of the blockchain based on a voting mechanism, and the multiple councilor nodes are randomly determined from multiple node groups, so that the transaction to be confirmed is verified twice by a combination of nodes from different sources, thereby improving the reliability of transaction confirmation, and further verifying each node and smart contract involved in the verification, thereby further improving the security of transaction confirmation.
[0096] It should be understood that the above steps can be completed by multiple entities in the blockchain system, or by a single entity, such as an intelligent manager. Figure 2-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-3 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0097] In order to more clearly illustrate the solution provided by the present application, the transaction confirmation method of the above embodiment of the present application is applied to Figure 4 and 5 It should be noted that the validators shown in the figure represent nodes managed by different users, not actual people.
[0098] like Figure 4 and 5As shown, the blockchain system may include a verifier, an intelligent manager, and a machine / device. Among them, the verifier may be a user verified by a central administrator, and the authorized user may initiate a transaction request according to the respective database request. After the verifier verifies the transaction, the requested block may be passed to the blockchain, a new block may be added, and the transaction may be approved. After the machine / device is verified by the intelligent manager, it is able to execute the smart contract agreed by the verifier. The device may include IoT devices, low-power devices, and small storage devices, as well as devices with small storage space to perform simple functions according to commands. The intelligent manager may manage the relationship between the blockchain and the machine. On the one hand, the intelligent manager may confirm whether the smart contract has been verified by the verifier, and on the other hand, it may confirm whether the verifier is authorized to prevent malicious operations and ensure the correct execution of the smart contract.
[0099] In this blockchain system, the smart manager can Figure 6 The smart contract corresponding to the smart manager transaction is broadcast and verified according to the block event generated by the transaction to be confirmed. The transaction to be confirmed is verified for the first DBFT verification and the second DBFT verification. In the two verifications, if the verifiers agree with the majority, the transaction to be confirmed is verified. The smart manager verifies the smart contract corresponding to the transaction to be confirmed and the identity of each node involved in the verification. After the verification is passed, the transaction block will be uploaded to the blockchain and the blockchain will be updated through broadcasting. The smart manager can control the corresponding machine / device to execute the corresponding transaction content according to the content of the smart contract, and generate blocks from the transaction content and upload them to the blockchain.
[0100] In one embodiment, Figure 7 As shown, a transaction confirmation device is provided, the device 700 includes:
[0101] The transaction acquisition module 701 is used to acquire the transaction to be confirmed;
[0102] The transaction verification module 702 is used to perform a first verification process on the transaction to be confirmed through a plurality of councillor nodes, and to perform a second verification process on the transaction to be confirmed through a plurality of target nodes; the plurality of councillor nodes are selected from a plurality of nodes of the blockchain based on a voting mechanism; the plurality of target nodes are randomly selected from a plurality of node groups, and the plurality of target nodes correspond to the plurality of node groups one by one;
[0103] The block generation module 703 is used to generate a block corresponding to the transaction to be confirmed and add it to the blockchain if the verification results of the first verification and the second verification are both passed.
[0104] In one embodiment, the transaction verification module 702 includes: a first verification unit, which is used to determine multiple councilor nodes from multiple nodes based on voting; sort the multiple councilor nodes, and determine a speaker node and several rotating councilor nodes from the multiple councilor nodes according to the sorting result; generate and broadcast a corresponding proposal block for the transaction to be confirmed through the speaker node; obtain verification result information broadcast by each rotating councilor node on the proposal block; if the ratio of the number of rotating councilor nodes that publish the broadcast message of passed verification relative to the number of current rotating councilor nodes reaches a first threshold, determine that the first verification result of the transaction to be confirmed is passed verification.
[0105] In one embodiment, the first verification unit is further used to obtain address hash values corresponding to the multiple councilor nodes respectively; and sort the multiple councilor nodes according to the address hash values.
[0106] In one embodiment, the transaction verification module 702 includes: a second verification unit, configured to group nodes in the blockchain, grouping nodes that satisfy a preset association relationship into one group, and obtaining a plurality of node groups;
[0107] A target node is randomly selected from each node group to obtain multiple target nodes; for the transaction to be confirmed, if the ratio of the number of target nodes that publish broadcast messages that have passed the verification relative to the number of all target nodes among the multiple target nodes reaches a second threshold, it is determined that the second verification result for the transaction to be confirmed is passed.
[0108] In one embodiment, the block generation module 703 includes: a node verification unit, which is used to verify the smart contract corresponding to the transaction to be confirmed, the identity of the councillor node and the identity of the target node through a preset smart manager if the verification results of the first verification and the second verification are both passed, and broadcast a message of successful verification if all the verifications are successful; a contract execution unit, which is used to control a machine with a preset smart contract to execute the corresponding smart contract if the smart manager broadcasts a message of successful verification for the transaction to be confirmed, so as to generate a block corresponding to the transaction to be confirmed and add it to the blockchain.
[0109] In one embodiment, the contract execution unit also includes: a contract configuration unit, used to obtain a machine verified by the smart manager; and send a corresponding smart contract to the verified machine.
[0110] For the specific definition of the transaction confirmation device 700, please refer to the definition of the transaction confirmation method above, which will not be repeated here. Each module in the above transaction confirmation device can be implemented in whole or in part by software, hardware and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0111] The transaction confirmation method provided in the present application can be applied to a computer device, which can be an intelligent manager, and its internal structure diagram can be as follows: Figure 8 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store smart contracts and transaction data to be confirmed. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a transaction confirmation method is implemented.
[0112] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0113] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.
[0114] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0115] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0116] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0117] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A transaction confirmation method, characterized in that: The method comprises: Get pending transactions; The first verification process of the transaction to be confirmed is performed on the authorized Byzantine fault-tolerant algorithm through multiple councilor nodes, and the second verification process of the transaction to be confirmed is performed on the authorized Byzantine fault-tolerant algorithm through multiple target nodes; wherein, when performing the first verification process, it includes: determining the multiple councilor nodes based on voting; sorting the multiple councilor nodes in descending order based on the characteristic parameters of each councilor node; selecting the first one in the sorting result as the speaker node, and the other councilor nodes as rotating councilor nodes; generating and broadcasting the corresponding proposal block through the speaker node; obtaining the verification result information broadcasted by each rotating councilor node on the proposal block; if the ratio of the rotating councilor nodes that publish the broadcast message of passing the verification to the current rotating councilor nodes reaches a first threshold, it is determined that the first verification result of the transaction to be confirmed is passed verification; the characteristic parameters include address hash values or the results of the previous round of voting; the multiple target nodes are randomly determined from multiple node groups, and the multiple target nodes correspond to the multiple node groups one by one; the multiple node groups are obtained based on the node logical relationship grouping between the nodes in the blockchain; If the results of the first verification and the second verification are both passed, the content of the transaction to be confirmed is subjected to a third verification process, the identities of the multiple councilor nodes are subjected to a fourth verification process, and the identities of the multiple target nodes are subjected to a fifth verification process; If the third verification process, the fourth verification process and the fifth verification process are all passed, a block corresponding to the transaction to be confirmed is generated and added to the blockchain.
2. The method according to claim 1, characterized in that The second verification process of the to-be-confirmed transaction on the authorized Byzantine fault-tolerant algorithm by using multiple target nodes includes: The nodes in the blockchain are grouped, and the nodes that meet the preset association relationship are grouped into one group to obtain multiple node groups; A target node is randomly selected from each node group to obtain multiple target nodes; For the transaction to be confirmed, if the ratio of the number of target nodes that publish broadcast messages with passed verification among the multiple target nodes relative to all target nodes reaches a second threshold, it is determined that the second verification result for the transaction to be confirmed is passed.
3. The method according to claim 1, characterized in that: The method further comprises: If the preset smart manager broadcasts a message of successful verification for the third verification process, the machine with the preset smart contract is controlled to execute the corresponding smart contract to generate a block corresponding to the transaction to be confirmed and add it to the blockchain.
4. The method according to claim 3, characterized in that Before controlling the machine with the preset smart contract to execute the corresponding smart contract, the method further includes: Acquire a machine verified by the smart manager; Send the corresponding smart contract to the verified machine.
5. A transaction confirmation system, characterized in that: include: A validator, a smart manager, and a machine with a preset smart contract; the validator includes multiple councilor nodes and multiple target nodes; Wherein, the multiple councillor nodes are used to perform a first verification process on the acquired transaction to be confirmed regarding the authorized Byzantine fault tolerance algorithm; wherein, when performing the first verification process, it includes: determining the multiple councillor nodes based on voting; sorting the multiple councillor nodes in descending order based on the characteristic parameters of each councillor node; selecting the first one in the sorting result as the speaker node, and the other councillor nodes as rotating councillor nodes; generating and broadcasting the corresponding proposal block through the speaker node; obtaining the verification result information broadcast by each rotating councillor node on the proposal block; if the ratio of the number of rotating councillor nodes that publish the broadcast message of passing the verification reaches a first threshold relative to the number of the current rotating councillor nodes, determining that the first verification result of the transaction to be confirmed is passed verification; the characteristic parameters include the address hash value or the result of the previous round of voting; The multiple target nodes are randomly determined from multiple node groups, and the multiple target nodes correspond to the multiple node groups one by one, and the multiple node groups are obtained based on the node logical relationship grouping between the nodes in the blockchain; the multiple target nodes are used to perform a second verification process on the authorized Byzantine fault tolerance algorithm for the transaction to be confirmed; The intelligent manager is configured to, if the verification results of the first verification and the second verification are both passed, perform a third verification process on the content of the transaction to be confirmed, perform a fourth verification process on the identities of the multiple councilor nodes, and perform a fifth verification process on the identities of the multiple target nodes; The machine is used to generate a block corresponding to the transaction to be confirmed and add it to the blockchain if the third verification process, the fourth verification process and the fifth verification process are all passed.
6. A transaction confirmation device, characterized in that: The device comprises: Transaction acquisition module, used to obtain transactions to be confirmed; A transaction verification module, used to perform a first verification process on the transaction to be confirmed regarding the authorized Byzantine fault tolerance algorithm through multiple councilor nodes, and to perform a second verification process on the transaction to be confirmed regarding the authorized Byzantine fault tolerance algorithm through multiple target nodes; wherein, when performing the first verification process, it includes: determining the multiple councilor nodes based on voting; sorting the multiple councilor nodes in descending order based on the characteristic parameters of each councilor node; selecting the first one in the sorting result as the speaker node, and the other councilor nodes as rotating councilor nodes; generating and broadcasting the corresponding proposal block through the speaker node; obtaining the verification result information broadcasted by each rotating councilor node on the proposal block; if the ratio of the number of rotating councilor nodes that publish the broadcast message of passing the verification reaches a first threshold relative to the number of the current rotating councilor nodes, determining that the first verification result of the transaction to be confirmed is passed verification; the characteristic parameters include address hash values or the results of the previous round of voting; the multiple target nodes are randomly determined from multiple node groups, and the multiple target nodes correspond to the multiple node groups one by one; the multiple node groups are obtained based on the node logical relationship grouping between the nodes in the blockchain; A block generation module, configured to, if the verification results of the first verification and the second verification are both passed, perform a third verification process on the content of the transaction to be confirmed, perform a fourth verification process on the identities of the multiple councilor nodes, and perform a fifth verification process on the identities of the multiple target nodes; If the third verification process, the fourth verification process and the fifth verification process are all passed, a block corresponding to the transaction to be confirmed is generated and added to the blockchain.
7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
