A multi-chain alliance blockchain consensus method, device, electronic device and medium

By changing the alliance blockchain to a multi-chain structure to generate blocks in parallel, the problems of idle resources and insufficient throughput caused by a single-chain structure are solved, efficient transaction processing and system scalability are achieved, and the consistency of node state is ensured.

CN119070971BActive Publication Date: 2025-01-17SHANGHAI PUWEI TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411534044.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-17
Estimated Expiration
2044-10-31

AI Technical Summary

Technical Problem

The serial processing method caused by the single-chain structure of the existing alliance blockchain system limits the scalability of the system and cannot process transactions or blocks in parallel, resulting in idle resources and difficult to use effective expansion methods. Improve transaction throughput.

Method used

Adopt a multi-chain alliance blockchain structure, change the blockchain to a multi-chain structure, each organization maintains multiple chains, and the two-dimensional logs are copied between nodes, determine the block sequence through serial nodes, and generate blocks in parallel to improve transactions. Throughput and efficiency, support vertical expansion.

Benefits of technology

It realizes the reduction of block generation waiting time, the improvement of transaction proposal throughput, improves transaction efficiency, and ensures the final state consistency of each node through a two-dimensional log structure, which has excellent scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119070971B_ABST
    Figure CN119070971B_ABST
Patent Text Reader

Abstract

The present application relates to a multi-chain alliance blockchain consensus method, device, electronic device and medium. It includes: by obtaining the transaction request sent by the client to the target alliance node of the blockchain, when the transaction in the node transaction pool reaches the preset threshold, the new block is packaged; the serial number of the new block is applied through the serial number node, and it is determined whether other alliance nodes confirm the serial number of the new block; when more than (N / 2+1) alliance nodes confirm, the new block is added to the chain structure maintained by each alliance node; a log of adding a new block is generated, and a log attachment request is sent to other alliance nodes, and other alliance nodes copy the log to the local log collection based on the log attachment request; when more than (N / 2+1) alliance nodes are detected to copy the log, each alliance node appends the log to the state replicator to achieve the effect of parallel block generation, improve block generation efficiency and transaction throughput. And the structure supports vertical expansion and has excellent scalability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a multi-chain alliance blockchain consensus method, device, electronic device and medium. Background Art

[0002] As a distributed system, blockchain cannot take into account security, scalability, and decentralization at the same time. At present, the consensus algorithms in the alliance chain mostly adopt Byzantine fault tolerance and crash fault tolerance. Both of these consensus mechanisms have strong consistency and make certain compromises in decentralization. They reach a consensus on the total order of transactions in the block by electing the master node, and then execute transactions serially in the same order on all nodes. This serial transaction processing method fundamentally limits the scalability of the alliance blockchain, resulting in the inability to process transactions or blocks in parallel, which means that many resources in the network are intermittently idle, limiting the scalability of the alliance chain system. In addition, most existing alliance chain systems only use a single chain for transaction processing and storage.

[0003] As the volume of network transactions increases, the operating speed of a single-chain alliance blockchain system will be greatly reduced, and it is difficult to increase the transaction throughput of the blockchain through effective expansion methods. Therefore, it is urgent to design a high-performance chain structure and consensus algorithm to improve the overall scalability of the system. Summary of the invention

[0004] In order to solve or partially solve the problems existing in the related technology, the present application provides a multi-chain alliance blockchain consensus method, device, electronic device and medium, which can reduce the waiting time for block generation by modifying the single-chain blockchain into a multi-chain structure, and also support concurrent issuance of blocks, thereby improving the throughput of transaction proposals and improving transaction efficiency; by changing the log structure into a two-dimensional structure, each node saves a ledger structure table, indicating the block number of each sub-chain block, and the state replicator determines the execution order of the two-dimensional log according to the ledger structure table, thereby ensuring that the final state of each node is consistent.

[0005] In a first aspect, the present application provides a multi-chain alliance blockchain structure, wherein the blockchain structure includes a genesis block and several chain structures, each organization includes several chain structures, each chain structure includes several blocks, and different organization alliances are built into an alliance blockchain system;

[0006] The nodes of the blockchain replicate logs with each other, and the log structure of the blockchain is a two-dimensional structure.

[0007] The second aspect of the present application provides a consensus method for a multi-chain alliance blockchain structure, wherein the blockchain structure includes a genesis block and several chain structures, each organization includes several chain structures, each chain structure includes several blocks, and different organization alliances are built into an alliance blockchain system, and the nodes of the blockchain replicate logs with each other, and the log structure of the blockchain is a two-dimensional structure, wherein the blockchain includes N alliance nodes and sequence number nodes; the method includes:

[0008] Obtain the transaction request sent by the client to the target alliance node of the blockchain, and package a new block when the transaction in the node transaction pool reaches the preset threshold;

[0009] Apply for the serial number of the new block through the serial number node, and determine whether other alliance nodes confirm the serial number of the new block;

[0010] When more than (N / 2+1) alliance nodes confirm, the new block is added to the chain structure maintained by each alliance node;

[0011] Generate a log for adding the new block, send a log append request to other alliance nodes, and other alliance nodes copy the log to a local log set based on the log append request;

[0012] When it is detected that more than (N / 2+1) federation nodes have replicated the log, each federation node appends the log to the state replicator.

[0013] Preferably, the determining whether other alliance nodes confirm the sequence number of the new block includes:

[0014] The serial number node sends a heartbeat message to other alliance nodes;

[0015] Other alliance nodes confirm the sequence number of the new block based on the heartbeat message.

[0016] Preferably, the steps before adding the new block to the chain structure maintained by each alliance node include:

[0017] Other alliance nodes synchronize blocks for the new block;

[0018] The new block is verified, and after passing the verification, the new block is added to the chain structure maintained by the target alliance node.

[0019] Preferably, the verifying the new block includes:

[0020] The target alliance node verifies the hash value of the new block.

[0021] Preferably, the two-dimensional structure of the blockchain log corresponds to the structure of the blockchain.

[0022] Preferably, the alliance node is used to participate in consensus, store ledgers, and expand sub-chains.

[0023] The third aspect of the present application provides a consensus device of a multi-chain alliance blockchain structure, wherein the blockchain structure includes a genesis block and a plurality of chain structures, each organization includes a plurality of chain structures, each chain structure includes a plurality of blocks, and different organization alliances are built into an alliance blockchain system, and the nodes of the blockchain replicate logs with each other, and the log structure of the blockchain is a two-dimensional structure, wherein the blockchain includes N alliance nodes and sequence number nodes; the device includes:

[0024] The acquisition module is used to obtain the transaction request sent by the client to the target alliance node of the blockchain, and package the block when the transaction in the node transaction pool reaches the preset threshold;

[0025] An application module, used to apply for the serial number of the block through the serial number node, and determine whether other alliance nodes confirm the serial number of the block;

[0026] An adding module, used for adding the block to the chain structure maintained by each alliance node when it is detected that more than (N / 2+1) alliance nodes have confirmed the block;

[0027] A log module, used to generate a log for adding the block, send a log appending request to other alliance nodes, and other alliance nodes copy the log to a local log set based on the log appending request;

[0028] The replication module is used for, when it is detected that more than (N / 2+1) alliance nodes have replicated the log, each alliance node appends the log to the state machine.

[0029] A fourth aspect of the present application provides an electronic device, including:

[0030] Processor; and

[0031] The memory stores executable codes thereon, and when the executable codes are executed by the processor, the processor is caused to execute the method as described above.

[0032] A fifth aspect of the present application provides a computer-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor is caused to execute the method as described above.

[0033] The technical solution provided by the present application may include the following beneficial effects: the blockchain structure includes a genesis block and several chain structures, each organization includes several chain structures, each chain structure includes several blocks, different organization alliances are built into an alliance blockchain system, the nodes of the blockchain replicate logs with each other, and the log structure of the blockchain is a two-dimensional structure, wherein the blockchain includes N alliance nodes and sequence number nodes; by obtaining the transaction request sent by the client to the target alliance node of the blockchain, when the transaction in the node transaction pool reaches a preset threshold, a new block is packaged; the sequence number of the new block is applied through the sequence number node, and it is determined whether other alliance nodes confirm the sequence number of the new block; when it is detected that more than (N / 2+1) alliance nodes have confirmed, the new block is added to the chain structure maintained by each alliance node; a log of adding a new block is generated, and a log append request is sent to other alliance nodes, and other alliance nodes copy the log to the local log set based on the log append request; when it is detected that more than (N / 2+1) alliance nodes have copied the log, each alliance node appends the log to the state replicator. The effect of parallel block generation is achieved, and the block generation efficiency and transaction throughput are improved. The multi-chain feature ensures parallel generation of blocks and easy maintenance, and the structure supports vertical expansion and has excellent scalability. The log structure is changed to a two-dimensional structure. At the same time, each node saves a ledger structure table, indicating the block number of each sub-chain block. The state replicator determines the execution order of the two-dimensional log according to the ledger structure table, thereby ensuring that the final state of each node is consistent.

[0034] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The above and other objects, features and advantages of the present application will become more apparent by describing in more detail the exemplary embodiments of the present application in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same components in the exemplary embodiments of the present application.

[0036] Figure 1 It is a structural diagram of a multi-chain alliance blockchain structure shown in an embodiment of the present application;

[0037] Figure 2 It is a flowchart of a consensus method of a multi-chain alliance blockchain structure shown in an embodiment of the present application;

[0038] Figure 3 It is a schematic diagram of the parallel block flow shown in the embodiment of the present application;

[0039] Figure 4a is a node relationship in the related technology;

[0040] Figure 4b It is the log structure in the related technology;

[0041] Figure 4c The node relationship shown in the embodiment of the present application;

[0042] Figure 4d The log structure shown in the embodiment of this application;

[0043] Figure 5 is a log synchronization schematic diagram shown in an embodiment of the present application;

[0044] Figure 6 It is a structural schematic diagram of a consensus device of a multi-chain alliance blockchain structure shown in an embodiment of the present application;

[0045] Figure 7 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0046] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to make the present application more thorough and complete, and to fully convey the scope of the present application to those skilled in the art.

[0047] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0048] It should be understood that although the terms "first", "second", "third", etc. may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0049] As the volume of network transactions increases, the operating speed of a single-chain alliance blockchain system will be greatly reduced, and it is difficult to increase the transaction throughput of the blockchain through effective expansion methods. Therefore, it is urgent to design a high-performance chain structure and consensus algorithm to improve the overall scalability of the system.

[0050] In response to the above problems, the embodiments of the present application provide a consensus method for a multi-chain alliance blockchain structure, which can reduce the waiting time for block generation by modifying a single-chain blockchain into a multi-chain structure, while also supporting concurrent issuance of blocks, improving the throughput of transaction proposals, and improving transaction efficiency; by changing the log structure into a two-dimensional structure, each node saves a ledger structure table, indicating the block number of each sub-chain block, and the state replicator determines the execution order of the two-dimensional log according to the ledger structure table, thereby ensuring that the final state of each node is consistent.

[0051] The technical solution of the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0052] Figure 1 It is a structural diagram of a multi-chain alliance blockchain structure shown in an embodiment of the present application.

[0053] See also Figure 1 , the blockchain includes a genesis block and several chain structures, each organization includes several chain structures, each chain structure includes several blocks, and different organization alliances are built into a consortium blockchain system;

[0054] The nodes of the blockchain replicate logs to each other, and the log structure of the blockchain is a two-dimensional structure.

[0055] The embodiment of the present application is aimed at a single-chain blockchain structure, combining the ideas of sharding and directed acyclic graphs, and designs a new type of DAG (Directed Acyclic Graph) ledger structure. After creating the genesis block 101, it is no longer necessary to continue to build and maintain a single chain after the genesis block, but it can point to multiple blocks afterwards, and then each subsequent block continues to build and maintain a chain, thereby forming a multi-chain blockchain structure. In one example, the alliance blockchain system includes multiple organizations including organization 1 102, organization 2 103, organization 3 104... Organization 1 102 includes a chain structure composed of blocks such as block 1, block 3... and a chain structure composed of block 7 and other blocks (if any). Each chain structure contains several blocks. In this structure, each organization maintains a corresponding blockchain subchain, so the privacy of data can be guaranteed between organizations, and storage resources can be saved.

[0056] In the blockchain, nodes can copy logs to each other. And because the ledger structure is modified to a parallel form of multiple sub-chains, each node can generate blocks and write logs. Nodes must not only write their own logs, but also synchronize the logs of other nodes, and then use the state machine to execute the logs to reach a consensus on the status of the nodes. If the one-dimensional log form is continued, since the order of log synchronization is uncertain, if the logs of different nodes are different, the status of the nodes will not be consistent after the state machine is executed. Therefore, the log structure is changed to a two-dimensional structure, and each node saves a ledger structure table, indicating the block number of each sub-chain block. The state machine determines the execution order of the two-dimensional log according to the ledger structure table, thereby ensuring that the final state of each node is consistent.

[0057] The embodiment of the present application discloses a multi-chain alliance blockchain structure, wherein the blockchain structure includes a genesis block and several chain structures, each organization includes several chain structures, each chain structure includes several blocks, and different organization alliances are built into an alliance blockchain system; the nodes of the blockchain replicate logs to each other, and the log structure of the blockchain is a two-dimensional structure. By changing the blockchain into a multi-chain structure, the waiting time for block generation can be reduced, and it also supports concurrent issuance of blocks, thereby improving the throughput of transaction proposals and the efficiency of transactions.

[0058] Figure 2 It is a flow chart of the consensus method of the multi-chain alliance blockchain structure shown in the embodiment of the present application.

[0059] See also Figure 1 The blockchain structure includes a genesis block and several chain structures. Each organization includes several chain structures. Each chain structure includes several blocks. Different organization alliances build a consortium blockchain system. The nodes of the blockchain replicate logs with each other. The log structure of the blockchain is a two-dimensional structure. The blockchain includes N alliance nodes and serial number nodes. See Figure 2 The method includes:

[0060] Step 201, obtaining a transaction request sent by the client to the target alliance node of the blockchain, and packaging a new block when the transaction in the node transaction pool reaches a preset threshold;

[0061] The blockchain in this embodiment is also multi-chain. After the creation of the genesis block, it is no longer a single chain that continues to be built and maintained after the genesis block, but can point to multiple blocks afterwards, and then each subsequent block continues to build and maintain a chain, thus forming a multi-chain blockchain structure. In one example, the alliance blockchain system includes multiple organizations such as organization 1, organization 2, organization 3, etc. Organization 1 includes a chain structure composed of blocks 1, block 3, etc., and a chain structure composed of block 7 and other blocks (if any). Each chain structure contains several blocks. In the blockchain, nodes can copy logs to each other. The log structure is changed to a two-dimensional structure.

[0062] The nodes in the blockchain refer to the computers in the blockchain network, including mobile phones and servers, etc. In this embodiment, the blockchain includes N alliance nodes and serial number nodes. The serial number nodes are used to generate new blocks.

[0063] In an optional embodiment of the present application, the alliance node is used to participate in consensus, store ledgers, and expand sub-chains.

[0064] Alliance nodes are responsible for participating in consensus, storing ledgers, and expanding the number of sub-chains within the organization.

[0065] like Figure 3 The schematic diagram of the parallel block process shown in the embodiment of the present application shows that the client first sends a transaction request for transaction Tx3 to the target alliance node 1. When the transactions in the node transaction pool reach the preset threshold, block packaging can be performed, and the transaction data such as Tx1, Tx2, Tx3... in the transaction pool can be packaged into a new block.

[0066] In an optional embodiment of the present application, the two-dimensional structure of the blockchain log corresponds to the structure of the blockchain.

[0067] Figure 4a It is a node relationship in the related technology, including a master node (leader) and a slave node (follow). The leader sends a log replication request to the slave node (follow), and the master node (leader) replicates the log. Figure 4b It is a log structure in the related art, including "a1", "b1", "c1", "b2", "b3", "a2", ... in the form of a one-dimensional log. Figure 4c The node relationship shown in the embodiment of the present application includes a follower node (follow), and the follower nodes (follow) can send log replication requests to each other and replicate logs to each other. Figure 4dThe log structure shown in the embodiment of the present application, where "a1", "a2" correspond to the log of the first chain structure, "b1", "b2", "b3" correspond to the log of the second chain structure, and "c1" corresponds to the log of the third chain structure, is a two-dimensional structure, and corresponds to the structure of the blockchain. The embodiment of the present application changes the log structure into a two-dimensional structure, and each node saves a ledger structure table, indicating the block number of each sub-chain block.

[0068] Step 202: Apply for the serial number of the new block through the serial number node, and determine whether other alliance nodes confirm the serial number of the new block;

[0069] After packaging the new block, you can apply for the serial number of the new block through the serial number node. The serial number determines the order of the new block in the entire chain structure and ensures the full order state of the entire blockchain.

[0070] After applying for the serial number of a new block, the serial number node also needs to determine whether each alliance node confirms the serial number of the new block.

[0071] In an optional embodiment of the present application, step 202 includes:

[0072] Sub-step S11, the serial number node sends a heartbeat message to other alliance nodes;

[0073] The serial number node sends a heartbeat message to other alliance nodes to confirm the serial number of the new block.

[0074] Sub-step S12: other alliance nodes confirm the sequence number of the new block based on the heartbeat message.

[0075] Other alliance nodes confirm the serial number of the new block based on the heartbeat message and return the confirmation result to the serial number node.

[0076] Step 203: When more than (N / 2+1) alliance nodes confirm, the new block is added to the chain structure maintained by each alliance node;

[0077] If it is detected that more than (N / 2+1) alliance nodes confirm the sequence number of the new node, the new block can be added to the chain structure maintained by each alliance node.

[0078] In an optional embodiment of the present application, the steps before adding a new block to the chain structure maintained by each alliance node include:

[0079] Step S1, other alliance nodes synchronize the new block;

[0080] Before adding a new block to the chain structure maintained by each alliance node, other alliance nodes, such as Figure 3 Alliance Node 2 and Alliance Node 3 can also perform block synchronization for new blocks.

[0081] Step S2: Verify the new block. After verification, add the new block to the chain structure maintained by the target alliance node.

[0082] The new block can be verified, and if it passes the verification, the new block can be added to the chain structure maintained by the target alliance node 1 at the same time.

[0083] After adding a new block to the chain structure maintained by the target alliance node 1, alliance nodes 2 and 3 also add new blocks to the chain structures they maintain. This allows blocks to be issued concurrently in multiple chain structures, improving the throughput of transaction proposals and the efficiency of the blockchain.

[0084] In an optional embodiment of the present application, step S2 includes:

[0085] Sub-step S21: The target alliance node verifies the hash value of the new block.

[0086] Hash value verification is an important method for computer data integrity checking. The complete content of a file or a piece of information is passed through a computer using a specific algorithm to obtain a small digital sequence as the summary of the file, thereby verifying the integrity of the information. In one example, if a new block is to be connected to organization 1, it is necessary to perform hash value verification through the target alliance node 1 that maintains organization 1. Changing from a single chain to a multi-chain structure can avoid the need for the next block to be generated while storing the ledger. Long waiting time for the previous block to be verified and added to the multi-chain structure reduces invalid waiting time and shortens the time interval between block generation.

[0087] In the multi-chain alliance blockchain structure, in addition to the genesis block generated when the blockchain is created, the subsequent blocks after the genesis block are generated by the serial number nodes in the blockchain and the chain structure is maintained. This achieves the effect of parallel block generation, improves block generation efficiency and transaction throughput. The multi-chain feature ensures parallel generation of blocks and easy maintenance, and the structure supports vertical expansion and has excellent scalability.

[0088] Step 204: Generate a log for adding a new block, send a log append request to other alliance nodes, and other alliance nodes copy the log to the local log collection based on the log append request;

[0089] A state replicator means that all nodes start from the same state, go through the same operation log, and eventually reach a consistent state. By setting the same goal, that is, the system has only one copy of the data, and the read and write operations are atomic, the application layer can ignore the synchronization issues between multiple data copies at the bottom of the system.

[0090] In the embodiment of the present application, the consensus algorithm is implemented based on the state replication machine (RPM) model, which means that the logs of all nodes in the cluster need to be consistent. In the scheme, the logs of each chain are processed by the corresponding node and copied to other nodes. This process is called log replication.

[0091] After the serial number node applies for the block serial number, it can generate a log for adding a new block and send a log attachment request to other alliance nodes, requiring other alliance nodes to attach the log for adding a new block to the local log collection of their respective alliance nodes.

[0092] Step 205: When it is detected that more than (N / 2+1) alliance nodes have replicated the log, each alliance node appends the log to the state replicator.

[0093] If it is detected that more than (N / 2+1) alliance nodes have copied the log, each alliance node will append the log to the state replicator. Once the log is successfully copied, it means that the status between the nodes is consistent, and the block consensus and synchronization are completed.

[0094] like Figure 5 As shown, it is a log synchronization schematic diagram shown in an embodiment of the present application, wherein log a4 is generated in node 1, and the consensus method in the embodiment of the present application is adopted to synchronize to the same position in the log stored in node 2 and the same position in the log stored in node 3; log b3 is generated in node 2, and the consensus method in the embodiment of the present application is adopted to synchronize to the same position in the log stored in node 1 and the same position in the log stored in node 3; log c5 is generated in node 3, and the consensus method in the embodiment of the present application is adopted to synchronize to the same position in the log stored in node 1 and the same position in the log stored in node 2.

[0095] Since the ledger structure of the embodiment of the present application is changed to a parallel form of multiple sub-chains, each node can generate blocks and write logs. The node must not only write its own log, but also synchronize the logs of other nodes, and then use the state replicator to execute the logs, and the states of the nodes are consistent. If the one-dimensional log form is continued, since the order of log synchronization is uncertain, if the logs of different nodes are different, the states of the nodes will not be consistent after the state replicator is executed. Therefore, the log structure is changed to a two-dimensional structure, and each node saves a ledger structure table at the same time, indicating the block number of each sub-chain block. The state replicator determines the execution order of the two-dimensional log according to the ledger structure table, thereby ensuring that the final state of each node is consistent.

[0096] The embodiment of the present application discloses a consensus method for a multi-chain alliance blockchain structure, wherein the blockchain structure includes a genesis block and several chain structures, each organization includes several chain structures, each chain structure includes several blocks, and different organization alliances are built into an alliance blockchain system, wherein the nodes of the blockchain mutually replicate logs, and the log structure of the blockchain is a two-dimensional structure, wherein the blockchain includes N alliance nodes and sequence number nodes; by obtaining a transaction request sent by a client to a target alliance node of the blockchain, when the transaction in the node transaction pool reaches a preset threshold, a new block is packaged; the sequence number of the new block is applied through the sequence number node, and it is determined whether other alliance nodes confirm the sequence number of the new block; when more than (N / 2+1) alliance nodes confirm, the new block is added to the chain structure maintained by each alliance node; a log for adding a new block is generated, and a log append request is sent to other alliance nodes, and other alliance nodes copy the log to a local log set based on the log append request; when more than (N / 2+1) alliance nodes are detected to copy the log, each alliance node appends the log to a state replicator. The effect of parallel block generation is achieved, and block generation efficiency and transaction throughput are improved. The multi-chain feature ensures parallel generation of blocks and easy maintenance, and the structure supports vertical expansion and has excellent scalability. The log structure is changed to a two-dimensional structure. At the same time, each node saves a ledger structure table, indicating the block number of each sub-chain block. The state replicator determines the execution order of the two-dimensional log according to the ledger structure table, thereby ensuring that the final state of each node is consistent.

[0097] Corresponding to the aforementioned application function implementation method embodiment, the present application also provides a consensus device, electronic device and corresponding embodiments of a multi-chain alliance blockchain structure.

[0098] Figure 6 It is a structural schematic diagram of a consensus device of a multi-chain alliance blockchain structure shown in an embodiment of the present application.

[0099] See also Figure 6 The blockchain structure includes a genesis block and several chain structures. Each organization includes several chain structures. Each chain structure includes several blocks. Different organization alliances are built into an alliance blockchain system. The nodes of the blockchain replicate logs with each other. The log structure of the blockchain is a two-dimensional structure. The blockchain includes N alliance nodes and sequence number nodes. The consensus device 600 of the multi-chain alliance blockchain structure includes:

[0100] The acquisition module 601 is used to obtain the transaction request sent by the client to the target alliance node of the blockchain, and when the transaction in the node transaction pool reaches a preset threshold, the block is packaged;

[0101] Application module 602, used to apply for the serial number of the block through the serial number node, and determine whether other alliance nodes confirm the serial number of the block;

[0102] Adding module 603, used to add the block to the chain structure maintained by each alliance node when it is detected that more than (N / 2+1) alliance nodes have confirmed it;

[0103] Log module 604, used to generate a log of adding blocks, send a log appending request to other alliance nodes, and other alliance nodes copy the log to the local log collection based on the log appending request;

[0104] The replication module 605 is used to, when it is detected that more than (N / 2+1) alliance nodes have replicated the log, each alliance node appends the log to the state machine.

[0105] In an optional embodiment of the present application, the application module 602 includes:

[0106] The sending submodule is used by the serial number node to send heartbeat messages to other alliance nodes;

[0107] The confirmation submodule is used by other alliance nodes to confirm the sequence number of the new block based on the heartbeat message.

[0108] In an optional embodiment of the present application, the device further includes:

[0109] The synchronization module is used by other alliance nodes to synchronize new blocks;

[0110] The verification submodule is used to verify the new block. After verification, the new block will be added to the chain structure maintained by the target alliance node.

[0111] In an optional embodiment of the present application, the verification submodule includes:

[0112] Verification unit, used by alliance nodes to verify the hash value of new blocks.

[0113] The embodiment of the present application discloses a consensus device for a multi-chain alliance blockchain, which achieves the effect of parallel block generation, improves block generation efficiency and transaction throughput. The characteristics of multiple chains ensure parallel generation of blocks and easy maintenance, and the structure supports vertical expansion and has excellent scalability. The log structure is changed to a two-dimensional structure, and each node saves a ledger structure table, indicating the block number of each sub-chain block. The state replicator determines the execution order of the two-dimensional log according to the ledger structure table, thereby ensuring that the final state of each node is consistent.

[0114] Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated again here.

[0115] Figure 7 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application.

[0116] See also Figure 7 , the electronic device 700 includes a memory 710 and a processor 70.

[0117] The processor 720 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0118] The memory 710 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage. Among them, ROM may store static data or instructions required by the processor 720 or other modules of the computer. The permanent storage may be a readable and writable storage device. The permanent storage may be a non-volatile storage device that does not lose the stored instructions and data even after the computer is powered off. In some embodiments, the permanent storage device uses a large-capacity storage device (such as a magnetic or optical disk, flash memory) as a permanent storage device. In other embodiments, the permanent storage device may be a removable storage device (such as a floppy disk, optical drive). The system memory may be a readable and writable storage device or a volatile readable and writable storage device, such as a dynamic random access memory. The system memory may store some or all instructions and data required by the processor at run time. In addition, the memory 710 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (such as DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, the memory 710 may include a readable and / or writable removable storage device, such as a laser disc (CD), a read-only digital versatile disc (such as a DVD-ROM, a double-layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (such as an SD card, a mini SD card, a Micro-SD card, etc.), a magnetic floppy disk, etc. Computer-readable storage media do not include carrier waves and transient electronic signals transmitted wirelessly or wired.

[0119] The memory 710 stores executable codes, and when the executable codes are processed by the processor 720 , the processor 720 can execute part or all of the methods described above.

[0120] In addition, the method according to the present application may also be implemented as a computer program or a computer program product, which includes computer program code instructions for executing some or all of the steps in the above method of the present application.

[0121] Alternatively, the present application can also be implemented as a computer-readable storage medium (or non-transitory machine-readable storage medium or machine-readable storage medium) on which executable code (or computer program or computer instruction code) is stored. When the executable code (or computer program or computer instruction code) is executed by a processor of an electronic device (or server, etc.), the processor executes part or all of the steps of the above-mentioned method according to the present application.

[0122] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A consensus method for a multi-chain alliance blockchain structure, characterized in that: The blockchain structure includes a genesis block and several chain structures, each organization includes several chain structures, each chain structure includes several blocks, different organization alliances are built into an alliance blockchain system, the nodes of the blockchain replicate logs with each other, the log structure of the blockchain is a two-dimensional structure, each of the nodes stores an account book structure table, the account book structure table is a multi-chain blockchain structure with multiple sub-chains in parallel, indicating the area code of the block in each sub-chain; wherein, the blockchain includes N alliance nodes and serial number nodes; the method includes: Obtain the transaction request sent by the client to the target alliance node of the blockchain, and package a new block when the transaction in the node transaction pool reaches the preset threshold; Apply for the serial number of the new block through the serial number node, and determine whether other alliance nodes confirm the serial number of the new block; When more than (N / 2+1) alliance nodes confirm, the new block is added to the chain structure maintained by each alliance node; Generate a log for adding the new block, send a log append request to other alliance nodes, and other alliance nodes copy the log to a local log set based on the log append request; When it is detected that more than (N / 2+1) alliance nodes have copied the log, each alliance node appends the log to the state replicator, and the state replicator determines the execution order of the log according to the ledger structure table.

2. The method according to claim 1, characterized in that The step of determining whether other alliance nodes confirm the sequence number of the new block includes: The serial number node sends a heartbeat message to other alliance nodes; Other alliance nodes confirm the sequence number of the new block based on the heartbeat message.

3. The method according to claim 1, characterized in that The steps before adding the new block to the chain structure maintained by each alliance node include: Other alliance nodes synchronize blocks for the new block; The new block is verified, and after passing the verification, the new block is added to the chain structure maintained by the target alliance node.

4. The method according to claim 3, characterized in that The verification of the new block includes: The target alliance node performs hash value verification on the new block.

5. The method according to claim 1, characterized in that The two-dimensional structure of the blockchain log corresponds to the structure of the blockchain.

6. The method according to any one of claims 1 to 5, characterized in that: The alliance nodes are used to participate in consensus, store ledgers, and expand sub-chains.

7. A consensus device of a multi-chain alliance blockchain structure, characterized in that: The blockchain structure includes a genesis block and several chain structures. Each organization includes several chain structures. Each chain structure includes several blocks. Different organization alliances are built into an alliance blockchain system. The nodes of the blockchain replicate logs with each other. The log structure of the blockchain is a two-dimensional structure. Each node stores an account structure table. The account structure table is a multi-chain blockchain structure with multiple sub-chains in parallel, indicating the area code of the block in each sub-chain; wherein the blockchain includes N alliance nodes and serial number nodes; the device includes: The acquisition module is used to obtain the transaction request sent by the client to the target alliance node of the blockchain, and package the block when the transaction in the node transaction pool reaches the preset threshold; An application module, used to apply for the serial number of the block through the serial number node, and determine whether other alliance nodes confirm the serial number of the block; An adding module is used to add the block to the chain structure maintained by each alliance node when it is detected that more than (N / 2+1) alliance nodes have confirmed it; A log module, used to generate a log for adding the block, send a log appending request to other alliance nodes, and other alliance nodes copy the log to a local log set based on the log appending request; The replication module is used for, when it is detected that more than (N / 2+1) alliance nodes have replicated the log, each alliance node appends the log to a state replicator, and the state replicator determines the execution order of the log according to the ledger structure table.

8. An electronic device, characterized in that: include: processor; as well as A memory having executable codes stored thereon, which, when executed by the processor, causes the processor to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: An executable code is stored thereon, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the method as claimed in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Alliance block chain consensus method and system based on joint signature

    CN113256427A

  • Cross-department case-related property information sharing system structure based on block chain

    CN113839985A