CN110852882B - Packet consensus method, apparatus, device, and medium for blockchain networks - Google Patents

Packet consensus method, apparatus, device, and medium for blockchain networks Download PDF

Info

Publication number
CN110852882B
CN110852882B CN201911096465.0A CN201911096465A CN110852882B CN 110852882 B CN110852882 B CN 110852882B CN 201911096465 A CN201911096465 A CN 201911096465A CN 110852882 B CN110852882 B CN 110852882B
Authority
CN
China
Prior art keywords
node
nodes
block
transaction
node set
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.)
Active
Application number
CN201911096465.0A
Other languages
Chinese (zh)
Other versions
CN110852882A (en
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.)
Beijing Peersafe Technology Co ltd
Original Assignee
Beijing Peersafe 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 Beijing Peersafe Technology Co ltd filed Critical Beijing Peersafe Technology Co ltd
Priority to CN201911096465.0A priority Critical patent/CN110852882B/en
Publication of CN110852882A publication Critical patent/CN110852882A/en
Application granted granted Critical
Publication of CN110852882B publication Critical patent/CN110852882B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The application discloses a grouping consensus method, a grouping consensus device, grouping consensus equipment and a grouping consensus medium for a block chain network. The method comprises the following steps: each first node set respectively carries out first consensus on transaction data in the block chain network; each first node centralizes a predetermined first main node to generate a first block corresponding to transaction data; the first main node of each first node set respectively sends a first block corresponding to each first node set to the second node set; combining each first block into a second block by a predetermined second main node in the second node set; all nodes in the second node set perform second consensus on the second block, and a predetermined second master node in the second node set generates a transaction block corresponding to the transaction data. The throughput of the blockchain network can be improved, the nodes with higher computing capability in the blockchain network generate transaction blocks, and the waste of computing resources is reduced.

Description

Packet consensus method, apparatus, device, and medium for blockchain networks
Technical Field
The present application relates generally to the field of blockchain technology, and in particular, to a method, an apparatus, a device, and a medium for group consensus in a blockchain network.
Background
The block chain technology is a decentralized (i.e. independent of third party) technical scheme for storing, verifying, transmitting and exchanging data through self distributed nodes. As the blockchain technology has matured, the technology has been widely applied to various fields of social life.
The decentralized feature of the blockchain network makes it to perform consensus in the process of processing data, so called consensus is the process in which a node in the blockchain network agrees on the data to be processed by the blockchain network. Currently, most popular block chain network consensus algorithms exist, a workload certification algorithm (POW) is a widely used consensus algorithm, a block chain network using the algorithm is a completely distributed system, any node can enter the block chain network at any time, and each node can possibly generate a new block.
However, the POW algorithm also has some problems, after the blockchain network receives a valid transaction, all nodes compete for the right to produce a block, which causes huge waste of computing resources, and in order to screen out the best node generating a new block, the blockchain network usually raises the screening threshold, and under the condition of a fixed block size, the throughput of the whole blockchain network is reduced.
Disclosure of Invention
In view of the foregoing drawbacks and deficiencies of the prior art, it is desirable to provide a packet consensus method for a blockchain network, which can improve throughput of the blockchain network and reduce computational resource waste.
In a first aspect, the present application provides a method for grouping and identifying a blockchain network, where the blockchain network includes a plurality of first node sets and second node sets, each first node set is used for identifying transaction data, each second node set includes a first fixed number of nodes, and each second node set is used for generating a transaction block, and the method includes:
each first node set respectively carries out first consensus on transaction data in the block chain network;
generating a first block corresponding to transaction data by a predetermined first main node in each first node set, wherein the first main node is determined based on the hash value of each node in the first node set and the difficulty value of a transaction block chain, and the transaction block chain is used for recording the transaction data in the block chain network;
the first main node of each first node set respectively sends a first block corresponding to each first node set to the second node set;
combining each first block into a second block by a predetermined second main node in the second node set, wherein the second main node is a newly added node in the second node set;
all nodes in the second set of nodes make a second consensus for the second block,
the second node collectively generates a transaction block corresponding to the transaction data by a predetermined second master node. .
In a second aspect, the present application provides a group consensus apparatus for a blockchain network, the blockchain network including a plurality of first node sets and second node sets, the first node sets being used for consensus transaction data, the second node sets including a first fixed number of nodes, the second node sets being used for generating transaction blocks, the apparatus including:
the consensus module is configured to perform first consensus on the transaction data in the blockchain network by each first node set;
the generating module is configured to generate a first block corresponding to the transaction data by a predetermined first main node in each first node set, wherein the first main node is determined based on the hash value of each node in the first node set and the difficulty value of a transaction block chain, and the transaction block chain is used for recording the transaction data in the block chain network;
a sending module configured to send a first block corresponding to each first node set to a second node set by a first host node of each first node set, respectively;
the combination module is configured to combine each first block into a second block by a predetermined second main node in the second node set, wherein the second main node is a newly added node in the second node set;
a consensus module further configured to perform a second consensus on the second block for all nodes in the second set of nodes,
the generating module is further configured to generate a transaction block corresponding to the transaction data by a second main node predetermined in the second node set.
In a third aspect, the present application provides a computer device comprising:
a processor;
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the packet consensus method for a blockchain network as in the first aspect.
In a fourth aspect, the present application provides a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the packet consensus method for a blockchain network as in the first aspect.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
the grouping consensus method, the grouping consensus device, the grouping consensus equipment and the grouping consensus medium for the blockchain network, which are provided by the embodiment of the application, can utilize each first node set to perform first consensus on transaction data in the blockchain network respectively; after the first consensus, each first node set generates a first block corresponding to the transaction data by a predetermined first main node; the first main node of each first node set respectively sends a first block corresponding to each first node set to the second node set; combining each first block into a second block by a predetermined second main node in the second node set; all nodes in the second node set perform second consensus on the second block; after the second consensus, a second host node, predetermined in the second set of nodes, generates a transaction block corresponding to the transaction data. The nodes in the blockchain network are grouped to carry out consensus on transaction data, so that the throughput of the blockchain network is improved, the nodes with higher computing capability in the blockchain network generate transaction blocks, and the waste of computing resources is reduced.
After a transaction block is generated, the first main node of each first node set is updated to be a new first main node, after a second main node generates a second fixed number of transaction blocks, the first node set and the second node set are updated, a new second main node in the updated second node set is determined, a management block is generated by using the new second main node, the characteristic that a node can be added into a block chain network at any time in a distributed block chain network is fully considered, and the newly added qualified node can participate in the process of common identification of transaction data.
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 packet consensus method for a blockchain network according to an embodiment of the present disclosure;
fig. 2 is a flow chart of another packet consensus method for a blockchain network in an embodiment of the present application;
fig. 3 is a schematic structural diagram of a packet consensus device for a blockchain network according to an embodiment of the present application;
fig. 4 is a schematic diagram of another packet consensus device for a blockchain network according to an embodiment of the present application;
FIG. 5 is a diagram illustrating a computer system according to an embodiment of the present application.
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.
The embodiment of the application provides a grouping consensus method for a blockchain network, which can be applied to the blockchain network using a workload certificate (POW) as a consensus algorithm, and can reduce the waste of operation resources and improve the throughput of the whole blockchain network. The method can be applied to mobile terminal equipment (such as a smart phone, a tablet computer and the like) and can also be applied to a fixed terminal (a desktop computer) or a server.
As shown in fig. 1, the method includes:
step 101, each first node set respectively performs first consensus on transaction data in the blockchain network.
In an embodiment of the application, the blockchain network comprises a plurality of first node sets and second node sets, each first node set being used for co-identifying the transaction data, the second node sets being used for generating transaction blocks, the second node sets comprising a first fixed number of nodes.
Step 102, a predetermined primary master node in each primary node set generates a first block corresponding to transaction data.
In an embodiment of the present application, the first master node is determined based on the hash value of each node in the first node set and a difficulty value of a transaction blockchain used for recording transaction data in the blockchain network.
Step 103, the first master node of each first node set sends the first block corresponding to each first node set to the second node set, respectively.
And 104, combining each first block into a second block by a second main node which is predetermined in the second node set.
In this embodiment of the present application, the predetermined second master node is a node that is newly added in the second node set.
And 105, performing a second consensus on the second block by all the nodes in the second node set.
And 106, generating a transaction block corresponding to the transaction data by a second main node which is determined in advance in the second node set.
In summary, in the packet consensus method for the blockchain network provided in the embodiment of the present application, each first node set may be used to perform first consensus on transaction data in the blockchain network; after the first consensus, each first node set generates a first block corresponding to the transaction data by a predetermined first main node; the first main node of each first node set respectively sends a first block corresponding to each first node set to the second node set; combining each first block into a second block by a predetermined second main node in the second node set; performing a second consensus on the second block by all nodes of the second node set; after the second consensus, a second host node, predetermined in the second set of nodes, generates a transaction block corresponding to the transaction data. The nodes in the block chain network are grouped to carry out consensus on transaction data, so that the throughput of the block chain network is improved, the nodes with higher computing power in the block chain network generate transaction blocks, and the waste of computing resources is reduced.
The embodiment of the application provides a grouping consensus method for a blockchain network, which can be applied to the blockchain network using a workload certificate (POW) as a consensus algorithm, and can reduce the waste of operation resources and improve the throughput of the whole blockchain network. The method can be applied to mobile terminal equipment (such as a smart phone, a tablet computer and the like) and can also be applied to a fixed terminal (a desktop computer) or a server.
It should be noted that, in the embodiment of the present application, all nodes in the blockchain network are divided into two types: the plurality of first node sets and the second node sets are matched with each other, so that the transaction data in the blockchain network can be processed. Each first node set is used for carrying out first consensus on legal transaction data in the block chain network to generate a plurality of first blocks; the second node set is used for combining the plurality of first blocks into a second block, identifying the second block in a consensus manner, generating a final transaction block and maintaining a transaction block chain in the block chain network; optionally, in the blockchain network, the second node set further maintains a management blockchain, and a management block on the management blockchain is used to record nodes in the second node set. The classification process of the nodes in the blockchain network is completed by a second node set predetermined in the blockchain network, and the process is as follows: and the predetermined second node set receives hash values sent by nodes in a plurality of first node sets in the block chain network, judges whether each hash value is smaller than the difficulty value of the management block chain, if so, adds the node corresponding to the hash value received firstly into the predetermined second node set, and removes the node added firstly in the second node set. It should be noted that, in the embodiment of the present application, the number of nodes in the second node set is fixed, and when a new node is added to the second node set, a predetermined node that is added first in the second node set is removed, so that the number of nodes in the second node set is ensured to be the first fixed number. The first fixed number may be determined based on actual needs of the blockchain network, which is not described in detail in this embodiment of the present application. And if the hash value is larger than or equal to the difficulty value of the transaction block chain, judging whether the hash value is smaller than the difficulty value of the transaction block chain, if so, sequencing the nodes corresponding to the plurality of hash values according to the sequence of the hash values from large to small to determine a node sequence, and determining a plurality of updated first node sets based on the node sequence for performing first consensus on the transaction data in the block chain network. The difficulty value is used for judging whether the computing capability of a certain node in the block chain network meets the requirement of a transaction block chain or a management block chain.
As shown in fig. 2, the packet consensus method for a blockchain network includes:
step 201, each first node set respectively performs a first consensus on the transaction data in the blockchain network.
In this step, after receiving a legal transaction in the blockchain network, the transaction data may be respectively identified by using a plurality of first node sets in the blockchain network.
At step 202, a predetermined primary master node in each set of primary nodes generates a first block corresponding to the transaction data.
In this step, a first master node, predetermined in each first node set, generates a first block corresponding to the transaction data. The first host node is determined based on the hash value of each node in the first node set and a difficulty value of a transaction blockchain, where the transaction blockchain is used to record transaction data in a blockchain network, and a process of predetermining the first host node in the first node set may be: the nodes in the first node set are sequenced according to the sequence of the corresponding hash values from large to small, a corresponding serial number is distributed to each node, the hash value of the latest generated transaction block is obtained, the remainder of the ratio of the hash value of the latest generated transaction block to the total number of the nodes in the first node set is determined, the node corresponding to the serial number with the same remainder is determined as a first main node of the first node set, and the first main node can lead the first node set to perform a first consensus process on transaction data.
Step 203, the first master node of each first node set sends the first block corresponding to each first node set to the second node set, respectively.
Step 204, the second master node predetermined in the second node set combines each first block into a second block.
In this step, the second node set may receive a plurality of first blocks sent by the first host nodes of the plurality of first node sets, and a predetermined second host node in the second node set combines each first block into a second block. The predetermined second master node is a newly added node in the second set of nodes.
Step 205, all nodes of the second node set perform a second consensus on the second block.
Step 206, the second node centralizes the predetermined second master node to generate a transaction block corresponding to the transaction data.
In this step, a second master node, which is predetermined collectively by the second nodes, generates a transaction block corresponding to the transaction data, and records the transaction data.
It should be noted that, in this embodiment of the application, during a transaction block generation period, the second node set may receive a plurality of first blocks sent by the first host node of each first node set, and the second node set combines each of the first blocks received newly into a second block, and identifies the second block together to generate a transaction block.
And step 207, updating the first main node of each first node set to be a new first main node.
After a transaction block is generated, the first main node of each first node set is updated to be a new first main node, so that each new first main node participates in and dominates a first consensus process of next round transaction data. The process of updating the first host node of each first node set to be a new first host node may refer to the determination process of the first host node of the first node set in step 202, which is not described in detail in this embodiment of the present application. At this point, the consensus process of the transaction data is completed, and the process may return to step 201 to perform the consensus process of the next round of transaction.
Step 208, after the second host node generates the second fixed number of transaction blocks, the first set of nodes and the second set of nodes are updated.
In this embodiment, the blockchain network is a fully distributed system, any node may enter the network at any time, in order to ensure that a newly added node may participate in the consensus process of transaction data during the generation of the transaction blocks, after a second fixed number of transaction blocks are generated, the nodes in the blockchain need to be classified and grouped again, and the first node set and the second node set are updated, where the second fixed number may be determined based on actual needs, and may be, for example, 100.
The process of updating the plurality of first node sets and the second node set may include: a second node set receives hash values sent by nodes in a plurality of first node sets in a block chain network; judging whether each hash value is smaller than the difficulty value of the management block chain; if the hash value is smaller than the first hash value, adding the node corresponding to the first received hash value into the second node set, and removing the node added first in the second node set to determine an updated second node set; if the hash value is larger than or equal to the difficulty value of the transaction block chain, judging whether the hash value is smaller than the difficulty value of the transaction block chain; if the number of the nodes is smaller than the preset threshold value, sorting the nodes corresponding to the plurality of hash values according to the descending order of the hash values to determine a node sequence, and determining a plurality of updated first node sets based on the node sequence; and if the hash value is larger than or equal to the preset threshold value, determining the nodes corresponding to the hash values as candidate nodes.
The process of determining the updated plurality of first node sets based on the node sequence may be: determining the number M of nodes in a node sequence, obtaining the predetermined number N of updated first node sets, determining the number T of nodes in each updated first node set based on the ratio of the number of nodes in the node sequence to the predetermined number of updated first node sets, selecting T nodes in the node sequence from large to small or from small to large, determining the node sequence as a first node set, repeating the selection process of the T nodes, and determining a plurality of updated first node sets. For the case that the ratio of the number M to the number N is a non-integer, the remaining nodes in the node sequence may be randomly allocated to the plurality of first node sets that have been re-determined, so as to ensure that the number of nodes in each first node set is substantially equivalent.
For example, it is determined that the number of nodes in the node sequence is 100, and the number of the predetermined updated first node sets is 6, then the number of nodes in each updated first node set is 16, 1 st to 15 th nodes are selected from the node sequence according to the descending order, the 1 st to 15 th nodes are determined as one first node set, the 16 th to 31 th nodes are selected, the 16 th to 31 th nodes are determined as one first node set, and so on, six first node sets are determined, and the remaining 97 th to 100 th nodes in the node sequence are randomly allocated to the determined 6 first node sets.
And step 209, determining a new second main node in the updated second node set.
In this step, a new second master node in the updated second node set needs to be determined, where the new second master node is a node corresponding to the hash value of the value whose hash value is less than the difficulty of managing the block chain and is a newly added node in the second node set.
Step 210, the new secondary master node generates a management block.
In this step, a new second host node generates a management block, and updates the management block to a management block chain, where each management block in the management block chain is used to record a node included in the updated second node set.
In summary, in the packet consensus method for the blockchain network provided in the embodiment of the present application, each first node set may be used to perform first consensus on transaction data in the blockchain network; after the first consensus, each first node set generates a first block corresponding to the transaction data by a predetermined first main node; the first main node of each first node set respectively sends a first block corresponding to each first node set to the second node set; combining each first block into a second block by a predetermined second main node in the second node set; all nodes in the second node set perform second consensus on the second block; after the second consensus, a second host node, predetermined in the second set of nodes, generates a transaction block corresponding to the transaction data. The nodes in the blockchain network are grouped to carry out consensus on transaction data, so that the throughput of the blockchain network is improved, the nodes with higher computing capability in the blockchain network generate transaction blocks, and the waste of computing resources is reduced.
After a transaction block is generated, the first main node of each first node set is updated to be a new first main node, after a second main node generates a second fixed number of transaction blocks, the first node set and the second node set are updated, a new second main node in the updated second node set is determined, a management block is generated by using the new second main node, the characteristic that a node can be added into a block chain network at any time in a distributed block chain network is fully considered, and the newly added qualified node can participate in the process of common identification of transaction data.
An embodiment of the present application provides a grouping consensus apparatus for a blockchain network, where the blockchain network includes a plurality of first node sets and second node sets, each first node set is used for consensus transaction data, each second node set includes a first fixed number of nodes, and each second node set is used for generating a transaction block, as shown in fig. 3, the apparatus 30 includes:
a consensus module 301 configured to perform a first consensus on the transaction data in the blockchain network respectively for each first node set;
a generating module 302 configured to generate a first block corresponding to transaction data by a predetermined first host node in each first node set, where the first host node is determined based on a hash value of each node in the first node set and a difficulty value of a transaction block chain, and the transaction block chain is used for recording the transaction data in the block chain network;
a sending module 303, configured to send, by the first master node of each first node set, a first block corresponding to each first node set to the second node set, respectively;
a combining module 304 configured to combine each first block into a second block by a predetermined second master node in the second node set, where the second master node is a newly added node in the second node set;
a consensus module 301 further configured to perform a second consensus on the second block for all nodes in the second set of nodes,
the generating module 302 is further configured to generate a transaction block corresponding to the transaction data by a second master node predetermined in the second node set.
Optionally, the generating module 302 includes a determining unit, configured to:
sorting the nodes in the first node set according to the descending order of the corresponding hash values, and distributing corresponding serial numbers to each node;
acquiring a hash value of a newly generated transaction block;
determining the remainder of the ratio of the hash value of the newly generated transaction block to the total number of nodes in the first node set;
and determining the node corresponding to the sequence number with the same remainder as a first main node of the first node set.
Optionally, as shown in fig. 4, the apparatus 30 further includes:
an update module 305 configured to update the first host node of each first node set to a new first host node after the second host node generates each transaction block.
Optionally, as shown in fig. 4, the apparatus 30 further includes:
an update module 305 further configured to update the first set of nodes and the second set of nodes after the second host node generates a second fixed number of transaction blocks;
a determination module 306 configured to determine a new second master node in the updated set of second nodes,
the generating module 302 is further configured to generate a management block by the new second host node, and update the management block to a management block chain, where each management block in the management block chain is used to record a node included in the updated second node set.
Optionally, the updating module 305 is configured to:
a second node set receives hash values sent by nodes in a plurality of first node sets in a block chain network;
judging whether each hash value is smaller than the difficulty value of the management block chain;
if the hash value is smaller than the first hash value, adding the node corresponding to the first received hash value into the second node set, and removing the node added first in the second node set to determine an updated second node set;
if the hash value is larger than or equal to the difficulty value of the transaction block chain, judging whether the hash value is smaller than the difficulty value of the transaction block chain;
if the number of the nodes is smaller than the preset threshold value, sorting the nodes corresponding to the plurality of hash values according to the descending order of the hash values to determine a node sequence, and determining a plurality of updated first node sets based on the node sequence;
and if the hash value is larger than or equal to the preset threshold value, determining the nodes corresponding to the hash values as candidate nodes.
In summary, the grouping consensus device for the blockchain network provided in the embodiment of the present application may perform the first consensus on the transaction data in the blockchain network by using each first node set; after the first consensus, each first node set generates a first block corresponding to the transaction data by a predetermined first main node; the first main node of each first node set respectively sends a first block corresponding to each first node set to the second node set; combining each first block into a second block by a predetermined second main node in the second node set; all nodes in the second node set perform second consensus on the second block; after the second consensus, a second host node, predetermined in the second set of nodes, generates a transaction block corresponding to the transaction data. The nodes in the blockchain network are grouped to carry out consensus on transaction data, so that the throughput of the blockchain network is improved, the nodes with higher computing capability in the blockchain network generate transaction blocks, and the waste of computing resources is reduced.
After a transaction block is generated, the first main node of each first node set is updated to be a new first main node, after a second main node generates a second fixed number of transaction blocks, the first node set and the second node set are updated, a new second main node in the updated second node set is determined, a management block is generated by using the new second main node, the characteristic that a node can be added into a block chain network at any time in a distributed block chain network is fully considered, and the newly added qualified node can participate in the process of common identification of transaction data.
In an embodiment of the present application, a computer system is disclosed, as shown in fig. 5, which is a schematic diagram of a computer system in an embodiment of the present application, including: a Central Processing Unit (CPU)401 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for system operation are also stored. The CPU 401, ROM 402, and RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. Drivers are also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts 1 and 2 may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section, and/or installed from a removable medium. The above-described functions defined in the system of the present application are executed when the computer program is executed by a Central Processing Unit (CPU) 401.
It should be noted that the computer readable medium shown in the present application may be a computer readable signal medium or a computer readable medium or any combination of the two. A computer readable medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 application. 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 or flowchart illustration, and combinations of blocks in the block diagrams 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 described in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves. The described units or modules may also be provided in a processor, and may be described as: a processor includes a consensus module, a generation module, a transmission module, and a combination module. Where the names of these units or modules do not in some cases constitute a limitation of the unit or module itself, for example, the consensus module may also be described as "consensus module for each first set of nodes to perform a first consensus on transaction data in the blockchain network, respectively".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The above-mentioned computer readable medium carries one or more programs which, when executed by one of the electronic devices, cause the electronic device to implement the packet consensus method for a blockchain network as described in the above-mentioned embodiments.
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 a person skilled in the art that the scope of the invention as referred to in the present application is not limited to the embodiments with a specific combination of the above-mentioned features, but also covers other embodiments with any combination of the above-mentioned features or their equivalents without departing from the inventive concept. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (10)

1. A method for group consensus for a blockchain network comprising a plurality of first node sets for consensus transaction data and second node sets comprising a first fixed number of nodes for generating transaction blocks, the method comprising:
each first node set respectively carries out first consensus on transaction data in the block chain network;
generating a first block corresponding to the transaction data by a predetermined first main node in each first node set, wherein the first main node is determined based on the hash value of each node in the first node set and the difficulty value of a transaction block chain, and the transaction block chain is used for recording the transaction data in a block chain network;
a first main node of each first node set respectively sends the first blocks corresponding to each first node set to a second node set;
a second main node which is predetermined in the second node set combines each first block as a second block, wherein the second main node is a newly added node in the second node set;
all nodes in the second set of nodes make a second consensus for the second block,
a second main node which is predetermined in the second node set generates a transaction block corresponding to the transaction data;
updating the first set of nodes and the second set of nodes after the second host node generates a second fixed number of the transaction blocks;
wherein said updating the first set of nodes and the second set of nodes comprises:
the second node set receives hash values sent by nodes in a plurality of first node sets in the block chain network;
judging whether each hash value is smaller than a difficulty value of a management block chain, wherein a management block in the management block chain is used for recording nodes contained in the second node set;
if the hash value is smaller than the first hash value, adding a node corresponding to the first received hash value into the second node set, and removing the node added first in the second node set to determine the updated second node set;
if the hash value is larger than or equal to the difficulty value of the transaction block chain, judging whether the hash value is smaller than the difficulty value of the transaction block chain;
if the number of the nodes is smaller than the preset threshold value, sequencing the nodes corresponding to the hash values in a descending order of the hash values to determine a node sequence, and determining a plurality of updated first node sets based on the node sequence;
and if the hash value is larger than or equal to the preset threshold value, determining the nodes corresponding to the hash values as candidate nodes.
2. The method of claim 1, wherein each of the first node sets a predetermined first master node, comprising:
sorting the nodes in the first node set according to the descending order of the corresponding hash values, and allocating corresponding serial numbers to each node;
acquiring a hash value of a newly generated transaction block;
determining a remainder of a ratio of the hash value of the newly generated transaction block to the total number of nodes in the first node set;
and determining the node corresponding to the serial number which is the same as the remainder as a first main node of the first node set.
3. The method of claim 1, further comprising:
after the second master node generates each of the transaction blocks, updating the first master node of each of the first node sets to be a new first master node.
4. The method of any of claims 1 to 3, wherein after updating the first set of nodes and the second set of nodes, the method further comprises:
determining a new second master node in the updated second set of nodes,
the new second master node generates a management block and updates the management block to a management block chain.
5. A packet consensus apparatus for a blockchain network, the blockchain network comprising a plurality of first node sets and a second node set, the first node sets being for consensus transaction data, the second node set comprising a first fixed number of nodes, the second node set being for generating a transaction block, the apparatus comprising:
a consensus module configured to perform a first consensus on the transaction data in the blockchain network respectively for each of the first node sets;
a generating module configured to generate a first block corresponding to the transaction data by a predetermined first host node in each first node set, where the first host node is determined based on a hash value of each node in the first node set and a difficulty value of a transaction block chain used for recording transaction data in a block chain network;
a sending module configured to send the first block corresponding to each of the first node sets to a second node set by a first master node of each of the first node sets, respectively;
a combination module configured to combine each of the first blocks into a second block by a predetermined second master node in the second node set, where the second master node is a newly added node in the second node set;
the consensus module further configured to perform a second consensus on the second tile for all nodes in the second set of nodes,
the generating module is further configured to generate a transaction block corresponding to the transaction data by a second master node predetermined in the second node set;
an update module configured to update the first set of nodes and the second set of nodes after the second host node generates a second fixed number of the transaction blocks;
wherein the update module is configured to:
the second node set receives hash values sent by nodes in a plurality of first node sets in the block chain network;
judging whether each hash value is smaller than a difficulty value of a management block chain, wherein a management block in the management block chain is used for recording nodes contained in the second node set;
if the hash value is smaller than the first hash value, adding a node corresponding to the first received hash value into the second node set, and removing the node added first in the second node set to determine the updated second node set;
if the hash value is larger than or equal to the difficulty value of the transaction block chain, judging whether the hash value is smaller than the difficulty value of the transaction block chain;
if the number of the nodes is smaller than the preset threshold value, sequencing the nodes corresponding to the hash values in a descending order of the hash values to determine a node sequence, and determining a plurality of updated first node sets based on the node sequence;
and if the hash value is larger than or equal to the preset threshold value, determining the nodes corresponding to the hash values as candidate nodes.
6. The apparatus of claim 5, wherein the generating module comprises a determining unit configured to:
sorting the nodes in the first node set according to the descending order of the corresponding hash values, and allocating corresponding serial numbers to each node;
acquiring a hash value of a newly generated transaction block;
determining a remainder of a ratio of the hash value of the newly generated transaction block to the total number of nodes in the first node set;
and determining the node corresponding to the serial number which is the same as the remainder as a first main node of the first node set.
7. The apparatus of claim 5, further comprising:
the update module is configured to update the first host node of each of the first node sets to a new first host node after the second host node generates each of the transaction blocks.
8. The apparatus of any of claims 5 to 7, further comprising:
a determination module configured to determine a new second master node in the updated second set of nodes,
the generating module is further configured to generate a management block by the new second master node and update the management block to a management block chain.
9. A computer device, characterized in that the computer device comprises:
a processor;
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the packet consensus method for a blockchain network according to any one of claims 1 to 4.
10. A computer-readable medium, in which a computer program is stored which, when being executed by a processor, carries out the packet consensus method for a blockchain network according to any one of claims 1 to 4.
CN201911096465.0A 2019-11-11 2019-11-11 Packet consensus method, apparatus, device, and medium for blockchain networks Active CN110852882B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911096465.0A CN110852882B (en) 2019-11-11 2019-11-11 Packet consensus method, apparatus, device, and medium for blockchain networks

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911096465.0A CN110852882B (en) 2019-11-11 2019-11-11 Packet consensus method, apparatus, device, and medium for blockchain networks

Publications (2)

Publication Number Publication Date
CN110852882A CN110852882A (en) 2020-02-28
CN110852882B true CN110852882B (en) 2020-11-20

Family

ID=69601240

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911096465.0A Active CN110852882B (en) 2019-11-11 2019-11-11 Packet consensus method, apparatus, device, and medium for blockchain networks

Country Status (1)

Country Link
CN (1) CN110852882B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111368343B (en) * 2020-03-31 2022-11-01 北京俩撇科技有限公司 Block chain system, data storage method and device
CN111464630B (en) * 2020-03-31 2021-07-06 杭州复杂美科技有限公司 Transaction broadcasting method, apparatus and storage medium
CN112256305B (en) * 2020-11-04 2022-05-10 暗链科技(深圳)有限公司 Block chain software updating method and system
CN113079139B (en) * 2021-03-23 2022-11-29 中国工商银行股份有限公司 Block chain-based consensus group master node determination method, device and system
CN113037863B (en) * 2021-03-31 2022-07-12 杭州云象网络技术有限公司 Block chain multi-party collaborative cross consensus verification method and system
CN113254272B (en) * 2021-06-09 2022-09-13 腾讯科技(深圳)有限公司 Data processing method and device for block chain network, computer equipment and medium
CN113919846B (en) * 2021-12-15 2022-03-08 腾讯科技(深圳)有限公司 Block link point dynamic grouping method and device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108366113A (en) * 2018-02-08 2018-08-03 南京邮电大学 A kind of high fault-tolerant common recognition mechanism of the grouping based on DPOS
CN109819003A (en) * 2017-11-22 2019-05-28 南京理工大学 A kind of layering common recognition method and system of block chain
CN110011974A (en) * 2019-03-07 2019-07-12 深圳市融汇通金科技有限公司 Bookkeeping methods, device, terminal and the computer readable storage medium of block chain

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190325038A1 (en) * 2018-04-21 2019-10-24 Keir Finlow-Bates Consensus based editable blockchain
CN108830712A (en) * 2018-05-17 2018-11-16 易链科技(深圳)有限公司 Method, apparatus, equipment and the medium that block generates
CN109242685B (en) * 2018-08-29 2020-05-12 众安信息技术服务有限公司 Block chain-based consensus and verification method and device
CN109872159B (en) * 2019-01-07 2021-04-06 必可嘉(武汉)科技有限公司 Block chain consensus method and architecture

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109819003A (en) * 2017-11-22 2019-05-28 南京理工大学 A kind of layering common recognition method and system of block chain
CN108366113A (en) * 2018-02-08 2018-08-03 南京邮电大学 A kind of high fault-tolerant common recognition mechanism of the grouping based on DPOS
CN110011974A (en) * 2019-03-07 2019-07-12 深圳市融汇通金科技有限公司 Bookkeeping methods, device, terminal and the computer readable storage medium of block chain

Also Published As

Publication number Publication date
CN110852882A (en) 2020-02-28

Similar Documents

Publication Publication Date Title
CN110852882B (en) Packet consensus method, apparatus, device, and medium for blockchain networks
US20190228303A1 (en) Method and apparatus for scheduling resource for deep learning framework
CN110750341A (en) Task scheduling method, device, system, terminal equipment and storage medium
CN108933695B (en) Method and apparatus for processing information
CN110597888A (en) Method, device, medium and equipment for acquiring virtual resources based on block chains
CN110083536B (en) Test resource allocation method and device, electronic equipment and storage medium
CN113194146B (en) Leader node determination method, computer device, and storage medium
CN113037489B (en) Data processing method, device, equipment and storage medium
CN108764866B (en) Method and equipment for allocating resources and drawing resources
CN112837155A (en) Method and device for registering and executing intelligent contracts in block chain
CN111951112A (en) Intelligent contract execution method based on block chain, terminal equipment and storage medium
CN110322350B (en) Method, device, equipment and storage medium for cutting hollow block in consensus network
CN112182374A (en) Inventory control method, device, electronic equipment and computer readable medium
CN109462491B (en) System, method and apparatus for testing server functionality
CN111694670B (en) Resource allocation method, apparatus, device and computer readable medium
CN112182111B (en) Block chain based distributed system layered processing method and electronic equipment
CN113656046A (en) Application deployment method and device
CN113283830A (en) Waybill information sequence generation method, waybill information sequence generation device, waybill information sequence generation equipment and computer readable medium
CN112527454A (en) Container group scheduling method and device, electronic equipment and computer readable medium
CN111898061A (en) Method, device, electronic equipment and computer readable medium for searching network
CN116760717B (en) Communication path query method, device, electronic equipment and computer readable medium
CN112600756B (en) Service data processing method and device
CN113408970B (en) User information generation method and device, electronic equipment and computer readable medium
CN113077352B (en) Insurance service article recommending method based on user information and insurance related information
CN115002133B (en) Data transmission determining method and device based on multiple interfaces

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
GR01 Patent grant
GR01 Patent grant