Blockchain hierarchical network consensus method, device, equipment and storage medium
By using a blockchain-based layered network consensus method, the transaction consensus task is split into partitioned networks and executed by Master nodes, which solves the problem of low efficiency in network-wide consensus and improves transaction processing capabilities.
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-04-14
AI Technical Summary
The current blockchain technology's network-wide consensus method results in a large amount of data processing for the Master node, affecting transaction consensus efficiency and failing to meet the needs of high-frequency transactions.
The blockchain layered network consensus method is adopted, which splits the transaction consensus task into a first subtask and a second subtask. The first subtask is executed by the nodes of the partition network, and the target file is submitted to the Master node to execute the second subtask and generate the target block.
It improves the efficiency of high-concurrency transaction consensus in partitioned networks, reduces the data processing load on Master nodes, and increases transaction processing capabilities.
Smart Images

Figure CN116506439B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, and in particular to a blockchain layered network 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 layered network consensus method, apparatus, device and storage medium to solve the technical problem of low blockchain transaction consensus efficiency in the prior art.
[0005] The technical solution adopted in this invention is:
[0006] On one hand, the present invention provides a consensus method for a layered blockchain network, wherein the blockchain network includes a global network and one or more partitioned networks, and the method includes:
[0007] Obtain transaction consensus requests from the first partition network;
[0008] According to the transaction consensus request, the first sub-task is executed on each target transaction at the first node to obtain the target file corresponding to each target transaction and submit it to the Master node;
[0009] The Master node executes a second subtask on the target file to generate a file to be agreed upon.
[0010] The Master node distributes the consensus file to each consensus node in the global network to achieve blockchain consensus and generate target blocks corresponding to each target transaction.
[0011] Wherein, the first node belongs to the first partition network, the first node is a first type of node that receives user terminal transactions and / or a second type of node associated with the first type of node, and the blockchain consensus of the target transaction includes the first subtask and the second subtask.
[0012] Preferably, the consensus task decomposition includes:
[0013] Obtain the consensus task corresponding to blockchain transaction consensus;
[0014] Based on the data processing characteristics of the consensus task, the consensus task is divided into a first sub-task and a second sub-task;
[0015] Based on the node attributes of the blockchain member nodes, the first subtask is assigned to the first node of each partition network for execution, and the second subtask is assigned to the Master node for execution.
[0016] 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.
[0017] Preferably, the first node is a node of the first type, and the partitioned network performs the first subtask including:
[0018] In response to multiple target transaction requests submitted by the user to the first node, the first subtask is invoked;
[0019] The first subtask is executed on multiple target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
[0020] Preferably, the first node is a node of the first type, and the partitioned network performs the first subtask including:
[0021] 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;
[0022] Based on the address information, the target transactions of each second node are collected, wherein the second node is a member node in the first partition network that responds to the first broadcast information;
[0023] 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.
[0024] Preferably, the first node is a second type of node, and the partitioned network performs the first subtask including:
[0025] Obtain the target transactions submitted by each second node in the first partition network;
[0026] 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.
[0027] Preferably, partition network data synchronization includes:
[0028] In response to the maintenance information of the target block in the global ledger, obtain the partition network information corresponding to the target transaction in the target block;
[0029] Based on the partition network information, the target block is synchronized to the partition ledger of the first partition network;
[0030] The global network maintains a global ledger, and each of the partition networks maintains a corresponding partition ledger.
[0031] On the other hand, the present invention also provides a blockchain layered network consensus device, wherein the blockchain network includes a global network and one or more partition networks, comprising:
[0032] Data acquisition module: used to acquire transaction consensus requests in the first partition network;
[0033] First consensus module: Used to execute the first sub-task on each target transaction on the first node according to the transaction consensus request, obtain the target file corresponding to each target transaction and submit it to the Master node;
[0034] Second consensus module: Used to execute a second subtask on the target file on the Master node to generate a file to be agreed upon;
[0035] Task on-chain module: used by the Master node to distribute the file to be reached for consensus to each consensus node in the global network for blockchain consensus, and generate target blocks corresponding to each target transaction;
[0036] Wherein, the first node belongs to the first partition network, the first node is a first type of node that receives user terminal transactions and / or a second type of node associated with the first type of node, and the blockchain consensus of the target transaction includes the first subtask and the second subtask.
[0037] 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.
[0038] 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.
[0039] In summary, the beneficial effects of the present invention are as follows:
[0040] The present invention provides a blockchain layered network consensus method, apparatus, device, and storage medium. When a blockchain partition network submits a transaction, it completes the first sub-task of blockchain consensus for each target transaction within the partition network. The target file that has completed the first sub-task is then sent to the Master node to execute the second sub-task of blockchain consensus. This enables the Master node to improve the consensus task of each target transaction submitted by each partition network at high concurrency. At the same time, since each partition network has completed the first sub-task, each target transaction corresponding to the target block belongs to only one partition network. Only the first partition network needs to synchronize the target block to its partition ledger, while other partition networks do not need to synchronize the target block, thereby improving the accounting efficiency of the partition network. Attached Figure Description
[0041] 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.
[0042] Figure 1 This is a flowchart illustrating the method for obtaining consensus in a blockchain layered network in Embodiment 1 of the present invention.
[0043] Figure 2 This is a schematic diagram of the process for obtaining consensus task breakdown in Embodiment 1 of the present invention;
[0044] Figure 3 This is a schematic diagram of the process of obtaining the target block for ledger maintenance in Embodiment 1 of the present invention;
[0045] Figure 4 This is a schematic diagram of the blockchain transaction device structure in Embodiment 2 of the present invention;
[0046] Figure 5 This is a schematic diagram of the electronic device in Embodiment 3 of the present invention. Detailed Implementation
[0047] 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.
[0048] 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.
[0049] 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.
[0050] 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.
[0051] Example 1
[0052] Please see Figure 1 , Figure 1 The blockchain layered network consensus method in Embodiment 1 of the present invention includes a global network and one or more partitioned networks. The method includes:
[0053] S1: Obtain the transaction consensus request in the first partition network;
[0054] Specifically, a blockchain comprises a global network and one or more partitioned networks. All nodes on the blockchain constitute the global network, and each partitioned network consists of a subset of nodes on the blockchain. The global network sets up a global ledger, which is jointly maintained by all nodes on the blockchain. Each partitioned network has an independent partitioned ledger, which is jointly maintained by all nodes on the partitioned network. By setting up the global network and partitioned networks, sensitive data isolation of transactions between partitioned networks can be achieved, meaning that nodes in different partitioned networks cannot access sensitive data corresponding to transactions submitted to the blockchain by other partitioned networks. For ease of description, this paper takes transactions in the first partitioned network as an example. When there is a transaction in the first partitioned network that needs to be uploaded to the blockchain, a transaction consensus request is generated within the first partitioned network, and the corresponding consensus task is executed based on the transaction consensus request for the target transaction to be uploaded to the blockchain.
[0055] It should be noted that: Blockchains can be divided into multiple partitioned networks based on the types of business each node needs to conduct (first classification method), or multiple blockchain nodes that complete specific business can form corresponding partitioned networks (second classification method). For partitioned networks completing the same transaction type, the first classification method can include multiple partitioned networks obtained through the second classification method. Taking 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 as an example, when dividing the partitioned networks according to the second classification method, wealth management subsidiary A and sales bank A form one partitioned network, and wealth management subsidiary B and sales bank A form another partitioned network. If the first classification method is used, these two partitioned networks would be classified as the same partitioned network. The specific method of partitioning the networks is not limited here.
[0056] S2: Based on the transaction consensus request, the first sub-task is executed on each target transaction at the first node to obtain the target file corresponding to each target transaction and submit it to the Master node;
[0057] Specifically, when the first partition network generates a transaction consensus request, the first node executes the first sub-task corresponding to the blockchain consensus for each target transaction that needs to be uploaded to the chain within the first partition network at this time, and then submits the target file that has completed the first sub-task to the Master node of the global network. The first node is a member node within the first partition network.
[0058] S3: On the Master node, execute the second subtask on the target file to generate a file to be agreed upon;
[0059] S4: The Master node distributes the file to be reached for consensus to each consensus node in the global network to achieve blockchain consensus and generate target blocks corresponding to each target transaction.
[0060] Wherein, the first node belongs to the first partition network, the first node is a first type of node that receives user terminal transactions and / or a second type of node associated with the first type of node, and the blockchain consensus of the target transaction includes the first subtask and the second subtask.
[0061] Specifically, the Master node executes the remaining second sub-task of blockchain consensus on the target file submitted by the first node of the first partition network, generates a file to be consensused, and then submits it to the global network for consensus voting, so as to obtain the target blocks corresponding to each target transaction of the first partition network in the global network.
[0062] It should be noted that: the first node can be either a first-type node or a second-type node in the first partition network. The first-type node is the one that receives the transaction submitted by the user when the user submits the transaction to the first partition network. That is, each first node only performs the first sub-task on the target transaction it receives. The second-type node is a member node that does not receive transactions submitted by the user. The member node that receives the transaction sends the target transaction to the first node, and the first node performs the first sub-task on all target transactions. Each target transaction comes from a different member node in the first partition network that is used to receive transactions from the user. The first node can be a first-type node, a second-type node, or a combination of first-type nodes and second-type nodes.
[0063] The blockchain hierarchical network consensus method provided by this invention involves completing the first sub-task of blockchain consensus for each target transaction within a partition network when the partition network submits a transaction. The target file that has completed the first sub-task is then sent to the Master node to execute the second sub-task of blockchain consensus. This enables the Master node to improve the consensus task of each target transaction submitted by each partition network at high concurrency. At the same time, since each partition network has completed the first sub-task, each target transaction corresponding to the target block belongs to only one partition network. Only the first partition network needs to synchronize the target block to its partition ledger, while other partition networks do not need to synchronize the target block, thereby improving the accounting efficiency of the partition network.
[0064] In one embodiment, please refer to Figure 2 Before S1, it also includes:
[0065] S01: Obtain the consensus task corresponding to the blockchain transaction consensus;
[0066] S02: Based on the data processing characteristics of the consensus task, the consensus task is divided into the first sub-task and the second sub-task;
[0067] S03: Based on the node attributes of the blockchain member nodes, assign the first subtask to the first node of each partition network for execution, and assign the second subtask to the Master node for execution.
[0068] Specifically, the data processing involved in the consensus process of blockchain transactions is denoted as the consensus task. Based on the data processing characteristics, the data processing steps involved in the consensus task are divided into a first subtask and a 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 and their node attributes, the first and second subtasks are completed respectively. Preferably, the first subtask is executed by the first node of the partition network, and the second subtask is executed by the Master node of the global network, thereby avoiding the packaging of transactions submitted by different partition networks into the same block.
[0069] 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.
[0070] 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.
[0071] In one embodiment, the first node is a node of the first type, and S2 includes:
[0072] S21: In response to the transaction requests for multiple target transactions submitted by the user to the first node, the first subtask is invoked;
[0073] S22: Execute the first subtask on multiple target transactions to obtain a transaction package containing all the target transactions, and submit the transaction package to the Master node.
[0074] Specifically, the first subtask is to receive transactions submitted by user clients. When a member node executes this task, it 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 assigns a block to the transaction package and distributes it to the consensus nodes of the blockchain for consensus. Each member node of the partitioned network can correspond to multiple user clients, meaning that the first node can receive transaction requests submitted by multiple user clients and transform each transaction request into a corresponding target transaction.
[0075] In one embodiment, the first node is a node of the first type, and S2 includes:
[0076] S23: 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;
[0077] S24: Collect the target transactions of each second node according to the address information, wherein the second node is a member node in the first partition network that responds to the first broadcast information;
[0078] S25: Execute the first sub-task according to each of the target transactions to obtain a transaction package containing all the target transactions, and submit the transaction package to the Master node.
[0079] 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.
[0080] In one embodiment, the first node is a second type of node, and S2 includes:
[0081] S26: Obtain the target transactions submitted by each second node in the first partition network;
[0082] S27: Execute the first sub-task according to each of the target transactions to obtain a transaction package containing all the target transactions, and submit the transaction package to the Master node.
[0083] 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 second node. The second 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 second 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.
[0084] In one embodiment, when the first node is a second type of node, executing the first subtask includes:
[0085] In response to multiple target transactions sent by multiple second nodes, the multiple target transactions are divided into multiple transaction clusters;
[0086] The target transactions in each of the aforementioned transaction clusters are sorted to obtain multiple target clusters;
[0087] 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.
[0088] 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.
[0089] In one embodiment, generating the target transaction includes:
[0090] In response to the basic transaction submitted by the user to the second node, the transaction request data of the basic transaction is distributed to each third node;
[0091] Each of the aforementioned third nodes simulates the execution of the basic transaction, obtaining simulation data for each transaction.
[0092] Based on the simulated transaction data, the target transaction corresponding to the basic transaction is generated;
[0093] The third 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 / write set corresponding to the basic transaction simulation execution.
[0094] Specifically, the user submits a transaction request to the corresponding second node on the blockchain. The second node transforms the transaction request into a basic transaction and distributes it to each third node with simulation execution permissions. Each third 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 a collection of books”<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.
[0095] In one embodiment, please refer to Figure 3 The process after S4 also includes:
[0096] S5: In response to the maintenance information of the target block in the global ledger, obtain the partition network information corresponding to the target transaction in the target block;
[0097] S6: Based on the partition network information, synchronize the target block to the partition ledger of the first partition network;
[0098] The global network maintains a global ledger, and each of the partition networks maintains a corresponding partition ledger.
[0099] 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 target block in the global ledger of the global blockchain network. The first partition network synchronizes the target block from the global ledger to its own partition ledger. Since the target transactions corresponding to the target block are all transactions of the first partition network, by completing the first sub-task in the partition network, when the global ledger maintains the target block, the synchronization of the target block by the partition ledger can avoid the presence of transaction status data from other partition networks in the synchronized block data.
[0100] The blockchain hierarchical network consensus method of the present invention involves the following steps: When a blockchain partition network submits a transaction, it completes the first sub-task of blockchain consensus for each target transaction within the partition network. The target file that has completed the first sub-task is then sent to the Master node to execute the second sub-task of blockchain consensus. This enables the Master node to improve the consensus task of each target transaction submitted by each partition network at high concurrency. At the same time, since each partition network has completed the first sub-task, each target transaction corresponding to the target block belongs to only one partition network. Therefore, the first partition network needs to synchronize the target block to its partition ledger, while other partition networks do not need to synchronize the target block, thereby improving the accounting efficiency of the partition network.
[0101] Example 2
[0102] Please see Figure 4 The present invention, based on the blockchain layered network consensus method of Embodiment 1, also provides a blockchain layered network consensus device. The blockchain network includes a global network and one or more partition networks, comprising:
[0103] Data acquisition module: used to acquire transaction consensus requests in the first partition network;
[0104] First consensus module: Used to execute the first sub-task on each target transaction on the first node according to the transaction consensus request, obtain the target file corresponding to each target transaction and submit it to the Master node;
[0105] Second consensus module: Used to execute a second subtask on the target file on the Master node to generate a file to be agreed upon;
[0106] Task on-chain module: used by the Master node to distribute the file to be reached for consensus to each consensus node in the global network for blockchain consensus, and generate target blocks corresponding to each target transaction;
[0107] Wherein, the first node belongs to the first partition network, the first node is a first type of node that receives user terminal transactions or a second type of node associated with the first type of node, and the blockchain consensus of the target transaction includes the first subtask and the second subtask.
[0108] In one embodiment, it further includes:
[0109] Consensus Task Unit: Obtain the consensus task corresponding to the blockchain transaction consensus;
[0110] Task splitting unit: Based on the data processing characteristics of the consensus task, the consensus task is divided into a first sub-task and a second sub-task;
[0111] Task allocation unit: Based on the node attributes of blockchain member nodes, the first subtask is allocated to the first node of each partition network for execution, and the second subtask is allocated to the Master node for execution.
[0112] 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.
[0113] In one embodiment, the first node is a first type of node, and the first consensus module includes:
[0114] First Response Unit: Responds to transaction requests for multiple target transactions submitted by the user to the first node, and invokes the first subtask;
[0115] First execution unit: Executes the first sub-task on multiple target transactions to obtain a transaction package containing all the target transactions, and submits the transaction package to the Master node.
[0116] In one embodiment, the first node is a first type of node, and the first consensus module includes:
[0117] Information acquisition unit: acquires the address information corresponding to each response information of the first broadcast information in 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;
[0118] First transaction unit: Based on the address information, collect the target transactions of each second node, wherein the second node is a member node in the first partition network that responds to the first broadcast information;
[0119] The second execution 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.
[0120] In one embodiment, the first node is a second type of node, and the first consensus module includes:
[0121] Second transaction unit: Obtain the target transactions submitted by each second node in the first partition network;
[0122] The third execution 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.
[0123] In one embodiment, it further includes:
[0124] Ledger maintenance unit: In response to the maintenance information of the target block in the global ledger, obtains the partition network information corresponding to the target transaction in the target block;
[0125] Block synchronization unit: Based on the partition network information, synchronize the target block to the partition ledger of the first partition network;
[0126] The global network maintains a global ledger, and each of the partition networks maintains a corresponding partition ledger.
[0127] On the other hand, the present invention also provides a blockchain layered network consensus device, wherein the blockchain network includes a global network and one or more partition networks, comprising:
[0128] Data acquisition module: used to acquire transaction consensus requests in the first partition network;
[0129] First consensus module: Used to execute the first sub-task on each target transaction on the first node according to the transaction consensus request, obtain the target file corresponding to each target transaction and submit it to the Master node;
[0130] Second consensus module: Used to execute a second subtask on the target file on the Master node to generate a file to be agreed upon;
[0131] Task on-chain module: used by the Master node to distribute the file to be reached for consensus to each consensus node in the global network for blockchain consensus, and generate target blocks corresponding to each target transaction;
[0132] Wherein, the first node belongs to the first partition network, the first node is a first type of node that receives user terminal transactions or a second type of node associated with the first type of node, and the blockchain consensus of the target transaction includes the first subtask and the second subtask.
[0133] This invention provides a blockchain hierarchical network consensus device. When a blockchain partition network submits a transaction, it completes the first sub-task of blockchain consensus for each target transaction within the partition network. The target file that has completed the first sub-task is then sent to the Master node to execute the second sub-task of blockchain consensus. This enables the Master node to improve the consensus task of each target transaction submitted by each partition network at high concurrency. At the same time, since each partition network has completed the first sub-task, each target transaction corresponding to the target block belongs to only one partition network. Only the first partition network needs to synchronize the target block to its partition ledger, while other partition networks do not need to synchronize the target block, thereby improving the accounting efficiency of the partition network.
[0134] Example 3
[0135] 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.
[0136] 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.
[0137] 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.
[0138] The processor implements any of the blockchain layered network consensus methods described in the above embodiments by reading and executing computer program instructions stored in the memory.
[0139] 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.
[0140] The communication interface is mainly used to enable communication between various modules, devices, units and / or equipment in the embodiments of the present invention.
[0141] 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.
[0142] 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.
[0143] 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.
[0144] 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 consensus method for a layered blockchain network, characterized in that, The blockchain network includes a global network and one or more partitioned networks, and the method includes: Obtain transaction consensus requests from the first partition network; Based on the transaction consensus request, the first sub-task is executed on each target transaction at the first node to obtain the target file corresponding to each target transaction and submit it to the Master node; the Master node belongs to the global network. The Master node executes a second subtask on the target file to generate a file to be agreed upon. The Master node distributes the consensus file to each consensus node in the global network to achieve blockchain consensus and generate target blocks corresponding to each target transaction. Wherein, the first node belongs to the first partition network, the first node is a first type of node that receives user terminal transactions and / or a second type of node associated with the first type of node, and the blockchain consensus of the target transaction includes the first subtask and the second subtask. Before obtaining the transaction consensus request in the first partition network, the method further includes consensus task decomposition: obtaining the consensus task corresponding to the blockchain transaction consensus; dividing the consensus task into a first subtask and a second subtask according to the data processing characteristics of the consensus task; assigning the first subtask to the first node of each partition network for execution according to the node attributes of the blockchain member nodes, and assigning the second subtask to the Master node for execution; 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.
2. The blockchain layered network consensus method according to claim 1, characterized in that, The first node is a node of the first type, and the partitioned network performs the first subtask including: In response to multiple target transaction requests submitted by the user to the first node, the first subtask is invoked; The first subtask is executed on multiple target transactions to obtain a transaction package containing all the target transactions, and the transaction package is submitted to the Master node.
3. The blockchain layered network consensus method according to claim 1, characterized in that, The first node is a node of the first type, and the partitioned network performs the first subtask including: 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; Based on the address information, the target transactions of each second node are collected, wherein the second 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.
4. The blockchain layered network consensus method according to claim 1, characterized in that, The first node is a second type of node, and the partitioned network performs the first subtask including: Obtain the target transactions submitted by each second 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. The blockchain layered network consensus method according to any one of claims 1 to 4, characterized in that, Partition network data synchronization includes: In response to the maintenance information of the target block in the global ledger, obtain the partition network information corresponding to the target transaction in the target block; Based on the partition network information, the target block is synchronized to the partition ledger of the first partition network; The global network maintains a global ledger, and each of the partition networks maintains a corresponding partition ledger.
6. A blockchain layered network consensus device, characterized in that, A blockchain network comprises a global network and one or more partitioned networks, including: Data acquisition module: used to acquire transaction consensus requests in the first partition network; First consensus module: used to execute a first sub-task on each target transaction at the first node according to the transaction consensus request, obtain the target file corresponding to each target transaction and submit it to the Master node; the Master node belongs to the global network; Second consensus module: Used to execute a second subtask on the target file on the Master node to generate a file to be agreed upon; Task on-chain module: used by the Master node to distribute the file to be reached for consensus to each consensus node in the global network for blockchain consensus, and generate target blocks corresponding to each target transaction; Wherein, the first node belongs to the first partition network, the first node is a first type of node that receives user terminal transactions and / or a second type of node associated with the first type of node, the blockchain consensus of the target transaction includes the first subtask and the second subtask; before the data acquisition module acquires the transaction consensus request in the first partition network, it also includes consensus task splitting: acquiring the consensus task corresponding to the blockchain transaction consensus; according to the data processing characteristics of the consensus task, dividing the consensus task into the first subtask and the second subtask; according to the node attributes of the blockchain member nodes, assigning the first subtask to the first node of each partition network for execution, and assigning the second subtask to the Master node for execution; 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.
7. 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-5.
8. A storage medium storing computer program instructions thereon, characterized in that, When the computer program instructions are executed by a processor, the method as described in any one of claims 1-5 is implemented.
Citation Information
Patent Citations
Transaction data processing method and device, equipment and storage medium
CN112926982A
Data processing method, device and system
CN113079200A
Consensus method and system of block chain system, storage medium and program product
CN118826994A