Blockchain consensus method, apparatus, device, and storage medium
By splitting the blockchain consensus task into a first subtask and a second subtask, which are handled by different nodes, the problem of low efficiency in blockchain transaction consensus is solved, transaction processing speed is improved, and the demand for high-frequency transactions is met.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU PRIME STARK TECH CO LTD
- Filing Date
- 2023-05-29
- Publication Date
- 2026-05-15
AI Technical Summary
Existing blockchain transaction consensus is inefficient and cannot meet the needs of high-frequency transactions, especially in the financial industry where tens of thousands of transactions are processed per second. The large amount of data processed by the Master node affects efficiency.
The blockchain consensus task is divided into a first subtask and a second subtask, which are assigned to different nodes for processing. The first subtask is executed by the member node that receives user transactions or its associated node, while the second subtask is executed by the Master node, which includes sorting and packaging transactions and specifying the block height and putting them on the chain for consensus.
By sharing the data processing load of the Master node, the consensus efficiency of blockchain transactions is improved, the problem of slow transactions is alleviated, and the transaction processing speed is increased.
Smart Images

Figure CN116527670B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, and in particular to a blockchain consensus method, apparatus, device, and storage medium. Background Technology
[0002] Blockchain technology is built on a transmission network (also known as a blockchain network). Distributed node devices (hereinafter referred to as nodes) in the transmission network run blockchain programs to generate block data according to a preset consensus strategy, and use a chain data structure to verify and store block data, ultimately realizing a data anti-tampering mechanism and providing a new, secure, and reliable technical approach for business operations.
[0003] In existing technologies, blockchains employ a network-wide consensus mechanism to achieve transaction security, data tamper-proofing, and ledger traceability. All nodes need to send transactions to the Master node for packaging and on-chain consensus. This results in a large amount of data that the Master node needs to process, thus affecting the efficiency of blockchain transaction consensus. This cannot meet the needs of high-frequency transactions, such as the tens of thousands of transactions per second in the financial industry. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a blockchain consensus method, apparatus, device and storage medium to solve the technical problem of low efficiency in blockchain transaction consensus in the prior art.
[0005] The technical solution adopted in this invention is:
[0006] On one hand, the present invention provides a blockchain consensus method, the method comprising:
[0007] Obtain the consensus task corresponding to blockchain transaction consensus;
[0008] Based on the data processing characteristics of the consensus task, the consensus task is divided into a first subtask and a second subtask;
[0009] Based on the node attributes of the blockchain member nodes, the first subtask is assigned to the first node, and the second subtask is assigned to the Master node;
[0010] The first node is a member node or its associated node that receives user-end transactions.
[0011] Preferably, the first subtask is to sort and package multiple target transactions to be uploaded to the blockchain, and the second subtask is to specify the block height and upload the multiple target transactions to the blockchain after sorting and packaging them.
[0012] Preferably, the first node is a member node that receives user-end transactions, and the method further includes:
[0013] Responding to multiple target transactions submitted by the user to the first node;
[0014] The first node sorts and packages the multiple target transactions to obtain a transaction package containing all the target transactions, and submits the transaction package to the Master node;
[0015] The Master node specifies the block height of the transaction package and puts it on-chain for consensus.
[0016] Preferably, the first node is an associated node of a member node that receives user-end transactions, and the method further includes:
[0017] In response to multiple second nodes sending to multiple target transactions, the multiple target transactions are divided into multiple transaction clusters;
[0018] The target transactions in each of the aforementioned transaction clusters are sorted to obtain multiple target clusters;
[0019] All target clusters are packaged to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node;
[0020] The Master node specifies the block height of the transaction package and puts it on-chain for consensus.
[0021] Preferably, the blockchain network includes a global network and multiple partition networks, wherein the first subtask is executed by the partition networks and the second subtask is executed by the global network.
[0022] Preferably, the first node is a member node that receives user-end transactions, and executing the first sub-task includes:
[0023] Obtain the address information corresponding to each response information of the first broadcast information in the first network partition, wherein the first broadcast information is the transaction collection information issued by the first node when there is a consensus transaction to be uploaded to the chain, and the first node belongs to the first partition network;
[0024] Based on the address information, the target transactions of each third node are collected, wherein the third node is a member node in the first partition network that responds to the first broadcast information;
[0025] The first subtask is executed according to each of the target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
[0026] Preferably, the first node is an associated node of a member node that receives user-end transactions, and executing the first sub-task includes:
[0027] Obtain each of the target transactions submitted by each third node in the first partition network;
[0028] The first subtask is executed according to each of the target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
[0029] On the other hand, the present invention also provides a blockchain consensus device, comprising:
[0030] Data acquisition module: used to acquire the consensus task corresponding to the blockchain transaction consensus;
[0031] Task splitting module: used to divide the consensus task into a first subtask and a second subtask based on the data processing characteristics of the consensus task;
[0032] Task allocation module: used to allocate the first subtask to the first node and the second subtask to the Master node according to the node attributes of the blockchain member nodes;
[0033] The first node is a member node or its associated node that receives user-end transactions.
[0034] On the other hand, the present invention also provides an electronic device, comprising: at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method described in any of the preceding claims.
[0035] On the other hand, the present invention also provides a medium having computer program instructions stored thereon, which, when executed by a processor, implement the method described in any of the preceding claims.
[0036] In summary, the beneficial effects of the present invention are as follows:
[0037] The blockchain consensus method, apparatus, device, and storage medium provided by this invention divide the blockchain consensus task into a first subtask and a second subtask according to the data processing characteristics. The first subtask is assigned to the first node for execution, while the second subtask is reserved for execution on the Master node. By utilizing multiple subtasks to be completed by different blockchain nodes, the amount of data that the Master node needs to process during the consensus of blockchain transactions is shared, saving the time of the Master node in uploading transaction packages, improving the consensus efficiency of the Master node in processing transactions to be uploaded to the chain, and thereby improving the blockchain transaction efficiency by improving the consensus efficiency of the blockchain, thus alleviating the problem of slow blockchain transactions. Attached Figure Description
[0038] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments of the present invention will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, and these are all within the protection scope of the present invention.
[0039] Figure 1 This is a flowchart illustrating the blockchain consensus acquisition method in Embodiment 1 of the present invention;
[0040] Figure 2 This is a schematic diagram of the process for obtaining the step-by-step consensus task in Embodiment 1 of the present invention;
[0041] Figure 3 This is a schematic diagram of the target transaction consensus process in Embodiment 1 of the present invention when the first node is a member node that does not receive user-end transactions;
[0042] Figure 4 This is a schematic diagram of the blockchain transaction device structure in Embodiment 2 of the present invention;
[0043] Figure 5 This is a schematic diagram of the electronic device in Embodiment 3 of the present invention. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. In the description of the present invention, it should be understood that the terms "center," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. Where there is no conflict, the various features of this invention and its embodiments can be combined with each other, all of which are within the scope of protection of this invention.
[0045] Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks (blocks) linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and to generate the next block. A blockchain can include an underlying platform, a platform product service layer, and an application service layer.
[0046] A blockchain network comprises multiple member nodes, which can serve as clients forming the network. Each member node, in its normal operation, receives input information and maintains shared data within the blockchain network based on this information. To ensure interoperability within the blockchain network, information connections exist between each member node, enabling data transmission. For example, when any member node receives input information, other nodes in the network retrieve this input information according to a consensus algorithm and store it as shared data, ensuring data consistency across all nodes in the blockchain network.
[0047] In a blockchain network, each node can be a server or a terminal device. A server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Terminal devices can be smartphones, tablets, laptops, desktop computers, smart speakers, smartwatches, etc., but are not limited to these. Nodes can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions on this.
[0048] Example 1
[0049] Please see Figure 1 , Figure 1 The blockchain consensus method in Embodiment 1 of the present invention includes:
[0050] S1: Obtain the consensus task corresponding to the blockchain transaction consensus;
[0051] S2: Based on the data processing characteristics of the consensus task, the consensus task is divided into a first subtask and a second subtask;
[0052] S3: Based on the node attributes of the blockchain member nodes, assign the first subtask to the first node and the second subtask to the Master node;
[0053] The first node is a member node or its associated node that receives user-end transactions.
[0054] Specifically, the data processing involved in the consensus process of blockchain transaction on-chain is denoted as the consensus task. According to the data processing characteristics, the data processing links involved in the consensus task are divided into the first subtask and the second subtask. It should be noted that, based on different considerations, the consensus task can be divided into multiple subtasks, not limited to the first and second subtasks. Then, according to the member nodes involved in the blockchain transaction, the first subtask and the second subtask are completed respectively according to the node attributes. Preferably, the first subtask is processed by the first node that receives the transaction submitted by the user or its associated node, and the second subtask is executed by the Master node that puts the target transaction on-chain.
[0055] The blockchain consensus method of the present invention divides the blockchain consensus task into a first subtask and a second subtask according to the data processing characteristics. The first subtask is assigned to the first node for execution, while the second subtask is reserved for execution on the Master node. By utilizing multiple subtasks to be completed by different blockchain nodes, the amount of data that the Master node needs to process during the consensus of blockchain transactions is shared, saving the time of the Master node in uploading transaction packages to the chain, improving the consensus efficiency of the Master node in processing transactions to be uploaded to the chain, and thereby improving the blockchain transaction efficiency by improving the consensus efficiency of the blockchain, thus improving the slow blockchain transaction problem.
[0056] In one embodiment, the first subtask is to sort and package multiple target transactions to be uploaded to the blockchain, and the second subtask is to specify the block height and upload the multiple target transactions to the blockchain after sorting and packaging them.
[0057] Specifically, the data processing involved in blockchain transaction consensus includes sorting, packaging, and specifying block height. Based on the necessity of data processing by the Master node, the first sub-task includes transaction sorting and packaging, and the second sub-task includes specifying the block height for the sorted and packaged transaction package. This block height is the block height of the transaction package on the blockchain, thereby minimizing the amount of data and processing steps that the Master node needs to process. The consensus task can be split in ways that are not limited to the above methods, or it can be split into multiple sub-tasks according to the processing steps. Here, no specific limitation is made on the splitting method of the consensus method.
[0058] In one embodiment, please refer to Figure 2 The first node is a member node that receives user-end transactions, and the method further includes:
[0059] S4: Response to multiple target transactions submitted by the user to the first node;
[0060] S5: The first node sorts and packages the multiple target transactions to obtain a transaction package containing all the target transactions, and submits the transaction package to the Master node;
[0061] S6: The Master node specifies the block height of the transaction package and puts it on the chain for consensus.
[0062] Specifically, the first subtask is to receive transactions submitted by user clients. The first node sorts and packages the multiple target transactions it receives, and submits the sorted and packaged transaction package to the Master node. The Master node then distributes the transaction package to the consensus nodes of the blockchain for consensus. A member node on the blockchain can correspond to multiple user clients, that is, the first node can receive transaction requests submitted by multiple user clients and transform each transaction request into a corresponding target transaction.
[0063] In one embodiment, please refer to Figure 3 The first node is an associated node of a member node that receives user-end transactions, and the method further includes:
[0064] S7: In response to multiple second nodes sending to multiple target transactions, divide the multiple target transactions into multiple transaction clusters;
[0065] S8: Sort the target transactions in each of the transaction clusters to obtain multiple target clusters;
[0066] S9: Package all target clusters to obtain a transaction package containing all the target transactions, and submit the transaction package to the Master node;
[0067] S10: The Master node specifies the block height of the transaction package and puts it on the chain for consensus.
[0068] Specifically, the user submits a transaction request to the corresponding second node. The second node transforms the user's transaction request into a target transaction. Multiple second nodes correspond to one first node. The first node collects multiple target transactions from each second node and then divides these target transactions into multiple transaction clusters based on their source. For example, first node A corresponds to four second nodes: second node a, second node b, second node c, and second node d. First node A receives ten transactions with transaction numbers ta1, tb2, tc0, ta3, ta0, td1, ta2, tb1, td3, and td2. Here, "ta" is the prefix of the target transaction number corresponding to second node a, "tb" is the prefix of the target transaction number corresponding to second node b, "tc" is the prefix of the target transaction number corresponding to second node c, and "td" is the prefix of the target transaction number corresponding to second node d. These target transactions are then divided into four transaction clusters based on their source. Group a, trading cluster b, trading cluster c, and trading cluster d are defined. Trading cluster a includes four target transactions: ta1, ta3, ta0, and ta2. Trading cluster b includes two target transactions: tb2 and tb1. Trading cluster c includes one target transaction: tc0. Trading cluster d includes three transactions: td1, td3, and td2. Each trading cluster is then sorted to obtain its target clusters. The target clusters corresponding to trading cluster a are ta0, ta1, ta2, and ta3. The target clusters b corresponding to cluster b are tb1 and tb2, the target cluster c corresponding to cluster c is tc0, and the target cluster d corresponding to cluster d is td1, td2, and td3. Then, the four target clusters are packaged into a transaction package. The order of the 10 target transactions in the transaction package is ta0, ta1, ta2, ta3, tb1, tb2, tc0, td1, td2, and td3. The order of the target clusters in the transaction package is not limited to the above arrangement and can be other orders.
[0069] In one embodiment, the blockchain network includes a global network and multiple partition networks, wherein the first subtask is executed by the partition networks and the second subtask is executed by the global network.
[0070] Specifically, this consensus method can also be applied to the blockchain architecture corresponding to a layered network. The blockchain includes a global network and multiple partitioned networks. The global network is composed of all organizations within the blockchain and contains a global ledger maintained by all organizations. The blockchain is divided into multiple partitioned networks based on the types of business each node needs to conduct (first classification method), or multiple blockchain nodes completing specific business transactions can form corresponding partitioned networks (second classification method). Partitioned networks completing the same transaction type can be included. The first classification method can include multiple partitioned networks obtained through the second classification method. For example, in a blockchain consisting of wealth management subsidiary A, wealth management subsidiary B, wealth management subsidiary C, and sales bank A, sales bank B, and sales bank C, when dividing the partitioned networks according to the second classification method, wealth management subsidiary A and sales bank A are... One partitioned network, and wealth management subsidiary B and sales bank A form another partitioned network. If classified according to the first method, the two partitioned networks would be classified as the same partitioned network. The specific method of partitioning the network is not limited here. The first subtask is executed by the partitioned network, that is, the transactions submitted by the partitioned network to the Master node to be uploaded to the chain are completed and packaged transaction packages. The Master node only needs to specify the block height of the transaction package and then perform global network consensus, which realizes concurrent packaging and fast on-chain consensus in high-concurrency scenarios of multiple partitioned networks. In addition, the sorting and packaging of each target transaction within the partitioned network can avoid packaging target transactions from multiple partitioned networks into a single block, which is conducive to ensuring that different partitioned networks do not share the original transaction data and improve the data security of blockchain transactions.
[0071] In one embodiment, the first node is a member node that receives user-end transactions, and executing the first sub-task includes:
[0072] Obtain the address information corresponding to each response information of the first broadcast information in the first network partition, wherein the first broadcast information is the transaction collection information issued by the first node when there is a consensus transaction to be uploaded to the chain, and the first node belongs to the first partition network;
[0073] Based on the address information, the target transactions of each third node are collected, wherein the third node is a member node in the first partition network that responds to the first broadcast information;
[0074] The first subtask is executed according to each of the target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
[0075] Specifically, the first node is a member node that receives transactions sent by the user. When the first node has transactions that need to be sorted and packaged, the first node publishes a first broadcast message to the first partition network where it is located. If other nodes in the first partition network also have target transactions that need to be sorted and packaged, they respond to the first broadcast message. Then the first node obtains the target transactions that need to be sorted and packaged from each node, sorts and packages them into hierarchical transaction packets, and submits them to the Master node. The Master node then specifies the block height and performs global network consensus to produce a block.
[0076] In one embodiment, the first node is an associated node of a member node that receives user-end transactions, and executing the first sub-task includes:
[0077] Obtain each of the target transactions submitted by each third node in the first partition network;
[0078] The first subtask is executed according to each of the target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
[0079] Specifically, since there are more than one member node in the partitioned network that can receive transactions submitted by the user, multiple member nodes may simultaneously publish the first broadcast information, causing the same target transaction to be packaged multiple times. To address this, a first node for sorting and packaging is set up. This first node is associated with each member node that receives transactions submitted by the user. The member node that receives transactions submitted by the user is designated as the third node. The third node submits the target transaction that needs to be uploaded to the chain to the first node, or the first node actively captures the target transactions of each third node at a preset frequency, and then sorts and packages the obtained target transactions. For details, please refer to the above embodiment, which will not be repeated here.
[0080] In one embodiment, generating the target transaction includes:
[0081] In response to the basic transaction submitted by the user to the third node, the transaction request data of the basic transaction is distributed to each fourth node;
[0082] Each of the fourth nodes simulates the execution of the basic transaction to obtain simulation data for each transaction.
[0083] Based on the simulated transaction data, the target transaction corresponding to the basic transaction is generated;
[0084] The fourth node is a member node in the first partition network that has the authority to simulate and execute transactions, and the transaction simulation data is the read and write set of the basic transaction simulation execution.
[0085] Specifically, the user submits a transaction request to the corresponding third node on the blockchain. The third node transforms the transaction request into a basic transaction and distributes it to each fourth node with simulation execution permissions. Each fourth node performs simulation execution based on the plaintext data of the basic transaction, obtaining simulation data for each transaction. This simulation data forms the target transaction. The simulation data is the read / write set for the basic transaction simulation execution. Taking the first transfer transaction corresponding to organization A transferring 10 to organization B as an example, the business description of this transaction is, for example, "A from to B, 10; or A transfers 10 to B"; before the transfer, "organization A's account balance is 100, and organization B's account balance is X". Then, the read / write set of the first transfer transaction includes: the read set "<A,tx0> ,<B,X> ", where "tx0" is the transaction version number of the first partition network, written set "<A,90> ,<B,X+10> To prevent nodes outside the first partition network from obtaining the original transaction data of a target transaction during global network consensus, the read / write set needs to be anonymized. The anonymized read / write set includes: the read set...<hash(A1),tx0> ,<hash(B1),hash(B2)> “Writing Collection”<hash(A1),hash(A2)> ,<hash(B1),hash(B3)> If template replacement is used for desensitization, the corresponding read and write sets will include: read set "<******,tx0>,<******,X>", write set "<******,000000>,<******,111111>". Alternatively, template replacement and hash calculation can be combined for desensitization, and the desensitized read and write sets will include: "<******,tx0>,<******,hash(b1)>", write set "<******,hash(a1)>,<******,hash(b2)>". The specific desensitization method for the read and write sets is not limited here.
[0086] In one embodiment, the global network has a global ledger, and the partitioned network has a partitioned ledger. The global ledger is jointly maintained by all organizations in the blockchain, and the partitioned ledger is jointly maintained by each organization within the corresponding partitioned network. When the global ledger completes the recording of the target transaction, the block data of the target transaction is synchronized to the corresponding partitioned ledger.
[0087] Specifically, after receiving the transaction packets sorted and packaged by each partition network, the Master node assigns a block height to each transaction packet and uploads it to the blockchain, thereby forming a corresponding block in the global ledger of the blockchain global network. Each partition network will synchronize its corresponding block to its own partition ledger, which can avoid the presence of transaction status data (the status information of the blockchain for the successful or failed execution of transactions submitted by partition networks) in the block data synchronized by each partition ledger.
[0088] The blockchain consensus method of the present invention divides the blockchain consensus task into a first subtask and a second subtask according to the data processing characteristics. The first subtask is assigned to the first node for execution, while the second subtask is reserved for execution on the Master node. By utilizing multiple subtasks to be completed by different blockchain nodes, the amount of data that the Master node needs to process during the consensus of blockchain transactions is shared, saving the time of the Master node in uploading transaction packages to the chain, improving the consensus efficiency of the Master node in processing transactions to be uploaded to the chain, and thereby improving the blockchain transaction efficiency by improving the consensus efficiency of the blockchain, thus improving the slow blockchain transaction problem.
[0089] Example 2
[0090] Please see Figure 4 The present invention, based on the blockchain consensus method of Embodiment 1, also provides a blockchain consensus device, comprising:
[0091] Data acquisition module: used to acquire the consensus task corresponding to the blockchain transaction consensus;
[0092] Task splitting module: used to divide the consensus task into a first subtask and a second subtask based on the data processing characteristics of the consensus task;
[0093] Task allocation module: used to allocate the first subtask to the first node and the second subtask to the Master node according to the node attributes of the blockchain member nodes;
[0094] The first node is a member node or its associated node that receives user-end transactions.
[0095] In one embodiment, the first subtask is to sort and package multiple target transactions to be uploaded to the blockchain, and the second subtask is to specify the block height and upload the multiple target transactions to the blockchain after sorting and packaging them.
[0096] In one embodiment, the first node is a member node that receives user-end transactions, and the device further includes:
[0097] Transaction Response Unit: Responds to transaction requests for multiple target transactions submitted by the user to the first node;
[0098] First Packaging Unit: The first node sorts and packages multiple target transactions to obtain a transaction package containing all the target transactions, and submits the transaction package to the Master node;
[0099] The first on-chain unit: The Master node specifies the block height of the transaction package and uploads it to the chain for consensus.
[0100] In one embodiment, the first node is an associated node of a member node that receives user-end transactions, and the device further includes:
[0101] First grouping unit: In response to multiple second nodes sending to multiple target transactions, divides the multiple target transactions into multiple transaction clusters;
[0102] The second sorting unit sorts the target transactions in each of the transaction clusters to obtain multiple target clusters.
[0103] The second packaging unit: packages all target clusters to obtain a transaction package containing all the target transactions, and submits the transaction package to the Master node;
[0104] The second on-chain unit: The Master node specifies the block height of the transaction package and uploads it to the chain for consensus.
[0105] In one embodiment, the blockchain network includes a global network and multiple partition networks, wherein the first subtask is executed by the partition networks and the second subtask is executed by the global network.
[0106] In one embodiment, the first node is a member node that receives user-end transactions, and executing the first sub-task includes:
[0107] First Broadcast Unit: Obtains the address information corresponding to each response information of the first broadcast information within the first network partition, wherein the first broadcast information is transaction collection information issued by the first node when there is a consensus transaction to be uploaded to the chain, and the first node belongs to the first partition network;
[0108] Transaction collection unit: Collects the target transactions of each third node according to the address information, wherein the third node is a member node in the first partition network that responds to the first broadcast information;
[0109] The third packaging unit executes the first sub-task according to each of the target transactions to obtain a transaction package containing all the target transactions, and submits the transaction package to the Master node.
[0110] In one embodiment, the first node is an associated node of a member node that receives user-end transactions, and executing the first sub-task includes:
[0111] Transaction Acquisition Unit: Acquires each target transaction submitted by each third node in the first partition network;
[0112] Fourth Packaging Unit: Executes the first subtask according to each of the target transactions to obtain a transaction package containing all the target transactions, and submits the transaction package to the Master node.
[0113] This invention provides a blockchain consensus device that breaks down the blockchain consensus task into a first subtask and a second subtask based on data processing characteristics. The first subtask is assigned to a first node for execution, while the second subtask is reserved for execution on the Master node. By utilizing multiple subtasks completed by different blockchain nodes, the amount of data that the Master node needs to process during blockchain transaction consensus is shared, saving the Master node time for uploading transaction packages and improving the consensus efficiency of the Master node in processing transactions to be uploaded. By improving the consensus efficiency of the blockchain, the blockchain transaction efficiency is improved, thus alleviating the problem of slow blockchain transactions.
[0114] Example 3
[0115] This invention provides an electronic device and a storage medium; please refer to [link / reference]. Figure 5 It includes at least one processor, at least one memory, and computer program instructions stored in the memory.
[0116] Specifically, the processor may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of the present invention. The electronic device includes at least one of the following: a computer, a mobile terminal, a PC, a tablet computer, etc.
[0117] The memory may include a large-capacity storage device for data or instructions. For example, and not limitingly, the memory may include a hard disk drive (HDD), a floppy disk drive, flash memory, an optical disk drive, a magneto-optical disk drive, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory may include removable or non-removable (or fixed) media. Where appropriate, the memory may be internal or external to a data processing device. In a particular embodiment, the memory is a non-volatile solid-state memory. In a particular embodiment, the memory includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0118] The processor implements any of the blockchain consensus methods described in the above embodiments by reading and executing computer program instructions stored in memory.
[0119] In one example, the electronic device may also include a communication interface and a bus. The processor, memory, and communication interface are connected via the bus and communicate with each other.
[0120] The communication interface is mainly used to enable communication between various modules, devices, units and / or equipment in the embodiments of the present invention.
[0121] A bus, including hardware, software, or both, couples components of an electronic device together. For example, and not limitingly, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, a bus may include one or more buses. While specific buses are described and illustrated in embodiments of the invention, the invention contemplates any suitable bus or interconnect.
[0122] It should be clarified that the present invention is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of the present invention.
[0123] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this invention are programs or code segments used to perform the required tasks. The programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A blockchain consensus method, characterized in that, The method includes: Obtain the consensus task corresponding to blockchain transaction consensus; Based on the data processing characteristics of the consensus task, the consensus task is divided into a first subtask and a second subtask; the first subtask is to sort and package multiple target transactions to be uploaded to the chain, and the second subtask is to specify the block height and upload the multiple target transactions to the chain after sorting and packaging them. The blockchain network includes a global network and multiple partition networks. The first subtask is executed by the partition networks, and the second subtask is executed by the global network. Based on the node attributes of the blockchain member nodes, the first subtask is assigned to the first node, and the second subtask is assigned to the Master node; The first node is a member node or its associated node that receives user-end transactions; The first node is a member node that receives user-end transactions, and the execution of the first sub-task includes: Obtain the address information corresponding to each response information of the first broadcast information in the first partition network, wherein the first broadcast information is the transaction collection information issued by the first node when there is a consensus transaction to be uploaded to the chain, and the first node belongs to the first partition network; Based on the address information, the target transactions of each third node are collected, wherein the third node is a member node in the first partition network that responds to the first broadcast information; The first subtask is executed according to each of the target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
2. The blockchain consensus method according to claim 1, characterized in that, The first node is a member node that receives user-end transactions, and the method further includes: Responding to multiple target transactions submitted by the user to the first node; The first node sorts and packages the multiple target transactions to obtain a transaction package containing all the target transactions, and submits the transaction package to the Master node; The Master node specifies the block height of the transaction package and uploads it to the blockchain for consensus.
3. The blockchain consensus method according to claim 1, characterized in that, The first node is an associated node of a member node that receives user-end transactions, and the method further includes: In response to multiple second nodes sending to multiple target transactions, the multiple target transactions are divided into multiple transaction clusters; The target transactions in each of the aforementioned transaction clusters are sorted to obtain multiple target clusters; All target clusters are packaged to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node; The Master node specifies the block height of the transaction package and uploads it to the blockchain for consensus.
4. The blockchain consensus method according to claim 1, characterized in that, The first node is an associated node of a member node that receives user-end transactions. Executing the first sub-task includes: Obtain each of the target transactions submitted by each third node in the first partition network; The first subtask is executed according to each of the target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
5. A blockchain consensus device, characterized in that, include: Data acquisition module: used to acquire the consensus task corresponding to the blockchain transaction consensus; Task splitting module: used to divide the consensus task into a first subtask and a second subtask according to the data processing characteristics of the consensus task; the first subtask is to sort and package multiple target transactions to be uploaded to the chain, and the second subtask is to specify the block height and upload the multiple target transactions to the chain after sorting and packaging them. The blockchain network includes a global network and multiple partition networks. The first subtask is executed by the partition networks, and the second subtask is executed by the global network. Task allocation module: used to allocate the first subtask to the first node and the second subtask to the Master node according to the node attributes of the blockchain member nodes; The first node is a member node or its associated node that receives user-end transactions; The first node is a member node that receives user-end transactions, and the execution of the first sub-task includes: Obtain the address information corresponding to each response information of the first broadcast information in the first partition network, wherein the first broadcast information is the transaction collection information issued by the first node when there is a consensus transaction to be uploaded to the chain, and the first node belongs to the first partition network; Based on the address information, the target transactions of each third node are collected, wherein the third node is a member node in the first partition network that responds to the first broadcast information; The first subtask is executed according to each of the target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
6. An electronic device, characterized in that, include: At least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement the method as described in any one of claims 1-4.
7. A storage medium storing computer program instructions thereon, characterized in that, The method as described in any one of claims 1-4 is implemented when the computer program instructions are executed by the processor.