CN112948388A - Parallel chain arbitration consensus method, computer device and storage medium - Google Patents

Parallel chain arbitration consensus method, computer device and storage medium Download PDF

Info

Publication number
CN112948388A
CN112948388A CN202110245527.0A CN202110245527A CN112948388A CN 112948388 A CN112948388 A CN 112948388A CN 202110245527 A CN202110245527 A CN 202110245527A CN 112948388 A CN112948388 A CN 112948388A
Authority
CN
China
Prior art keywords
node
common
parallel chain
block
random number
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110245527.0A
Other languages
Chinese (zh)
Inventor
姜鹏
王志文
吴思进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lin Shangyu
Original Assignee
Hangzhou Fuzamei Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Fuzamei Technology Co Ltd filed Critical Hangzhou Fuzamei Technology Co Ltd
Priority to CN202110245527.0A priority Critical patent/CN112948388A/en
Publication of CN112948388A publication Critical patent/CN112948388A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The invention provides a parallel chain arbitration consensus method, computer equipment and a storage medium, wherein the method comprises the following steps: generating a first random number in response to obtaining a first consensus transaction right to send for a first parallel-link block of a first height; generating a first consensus transaction for a first parallel-chain block comprising a first hash value of a first random number; sending the first consensus transaction to the main chain; when the first consensus transaction is not arbitrated successfully, determining a first consensus node of a second consensus transaction of a second parallel chain block with the first height plus one to be sent according to second block data of a second main chain block corresponding to the first parallel chain block, a first random number and node IDs of all consensus nodes of the current parallel chain except illegal nodes; and broadcasting the first random number to each consensus node so that each consensus node can determine the first consensus node according to the second block data, the first random number and each node ID. The method and the device reduce the handling fee and ensure the consensus speed of the parallel chains.

Description

Parallel chain arbitration consensus method, computer device and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a parallel chain arbitration consensus method, a computer device, and a storage medium.
Background
In the prior art, each consensus node participating in consensus needs to generate and send a consensus transaction to a main chain, and when the number of parallel chain links is large, a large number of consensus transactions are generated, which causes a problem of increased commission charge overhead.
In view of the above problems, in the parallel chain mechanism proposed by the applicant (refer to the patent text filed by the applicant, application number 202010631494.9), the storage space consumed by the main chain block is reduced and the commission charge for sending the consensus transaction is reduced by generating the aggregate consensus transaction.
However, the above mechanism will cause the parallel chain nodes to spend a lot of time communicating with each other to generate the aggregate consensus transaction, and the speed of the parallel chain consensus is reduced.
Disclosure of Invention
In view of the above-mentioned drawbacks and deficiencies of the prior art, it would be desirable to provide a parallel chain arbitration consensus method, a computer device and a storage medium that both reduce commission fees and guarantee a consensus speed of parallel chains.
In a first aspect, the present invention provides a parallel chain arbitration consensus method for consensus nodes, where the method includes:
generating a first random number in response to obtaining a first consensus transaction right to send for a first parallel-link block of a first height;
generating a first consensus transaction for a first parallel-chain block comprising a first hash value of a first random number;
sending the first consensus transaction to a main chain for each consensus node of the current parallel chain:
executing the first consensus transaction to obtain a first execution result, and determining whether the first consensus transaction is the same as a locally generated second execution result of the first height:
if yes, recording a first hash value;
if not, generating a first arbitration transaction with a first height and sending the first arbitration transaction to the main chain for storing the certificate;
executing each arbitration transaction with the first height, and determining the current node as an illegal node when each arbitration transaction passes consensus;
judging whether the execution result of the first altitude is stored locally:
if so, rolling back the execution result of the first height, and re-determining a second common identification node to be sent with the first common identification transaction according to the first block data of the first main chain block corresponding to the third parallel chain block with the first height minus one, a second random number broadcast by the common identification node sending the correct third common identification transaction of the third parallel chain block, and the node ID of each common identification node of the current parallel chain except the illegal node;
if not, re-determining a second common identification node according to the first block data, the second random number and the node ID of each common identification node of the current parallel chain except the illegal node;
when the first consensus transaction is not arbitrated successfully, determining a first consensus node of a second consensus transaction of a second parallel chain block with the first height plus one to be sent according to second block data of a second main chain block corresponding to the first parallel chain block, a first random number and node IDs of all consensus nodes of the current parallel chain except illegal nodes; and the number of the first and second groups,
and broadcasting the first random number to each consensus node so that each consensus node can determine the first consensus node according to the second block data, the first random number and each node ID.
In a second aspect, the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a parallel chain arbitration consensus method provided according to embodiments of the present invention.
In a fourth aspect, the present invention further provides a storage medium storing a computer program, the computer program enabling a computer to execute the parallel chain arbitration consensus method according to the embodiments of the present invention.
Embodiments of the present invention provide a parallel chain arbitration consensus method, a computer device, and a storage medium by generating a first random number in response to obtaining a first consensus transaction right for a first parallel chain block of a first height; generating a first consensus transaction for a first parallel-chain block comprising a first hash value of a first random number; sending the first consensus transaction to the main chain; when the first consensus transaction is not arbitrated successfully, determining a first consensus node of a second consensus transaction of a second parallel chain block with the first height plus one to be sent according to second block data of a second main chain block corresponding to the first parallel chain block, a first random number and node IDs of all consensus nodes of the current parallel chain except illegal nodes; and broadcasting the first random number to each consensus node so that each consensus node can determine the first consensus node according to the second block data, the first random number and each node ID, thereby reducing the handling fee and ensuring the consensus speed of the parallel chain.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of a parallel chain arbitration consensus method according to an embodiment of the present invention.
Fig. 2 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of a parallel chain arbitration consensus method according to an embodiment of the present invention. As shown in fig. 1, in the present embodiment, the present invention provides a parallel chain arbitration consensus method for consensus nodes, where the method includes:
s11: generating a first random number in response to obtaining a first consensus transaction right to send for a first parallel-link block of a first height;
s13: generating a first consensus transaction for a first parallel-chain block comprising a first hash value of a first random number;
s15: sending the first consensus transaction to a main chain for each consensus node of the current parallel chain:
executing the first consensus transaction to obtain a first execution result, and determining whether the first consensus transaction is the same as a locally generated second execution result of the first height:
if yes, recording a first hash value;
if not, generating a first arbitration transaction with a first height and sending the first arbitration transaction to the main chain for storing the certificate;
executing each arbitration transaction with the first height, and determining the current node as an illegal node when each arbitration transaction passes consensus;
judging whether the execution result of the first altitude is stored locally:
if so, rolling back the execution result of the first height, and re-determining a second common identification node to be sent with the first common identification transaction according to the first block data of the first main chain block corresponding to the third parallel chain block with the first height minus one, a second random number broadcast by the common identification node sending the correct third common identification transaction of the third parallel chain block, and the node ID of each common identification node of the current parallel chain except the illegal node;
if not, re-determining a second common identification node according to the first block data, the second random number and the node ID of each common identification node of the current parallel chain except the illegal node;
s17: when the first consensus transaction is not arbitrated successfully, determining a first consensus node of a second consensus transaction of a second parallel chain block with the first height plus one to be sent according to second block data of a second main chain block corresponding to the first parallel chain block, a first random number and node IDs of all consensus nodes of the current parallel chain except illegal nodes; and the number of the first and second groups,
s19: and broadcasting the first random number to each consensus node so that each consensus node can determine the first consensus node according to the second block data, the first random number and each node ID.
Specifically, the "re-determining the second common node to be sent the first common transaction by using the first chunk data of the first main chain chunk corresponding to the third parallel chain chunk reduced by one according to the first height, the second random number broadcasted by the common node sending the correct third common transaction of the third parallel chain chunk, and the node ID of each common node of the current parallel chain excluding the illegal node", and the "re-determining the second common node according to the first chunk data, the second random number, and the node ID of each common node of the current parallel chain excluding the illegal node" includes: generating first data according to the first block data and the second random number; calculating a first exclusive-or value according to the first data and the node ID of each common node of the current parallel chain, which removes the illegal node; re-determining the consensus node with the minimum first exclusive-or value as a second consensus node, determining a first consensus node which is to send a second consensus transaction of the second parallel chain block with the first height plus one according to the second block data of the second main chain block corresponding to the first parallel chain block, the first random number and the node ID of each consensus node of the current parallel chain excluding the illegal node, and determining the first consensus node according to the second block data, the first random number and each node ID by the data point comprises: generating second data according to the second block data and the first random number; calculating a second exclusive-or value according to the second data and the node ID of each common node of the current parallel chain, which removes the illegal node; determining the common node with the minimum second exclusive-or value as a first common node ", taking the first block data as the block hash as an example; the block chain system is assumed to have a main chain and a parallel chain parachain1, wherein n 1-n 7 are arranged on the parachain, and n 1-n 7 are all consensus nodes; there are no illegal nodes in n 1-n 7 at this time;
n1, in response to obtaining the consensus transaction transmission right of the first parallel chain block (10_ p1) with the first height, executing step S11 to generate a random number R _ n 1;
n1 executes step S13, generating consensus transaction tx1 of block (10_ p1) _ n1 including hash (R _ n 1);
n1 executes step S15, sending tx1 to the main chain;
the backbone node generates a backbone block hypothesis block (100_ main) wrapped with tx 1;
n 1-n 7 obtain and execute tx1 from the main chain to obtain an execution result _ n 1;
n2 executes the locally generated block (10_ p1) _ n2 to obtain result _ n 2;
n3 executes the locally generated block (10_ p1) _ n3 to obtain result _ n 3;
n4 executes the locally generated block (10_ p1) _ n4 to obtain result _ n 4;
n5 executes the locally generated block (10_ p1) _ n5 to obtain result _ n 5;
n6 executes the locally generated block (10_ p1) _ n6 to obtain result _ n 6;
n7 executes the locally generated block (10_ p1) _ n7 to obtain result _ n 7;
since there are no illegal nodes in n 1-n 7, result _ n 2-result _ n7 are the same as result _ n1, and n 2-n 7 record a hash (R _ n 1);
when tx1 is not arbitrated successfully, n1 executes step S17, and generates Hs (block hash (100_ main) and R _ n1) according to block hash (100_ main) and R _ n 1; calculating exclusive OR values according to Hs and node IDs of n 1-n 7, and determining a consensus node of a consensus transaction of block (11_ p1) to be sent according to the consensus node (assumed as n2) with the minimum exclusive OR value;
n1 executes step S19, broadcasting R _ n1 to n 2-n 7;
n 2-n 7 generate Hs according to the blockhash (100_ main) and R _ n1, calculate exclusive OR values according to Hs and node IDs of n 1-n 7, and determine the common node of the common transaction of the block (11_ p1) to be sent according to the common node (assumed as n2) with the minimum exclusive OR value.
Assume that n2 is an illegal node at this time;
n2, in response to obtaining the consensus transaction transmission right of block (11_ p1), executing step S11, generating a random number R _ n 2;
n2 executes step S13, generating consensus transaction tx2 of block (11_ p1) _ n2 including hash (R _ n 2);
n2 executes step S15, sending tx2 to the main chain;
the backbone node generates a backbone block hypothesis block (110_ main) wrapped with tx 2;
n 1-n 7 obtaining an execution result _ n2' by obtaining and executing tx2 from the main chain;
n1 executes the locally generated block (11_ p1) _ n1 to obtain result _ n 1';
n3 executes the locally generated block (11_ p1) _ n3 to obtain result _ n 3';
n4 executes the locally generated block (11_ p1) _ n4 to obtain result _ n 4';
n5 executes the locally generated block (11_ p1) _ n5 to obtain result _ n 5';
n6 executes the locally generated block (11_ p1) _ n6 to obtain result _ n 6';
n7 executes the locally generated block (11_ p1) _ n7 to obtain result _ n 7';
since n2 is an illegal node, result _ n1', result _ n3' -result _ n7 'are all different from result _ n2', and n1 and n 3-n 7 respectively generate arbitration transactions of block (11_ p1) and send the transactions to the main chain;
the main chain storage certificate n1 and n 3-n 7 respectively generate the arbitration transaction of block (11_ p 1);
n 1-n 7 obtain from the main chain and execute the arbitration transaction of block (11_ p1) generated by n1, n 3-n 7 respectively, and when the consensus is passed, n2 is determined as an illegal node;
if the execution result of the block (11_ p1) is not stored locally at n1 and n 3-n 7, Hs is generated according to the block hash (100_ main) and R _ n1, exclusive or values are respectively calculated according to the node IDs of the Hs, n1 and n 3-n 7, and the common node (assumed as n3) with the minimum exclusive or value determines the common node of the common transaction for sending the block (11_ p 1).
In further embodiments, the first chunk data may also be configured as other parameters according to actual requirements, for example, configured as a state hash, and the same technical effect may be achieved.
In further embodiments, "re-determining a second common node to be sent the first common transaction according to the first chunk data of the first main chain chunk corresponding to the third parallel chain chunk reduced by one according to the first height, the second random number broadcast by the common node sending the correct third common transaction of the third parallel chain chunk, and the node ID of each common node of the current parallel chain excluding the illegal node" may also be configured according to actual requirements, for example, configured to generate the first data according to the first chunk data and the second random number; calculating a first exclusive-or value according to the first data and the node ID of each common node of the current parallel chain, which removes the illegal node; and re-determining the consensus node with the maximum first exclusive-or value as the second consensus node. Correspondingly, "determining a first common node of a second common transaction of a second parallel chain block which is about to send a first height plus one according to second block data of a second main chain block corresponding to the first parallel chain block, a first random number and node IDs of common nodes of the current parallel chain except for illegal nodes", and "determining the first common node according to the second block data, the first random number and the node IDs by a data point" should be configured to generate second data according to the second block data and the first random number; calculating a second exclusive-or value according to the second data and the node ID of each common node of the current parallel chain, which removes the illegal node; the common node with the largest second exclusive-or value is determined as the first common node, and the same technical effect can be achieved.
Those skilled in the art should understand that the sending right of the consensus transaction of two consecutive blocks should not be obtained by the same consensus node, so as to prevent the consensus node from generating random numbers for earning.
Those skilled in the art will appreciate that, assuming that result _ n4 'of n4 is consistent with result _ n2', n4 will not generate an arbitration transaction, but will instead save result _ n4 'or result _ n2' as the correct execution result of the block (11_ p 1); and n4 executes the arbitration transaction of block (11_ p1) generated by n1, n3 to n7, and when the consensus transaction passes the consensus, n4 should first rollback the execution result of the saved block (11_ p1) and then determine the consensus node of the consensus transaction that will send block (11_ p 1).
It will be understood by those skilled in the art that the block (10_ p1) described above represents a parallel chain block of height 10 of parachain1, and since parallel chain links each generate a parallel chain block, block (10_ p1) _ n1 represents a parallel chain block of height 10 of n1 locally generated parachain1, block (10_ p1) _ n2 represents a parallel chain block of height 10 of n2 locally generated parachain1, and so on.
It should be understood by those skilled in the art that if more and more common consensus nodes are listed as illegal nodes, which eventually results in the failure of the parallel chain to operate normally, a corresponding mechanism for recovering from the illegal nodes to normal nodes should be configured, for example, after n1 pays a certain recovery fee, n 2-n 7 may determine n1 as a normal consensus node.
It should be understood by those skilled in the art that the parallel chain can be configured with non-common nodes, such as n 8-n 10, which, like the common nodes, would also generate parallel chain blocks, but would not generate common transactions of the parallel chain blocks; likewise, the non-consensus node does not generate an arbitrated transaction.
Those skilled in the art will appreciate that in the present embodiment, the consensus transaction and the arbitrated transaction are certified on the backbone; in further embodiments, the consensus transaction and the arbitration transaction may be configured as a transaction type that the main chain node also needs to execute according to actual requirements, and the consensus transaction and the arbitration transaction are executed by the main chain node at the same time.
Because the parallel chain common node is mostly a trusted node and is not easy to make mistakes, the method has little possibility to be executed; therefore, in summary, the above embodiment enables the number of the consensus transactions to be sent by one parallel chain block to be reduced, the commission is reduced, and the consensus speed of the parallel chain is ensured.
Preferably, the determining the first common node according to the second block data, the first random number, and the node IDs includes:
performing hash operation on the first random number to obtain a second hash value;
and when the second hash value is the same as the first hash value, determining a first common node according to the second block data, the first random number and the node IDs.
Preferably, the re-determining the second common node to be sent the first common transaction according to the first chunk data of the first main chain chunk corresponding to the third parallel chain chunk with the first height minus one, the second random number broadcasted by the common node sending the correct third common transaction of the third parallel chain chunk, and the node ID of each common node of the current parallel chain excluding the illegal node, and the re-determining the second common node according to the first chunk data, the second random number, and the node ID of each common node of the current parallel chain excluding the illegal node comprises:
generating first data according to the first block data and the second random number;
calculating a first exclusive-or value according to the first data and the node ID of each common node of the current parallel chain, which removes the illegal node;
the common node with the minimum first exclusive-or value is determined as a second common node again;
determining a first common node of a second common transaction to be sent to a second parallel chain block with a first height plus one according to second block data of a second main chain block corresponding to the first parallel chain block, a first random number and node IDs of common nodes of a current parallel chain except illegal nodes, and determining the first common node according to the second block data, the first random number and the node IDs by a data point comprises:
generating second data according to the second block data and the first random number;
calculating a second exclusive-or value according to the second data and the node ID of each common node of the current parallel chain, which removes the illegal node;
and determining the common node with the minimum second exclusive-or value as the first common node.
The parallel chain arbitration consensus principle of the above embodiments can refer to the method shown in fig. 1, and is not described herein again.
Preferably, the recording of the node ID of each parallel chain node on the main chain, the re-determining of the second common node to be sent for the first common transaction according to the first block data of the first main chain block corresponding to the third parallel chain block with the first height minus one, the second random number broadcast by the common node sending the correct third common transaction of the third parallel chain block, and the node ID of each common node of the current parallel chain excluding the illegal node, and the re-determining of the second common node according to the first block data, the second random number, and the node ID of each common node of the current parallel chain excluding the illegal node includes:
acquiring node IDs of all common nodes of the current parallel chain from a main chain;
and re-determining the second common node according to the first block data, the second random number and the node ID of each common node of the current parallel chain except the illegal node.
Determining a first common node of a second common transaction to be sent to a second parallel chain block with a first height plus one according to second block data of a second main chain block corresponding to the first parallel chain block, a first random number and node IDs of common nodes of a current parallel chain except illegal nodes, and determining the first common node according to the second block data, the first random number and the node IDs by a data point comprises:
acquiring node IDs of all common nodes of the current parallel chain from a main chain;
and determining the first common identification node according to the second block data, the first random number and the ID of each node according to the base point.
In more embodiments, the consensus node may also obtain the node ID of each consensus node of the current parallel chain in other manners; for example, the first cloud platform acquires the node IDs of the common nodes of the current parallel chain, so that the same technical effect can be achieved.
Before generating the first consensus transaction for the first parallel-chain block comprising the first hash value of the first random number, the method further comprises:
receiving third random numbers which are respectively generated by the first number of third consensus nodes and broadcast to the main chain; the first number of third consensus nodes are determined according to a pre-configured random node determination rule and the first height;
generating a first consensus transaction for a first parallel-chain block comprising a first hash value of a first random number comprises:
generating a first consensus transaction for the first parallel-chain block comprising the first hash value, third hash values for each third random number;
the method for re-determining the second common node to be sent for the first common transaction according to the first block data of the first main chain block corresponding to the third parallel chain block with the first height minus one, the second random number broadcasted by the common node sending the correct third common transaction of the third parallel chain block, and the node ID of each common node of the current parallel chain excluding the illegal node, and the re-determining the second common node according to the first block data, the second random number and the node ID of each common node of the current parallel chain excluding the illegal node comprises the following steps:
re-determining a second common identification node according to the first block data, the second number of fourth random numbers and the node ID of each common identification node of the current parallel chain except the illegal node; the second quantity of fourth random numbers are generated by the second quantity of fourth consensus nodes respectively, the second quantity of fourth consensus nodes are determined according to the random node determination rule and the first height minus one, the second random numbers are included in the first quantity of fourth random numbers, and the second quantity is equal to the first quantity plus one;
determining a first common node of a second common transaction to be sent to a second parallel chain block with a first height plus one according to second block data of a second main chain block corresponding to the first parallel chain block, a first random number and node IDs of common nodes of a current parallel chain except illegal nodes, and determining the first common node according to the second block data, the first random number and the node IDs comprises:
and determining a first common identification node for sending a second common identification transaction of the second parallel chain block with the first height plus one according to the second block data, the first random number, each third random number and the node ID of each common identification node of the current parallel chain except the illegal node.
The above embodiment differs from the embodiment shown in fig. 1 in that in the embodiment shown in fig. 1, the consensus node sending the consensus transaction of the next block height is generated based on a random number generated by the consensus node sending the consensus transaction of the current block height. In this embodiment, the consensus node for sending the consensus transaction of the next block height is determined according to the random numbers generated by the consensus node for sending the consensus transaction of the current block height and a plurality of consensus nodes. Compared to the method shown in fig. 1, the method of this embodiment is more random, and the determination of the consensus node that sends the consensus transaction of the next block height is more random.
Further preferably, the re-determining the second common identification node according to the first block data, the second number of fourth random numbers, and the node ID of each common identification node of the current parallel chain excluding the illegal node includes:
generating third data according to the first block data and a second number of fourth random numbers;
respectively calculating a third exclusive-or value according to the third data and the node ID of each common node of the current parallel chain, which removes the illegal node;
re-determining the consensus node with the third difference or the minimum value as the second consensus node;
selecting a second number of common identification nodes as common identification nodes for generating and broadcasting a fourth random number according to the third difference or the sequence of the values from small to large;
determining a first common node to send a second common transaction of the second parallel chain block with the first height plus one according to the second block data, the first random number, the third random numbers and the node ID of each common node of the current parallel chain except the illegal node, comprises:
generating fourth data according to the second block data, the first random number and each third random number;
calculating a fourth exclusive-or value according to the fourth data and the node ID of each common node of the current parallel chain, which removes the illegal node;
the common node with the minimum fourth exclusive-or value is determined as the first common node again;
and selecting a first number of consensus nodes as consensus nodes for generating and broadcasting the third random number according to the sequence of the fourth XOR value from small to large from the second small of the fourth XOR value.
Further preferably, the recording node IDs of the parallel chain nodes on the main chain, and the re-determining the second common node according to the first block data, the second number of fourth random numbers, and the node IDs of the common nodes of the current parallel chain excluding the illegal node includes:
acquiring node IDs of all common nodes of the current parallel chain from a main chain;
re-determining a second common identification node according to the first block data, the second number of fourth random numbers and the node ID of each common identification node of the current parallel chain except the illegal node;
determining a first common node to send a second common transaction of the second parallel chain block with the first height plus one according to the second block data, the first random number, the third random numbers and the node ID of each common node of the current parallel chain except the illegal node, comprises:
acquiring node IDs of all common nodes of the current parallel chain from a main chain;
and determining a first common identification node for sending a second common identification transaction of the second parallel chain block with the first height plus one according to the second block data, the first random number, each third random number and the node ID of each common identification node of the current parallel chain except the illegal node.
Fig. 2 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
As shown in fig. 2, as another aspect, the present application also provides a computer apparatus including one or more Central Processing Units (CPUs) 201 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)202 or a program loaded from a storage section 208 into a Random Access Memory (RAM) 203. In the RAM203, various programs and data necessary for the operation of the computer apparatus are also stored. The CPU201, ROM202, and RAM203 are connected to each other via a bus 204. An input/output (I/O) interface 205 is also connected to bus 204.
The following components are connected to the I/O interface 205: an input portion 206 including a keyboard, a mouse, and the like; an output section 207 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 208 including a hard disk and the like; and a communication section 209 including a network interface card such as a LAN card, a modem, or the like. The communication section 209 performs communication processing via a network such as the internet. A drive 210 is also connected to the I/O interface 205 as needed. A removable medium 211 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 210 as necessary, so that a computer program read out therefrom is mounted into the storage section 208 as necessary.
In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods described above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 209 and/or installed from the removable medium 211.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a computer-readable storage medium that exists separately and is not assembled into a computer device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (9)

1. A parallel chain arbitration consensus method applied to a consensus node, the method comprising:
generating a first random number in response to obtaining a first consensus transaction right to send for a first parallel-link block of a first height;
generating a first consensus transaction for the first parallel-chain block that includes a first hash value of the first random number;
sending the first consensus transaction to a main chain for each consensus node of a current parallel chain:
executing the first consensus transaction to obtain a first execution result, and determining whether the first consensus transaction is the same as a locally generated second execution result of the first height:
if yes, recording the first hash value;
if not, generating a first arbitration transaction with the first height and sending the first arbitration transaction to the main chain for storing the certificate;
executing each arbitration transaction of the first height, and determining the current node as an illegal node when each arbitration transaction passes consensus;
judging whether the execution result of the first altitude is stored locally:
if so, rolling back the execution result of the first height, and re-determining a second common identification node to be sent to the first common identification transaction according to the first block data of the first main chain block corresponding to a third parallel chain block with the first height minus one, a second random number broadcast by a common identification node sending a correct third common identification transaction of the third parallel chain block, and node IDs of common identification nodes of all the common identification nodes of the current parallel chain except the illegal node;
if not, re-determining the second common identification node according to the first block data, the second random number and the node ID of each common identification node of the current parallel chain except the illegal node;
when the first common identification transaction is not arbitrated successfully, determining a first common identification node of a second common identification transaction of a second parallel chain block which is about to send the first height plus one according to second block data of a second main chain block corresponding to the first parallel chain block, the first random number and node IDs of all common identification nodes of the current parallel chain except illegal nodes; and the number of the first and second groups,
broadcasting the first random number to each of the common nodes, so that each of the common nodes determines the first common node according to the second block data, the first random number, and each of the node IDs.
2. The method of claim 1, wherein the determining the first common node according to the second block data, the first random number, and each node ID comprises:
performing a hash operation on the first random number to obtain a second hash value;
and when the second hash value is the same as the first hash value, determining the first common node according to the second block data, the first random number and each node ID.
3. The method of claim 1, wherein the re-determining the second common node to be sent for the first common transaction according to the first chunk data of the first main chain chunk corresponding to the third parallel chain chunk with the first height minus one, the second random number broadcasted by the common node sending the correct third common transaction for the third parallel chain chunk, and the node ID of each common node of the current parallel chain excluding the illegal node, and the re-determining the second common node according to the first chunk data, the second random number, and the node ID of each common node of the current parallel chain excluding the illegal node comprises:
generating first data according to the first block data and the second random number;
calculating a first exclusive-or value according to the first data and the node ID of each common node of the current parallel chain, which removes the illegal node;
re-determining the consensus node with the minimum first exclusive-or value as the second consensus node;
the determining, according to the second block data of the second main chain block corresponding to the first parallel chain block, the first random number, and the node ID of each common node of the current parallel chain excluding the illegal node, a first common node of a second common transaction of the second parallel chain block to which the first height plus one is to be sent, and determining, according to the point, the first common node according to the second block data, the first random number, and each node ID includes:
generating second data according to the second block data and the first random number;
calculating a second exclusive-or value according to the second data and the node ID of each common node of the current parallel chain, which removes the illegal node;
and determining the common node with the minimum second exclusive-or value as the first common node.
4. The method according to any one of claims 1-3, wherein a main chain records a node ID of each parallel chain node, and the re-determining the second common node to be sent for the first common transaction according to the first block data of the first main chain block corresponding to the third parallel chain block with the first height minus one, the second random number broadcasted by the common node sending the correct third common transaction of the third parallel chain block, and the node ID of each common node of the current parallel chain excluding the illegal node, and the re-determining the second common node according to the first block data, the second random number, and the node ID of each common node of the current parallel chain excluding the illegal node comprises:
acquiring node IDs of all common nodes of the current parallel chain from a main chain;
and re-determining the second common node according to the first block data, the second random number and the node ID of each common node of the current parallel chain except the illegal node.
The determining, according to the second block data of the second main chain block corresponding to the first parallel chain block, the first random number, and the node ID of each common node of the current parallel chain excluding the illegal node, a first common node of a second common transaction of the second parallel chain block to which the first height plus one is to be sent, and determining, according to the point, the first common node according to the second block data, the first random number, and each node ID includes:
acquiring node IDs of all common nodes of the current parallel chain from a main chain;
and determining the first common node according to the point and the second block data, the first random number and each node ID.
5. The method of claim 1, wherein prior to the generating the first consensus transaction for the first parallel-chain block comprising the first hash value of the first random number, further comprising:
receiving third random numbers which are respectively generated by the first number of third consensus nodes and broadcast to the main chain; wherein the first number of third consensus nodes is determined according to a preconfigured random node determination rule, the first altitude;
the generating a first consensus transaction for the first parallel-chain block that includes a first hash value of the first random number comprises:
generating a first consensus transaction for the first parallel-link block comprising the first hash value, a third hash value for each of the third random numbers;
the re-determining the second common node to be sent for the first common transaction according to the first block data of the first main chain block corresponding to the third parallel chain block with the first height minus one, the second random number broadcast by the common node sending the correct third common transaction of the third parallel chain block, and the node ID of each common node of the current parallel chain excluding the illegal node, and the re-determining the second common node according to the first block data, the second random number, and the node ID of each common node of the current parallel chain excluding the illegal node includes:
re-determining the second common identification node according to the first block data, the second number of fourth random numbers and the node ID of each common identification node of the current parallel chain except the illegal node; wherein the second number of fourth random numbers are respectively generated by the second number of fourth consensus nodes determined according to the random node determination rule and the first height minus one, the second random number is included in the first number of fourth random numbers, and the second number is equal to the first number plus one;
the determining, according to the second block data of the second main chain block corresponding to the first parallel chain block, the first random number, and the node ID of each common node of the current parallel chain excluding the illegal node, a first common node of a second common transaction of the second parallel chain block to which the first height plus one is to be sent, and the determining, according to the second block data, the first random number, and each node ID, the first common node includes:
and determining a first common identification node for sending a second common identification transaction of the second parallel chain block with the first height plus one according to the second block data, the first random number, each third random number and the node ID of each common identification node of the current parallel chain except the illegal node.
6. The method of claim 4, wherein the root re-determining the second common node according to the first chunk data, the second number of fourth random numbers, and the node IDs of the common nodes of the current parallel chain excluding the illegal node comprises:
generating third data according to the first block data and the second number of fourth random numbers;
calculating a third exclusive-or value according to the third data and the node ID of each common node of the current parallel chain, which removes the illegal node;
re-determining the consensus node with the minimum third exclusive-or value as the second consensus node;
selecting a second number of common identification nodes as common identification nodes for generating and broadcasting the fourth random number according to the sequence of the third exclusive-or value from small to large;
the determining, according to the second block data, the first random number, each of the third random numbers, and the node ID of each of the common nodes of the current parallel chain excluding the illegal node, a first common node that is to send a second common transaction of the second parallel chain block with the first height plus one includes:
generating fourth data according to the second block data, the first random number and each third random number;
calculating a fourth exclusive-or value according to the fourth data and the node ID of each common node of the current parallel chain, which is removed from the illegal node;
re-determining the common node with the smallest fourth exclusive-or value as the first common node;
and selecting a first number of common identification nodes as common identification nodes for generating and broadcasting the third random number according to the sequence of the fourth XOR value from small to large from the second small of the fourth XOR value.
7. The method according to claim 5 or 6, wherein a main chain has recorded thereon a node ID of each parallel chain node, and wherein the re-determining the second common node based on the first block data, the second number of fourth random numbers, and the node ID of each common node of the current parallel chain excluding the illegal node comprises:
acquiring node IDs of all common nodes of the current parallel chain from a main chain;
re-determining the second common identification node according to the first block data, the second number of fourth random numbers and the node ID of each common identification node of the current parallel chain except the illegal node;
the determining, according to the second block data, the first random number, each of the third random numbers, and the node ID of each of the common nodes of the current parallel chain excluding the illegal node, a first common node that is to send a second common transaction of the second parallel chain block with the first height plus one includes:
acquiring node IDs of all common nodes of the current parallel chain from a main chain;
and determining a first common identification node for sending a second common identification transaction of the second parallel chain block with the first height plus one according to the second block data, the first random number, each third random number and the node ID of each common identification node of the current parallel chain except the illegal node.
8. A computer device, the device comprising:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-7.
9. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-7.
CN202110245527.0A 2021-03-05 2021-03-05 Parallel chain arbitration consensus method, computer device and storage medium Pending CN112948388A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110245527.0A CN112948388A (en) 2021-03-05 2021-03-05 Parallel chain arbitration consensus method, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110245527.0A CN112948388A (en) 2021-03-05 2021-03-05 Parallel chain arbitration consensus method, computer device and storage medium

Publications (1)

Publication Number Publication Date
CN112948388A true CN112948388A (en) 2021-06-11

Family

ID=76247877

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110245527.0A Pending CN112948388A (en) 2021-03-05 2021-03-05 Parallel chain arbitration consensus method, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN112948388A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200034356A1 (en) * 2018-07-26 2020-01-30 Baidu Online Network Technology (Beijing) Co., Ltd. Method, apparatus, device and storage medium for implementing application based on blockchain network
WO2020177537A1 (en) * 2019-03-02 2020-09-10 杭州复杂美科技有限公司 Parallel chain consensus method, data exception processing method, device and storage medium
CN111798316A (en) * 2020-07-03 2020-10-20 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium
CN111861471A (en) * 2020-07-30 2020-10-30 杭州复杂美科技有限公司 Parallel chain consensus method, parallel chain block rollback method, device and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200034356A1 (en) * 2018-07-26 2020-01-30 Baidu Online Network Technology (Beijing) Co., Ltd. Method, apparatus, device and storage medium for implementing application based on blockchain network
WO2020177537A1 (en) * 2019-03-02 2020-09-10 杭州复杂美科技有限公司 Parallel chain consensus method, data exception processing method, device and storage medium
CN111798316A (en) * 2020-07-03 2020-10-20 杭州复杂美科技有限公司 Parallel chain consensus method, device and storage medium
CN111861471A (en) * 2020-07-30 2020-10-30 杭州复杂美科技有限公司 Parallel chain consensus method, parallel chain block rollback method, device and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘昊哲;李莎莎;吕伟龙;魏松杰;: "基于信誉度的主从多链区块链共识机制", 南京理工大学学报, no. 03 *

Similar Documents

Publication Publication Date Title
CN109410045B (en) Parallel chain consensus method, equipment and storage medium
CN110751475A (en) Cross-chain method, system, equipment and storage medium for blockchain transaction
CN108900364B (en) Block chain network management method, block chain network management device, block chain network management medium and electronic equipment
EP4053711A1 (en) Consensus method for blockchain, and consensus node, electronic device and storage medium
CN110852882B (en) Packet consensus method, apparatus, device, and medium for blockchain networks
CN111798316B (en) Parallel chain consensus method, apparatus and storage medium
CN111798238B (en) Parallel chain consensus method, apparatus and storage medium
CN111242780A (en) Method, device and storage medium for sending consensus transaction
CN109542352B (en) Method and apparatus for storing data
CN110083745B (en) Data query method, device and storage medium
CN113194146B (en) Leader node determination method, computer device, and storage medium
CN109325744B (en) Payment processing method, payment processing device, payment processing medium and electronic equipment
CN109005208B (en) Method and device for pushing information
CN111008249B (en) Parallel chain block synchronization method, device and storage medium
CN110516463B (en) Method and apparatus for generating information
CN110928952A (en) Data synchronization method and device based on block chain
CN112819625B (en) Parallel chain arbitration consensus method, computer device, and storage medium
CN111176641B (en) Flow node execution method, device, medium and electronic equipment
CN112733202B (en) Parallel chain supervision consensus method, computer device and storage medium
CN112948388A (en) Parallel chain arbitration consensus method, computer device and storage medium
CN107277108B (en) Method, device and system for processing messages at nodes of block chain
CN110545296A (en) Log data acquisition method, device and equipment
CN111798239A (en) Parallel chain consensus method, device and storage medium
CN110428254B (en) Decentralized storage downloading method and arbitration method, equipment and storage medium
CN113283891A (en) Information processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20240401

Address after: Unit 304, Building 1-4, Qishanyuan, Shangjie Town, Minhou County, Fuzhou City, Fujian Province, 350000

Applicant after: Lin Shangyu

Country or region after: China

Address before: 310000 Room 702, 7th Floor, Building 6, East Software Park, No. 90 Wensan Road, Xihu District, Hangzhou City, Zhejiang Province

Applicant before: HANGZHOU FUZAMEI TECHNOLOGY Co.,Ltd.

Country or region before: China

TA01 Transfer of patent application right