Self-adaptive extensible consensus method based on block chain and directed acyclic graph

By introducing adaptive scalable consensus methods and block reference strategies into the blockchain network, adjusting the topology of directed acyclic graphs, solving the problems of split attacks and low throughput, achieving higher concurrency and system stability.

CN119071304AInactive Publication Date: 2024-12-03BEIJING INST OF TECH

Patent Information

Application Number
CN202410424288.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-10
Publication Date
2024-12-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing consensus protocols based on blockchain and directed acyclic graphs are difficult to effectively resist split attacks, resulting in system instability, and the throughput of traditional blockchain systems is low, which cannot meet the needs of high concurrent transactions.

Method used

Adaptive scalable consensus method is adopted to adjust the priority of block reference by introducing the highest cumulative score strategy and the longest shortest path strategy in the blockchain network, and modify the block structure through the Phantasm consensus protocol to build a hash tree and reference Data fields to affect the topology of directed acyclic graphs, thereby resisting split attacks and improving throughput.

Benefits of technology

It effectively reduces the probability of success of split attacks, improves the concurrency and throughput of the blockchain system, and makes the system more stable and efficient when handling high concurrent transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071304A_ABST
    Figure CN119071304A_ABST
Patent Text Reader

Abstract

The invention provides a self-adaptive extensible consensus method based on a block chain and a directed acyclic graph, and the method comprises the steps: initializing a block chain network based on the directed acyclic graph; when a node in the block chain network initiates a new transaction, the node broadcasts transaction information to the block chain network; adding the valid transaction information to a transaction pool; the working node uses a consensus protocol to determine the maximum block reference number of the new block based on the block difficulty, determines the previous block reference priority based on the block reference strategy, creates the new block, and adds the transaction information in the transaction pool into the new block; and verifying the new block, and broadcasting the verified new block to the block chain network. The directed acyclic graph technology is introduced into the block chain system, and each transaction can be connected to a plurality of previous transactions, so that the nodes can process the plurality of transactions in parallel, and the block chain network has higher concurrency and throughput when processing the transactions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of blockchain consensus protocols, and in particular to an adaptive and scalable consensus method based on blockchain and directed acyclic graphs. Background Art

[0002] As a promising technology, blockchain technology has become a hot topic in computer research. Currently, blockchain-related theories and methods have been widely used in both engineering and scientific fields.

[0003] Consensus Protocol refers to a set of rules and algorithms for each node to reach a consensus on a transaction or state in a distributed system. In the absence of a central authority, the consensus protocol maintains the consistency of the system by ensuring that all nodes in the network agree on a specific transaction or state. In blockchain technology, the blockchain system is composed of a growing number of blocks linked back and forth using hash pointers. The data in the blockchain can only be appended and cannot be deleted or tampered with. The blockchain system is a typical distributed system in which each node maintains a local blockchain data backup. In the blockchain system, the blockchain consensus protocol establishes a set of rules that each node must follow, ultimately ensuring that different nodes in the distributed system reach a consensus when adding new blocks.

[0004] As the core component of the blockchain system, the consensus protocol determines both the performance and security of the blockchain system. However, traditional chain-based blockchain systems usually have the problem of low throughput, resulting in suboptimal system performance. Introducing a directed acyclic graph (DAG) structure in the existing blockchain system can achieve high transaction throughput and solve the problem of suboptimal performance of traditional chain-based blockchain systems. This approach enables blocks to reference multiple previous blocks, thereby processing blocks in parallel with better performance. Compared with traditional chain-based blockchain systems, blockchain solutions based on directed acyclic graphs have the following advantages:

[0005] (1) In a blockchain scheme based on a directed acyclic graph, the traditional chain structure is extended to a graph structure, in which each block can reference multiple successor blocks. Therefore, each user can freely choose the previous block to extend without competing to mine the next block. This design avoids the consumption of competitive transactions caused by linearly sorted blocks.

[0006] (2) Directed acyclic graphs allow transactions to be processed in parallel in the network, rather than sequentially as in traditional blockchains. This improves the scalability of the system, enabling the network to better handle high-concurrency transactions, greatly improving the system’s throughput.

[0007] (3) Since transactions can reach consensus in parallel processing, consensus mechanisms based on directed acyclic graphs can usually achieve lower transaction confirmation times. This is very beneficial for application scenarios that require fast transaction confirmation (such as payment).

[0008] (4) The design of the directed acyclic graph structure supports broader decentralization because each node can participate in the consensus process in parallel without waiting for a single central node or worker node.

[0009] However, the introduction of a directed acyclic graph structure also increases the risk of decentralized computing power in blockchain systems. Attacks caused by decentralized computing power are also called split attacks, in which the adversary is more likely to focus its computing power on building alternative blocks. This form of attack is often referred to as a 51% attack in chain-based blockchain systems. Such attacks have proven to be a potential threat because they cause the blockchain structure to fork, ultimately leading to a series of problems such as the double spending problem. In blockchain systems based on directed acyclic graphs, these attacks usually target the reversal of the order of blocks in the graph structure, leading to serious consequences.

[0010] In order to alleviate the problems caused by split attacks, the most common solutions propose various sorting protocols to solve the order uncertainty of those unconnected blocks, thereby enhancing stability. For example, the Phantom consensus protocol votes on blocks and calls a recursive greedy algorithm to sort all blocks from the genesis block to the latest block. Since all blocks reference the genesis block, the genesis block is the heaviest one. The heavier the block, the higher the priority of the block. This heaviest chain rule is used to sort the sequence of blocks, similar to using the longest chain rule to deal with block forks.

[0011] Unfortunately, existing solutions are still unable to effectively defend against split attacks. Since most schemes force mined blocks to randomly reference as many blocks as possible to increase the probability of being confirmed, this will lead to the dispersion of honest node computing power. Adversaries can concentrate computing power to build alternative blocks and conduct split attacks according to the heaviest chain rule, making the consensus results unstable. Summary of the invention

[0012] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide an adaptive and scalable consensus method based on blockchain and directed acyclic graph.

[0013] To achieve the above object, the present invention provides the following solutions:

[0014] An adaptive and scalable consensus method based on blockchain and directed acyclic graph, including:

[0015] Initialize a blockchain network based on a directed acyclic graph and build a p2p distributed network;

[0016] When any node in the blockchain network initiates a new transaction, the node broadcasts the transaction information to other nodes in the blockchain network;

[0017] When the transaction information is verified by other nodes, the valid transaction information is added to the transaction pool;

[0018] The worker nodes use the consensus protocol to determine the maximum number of block references for a new block based on the block difficulty, and determine the priority of previous block references based on the block reference strategy;

[0019] The working node uses a consensus protocol to create a new block based on the maximum block reference number of the new block and the previous block reference priority, and adds the transaction information in the transaction pool to the new block;

[0020] The new block is verified and the verified new block is broadcasted to the blockchain network.

[0021] Preferably, in a blockchain network with a directed acyclic graph, each block has one or more references to previous blocks, and the reference relationship composed of each block depicts a directed acyclic graph in the blockchain network.

[0022] Preferably, the block reference strategy includes: a maximum cumulative score strategy and a longest shortest path strategy.

[0023] Preferably, in the execution of the longest shortest path strategy, each block is initially assigned a score, the new block accumulates the scores of the referenced blocks, and the final score of the block consists of the assigned score plus the accumulated score extended from the referenced blocks;

[0024] For a subset of all unreferenced blocks sorted by cumulative scores, let C max represents the maximum score, C i Represents the score of the i-th block and calculates the contribution rate r of each tip i =log(α+C i / C max ) / log(α+1); where parameter α∈(0,1];

[0025] The allocation score of the block that has not been referenced is represented as a, so the cumulative score of the block that has not been referenced is calculated as s = a + C i *r i ;

[0026] Sort the unreferenced blocks according to the cumulative scores to get the previous block reference priority.

[0027] Preferably, in the execution of the longest shortest path strategy, the Dijkstra algorithm is called to obtain the length of each block in the blockchain network based on the directed acyclic graph, and the block length is used to sort the subset of all candidate unreferenced blocks. The larger the block length, the higher the reference priority.

[0028] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and characterized in that when the computer program is executed by the processor, the steps of the above-mentioned adaptive and scalable consensus method based on blockchain and directed acyclic graph are implemented.

[0029] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the above-mentioned adaptive and scalable consensus method based on blockchain and directed acyclic graph are implemented.

[0030] The beneficial effects of the adaptive and scalable consensus method based on blockchain and directed acyclic graph provided by the present invention are: compared with the prior art, the present invention can connect each transaction to multiple previous transactions by introducing directed acyclic graph technology into the blockchain system, so that nodes can process multiple transactions in parallel, which makes the blockchain network have higher concurrency and throughput when processing transactions; in addition, the present invention can influence the topology of the directed acyclic graph in a positive way by adopting a block reference strategy to issue mined blocks, thereby resisting possible attacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0032] Figure 1 is a schematic diagram of a threat model provided by an embodiment;

[0033] Figure 2 This is a blockchain system model based on a directed acyclic graph provided by an embodiment. DETAILED DESCRIPTION

[0034] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0035] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0036] The terms "first", "second", "third" and "fourth" in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps, processes, methods, etc. are not limited to the listed steps, but may optionally include steps that are not listed, or may optionally include other step elements inherent to these processes, methods, products or devices.

[0037] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0038] Based on the Phantom consensus protocol, the present invention proposes an adaptive and scalable consensus protocol (Phantasm) based on blockchain and stable directed acyclic graph. Phantasm follows the sorting protocol of Phantom and improves on the basis of the consensus protocol of Phantom to make it adaptable and scalable. In the consensus protocol Phantasm designed by the present invention, the consensus protocol reconstructs the algorithm for selecting the previous block by implementing an adaptive and scalable method, allowing the reference priority strategy to be set to affect the topology of the directed acyclic graph. The adaptive and scalable method is implemented by modifying the block structure. In the Phantasm consensus protocol, the present invention changes the data field of the previous hash value in the block header and uses it to store the root of the hash tree constructed by all candidate block references. A new reference data field is added to the block body, each element of which includes a hash and proof data field to form a hash path referenced by the selected block.

[0039] See also Figure 1-2 , an adaptive and scalable consensus method based on blockchain and directed acyclic graph, including:

[0040] Step 1: Initialize a blockchain network based on a directed acyclic graph and build a p2p distributed network; in a blockchain network with a directed acyclic graph, each block has one or more references to previous blocks, and the reference relationship composed of each block depicts a directed acyclic graph in the blockchain network. The directed acyclic graph of the block defines the data structure of the block, which is generally expressed as G = (ν, ε), where ν represents a group of blocks and ε represents a group of reference relationships, each of which consists of two blocks. There are only one-way references in the directed acyclic graph of the block, and each block can contain multiple references, and the number of references is also unlimited.

[0041] Step 2: When any node in the blockchain network initiates a new transaction, the node broadcasts the transaction information to other nodes in the blockchain network;

[0042] Step 3: When the transaction information is verified by other nodes, the valid transaction information is added to the transaction pool;

[0043] Step 4: The working node uses the consensus protocol to determine the maximum number of block references for the new block based on the block difficulty, and determines the priority of the previous block reference based on the block reference strategy; the block reference strategy includes: the highest cumulative score strategy and the longest shortest path strategy; the consensus protocol is a protocol used to verify and add new blocks to the blockchain to expand the directed acyclic graph in the directed acyclic graph blockchain network. The block structure includes a header part and a body part, where only the header part is used to calculate the solution to the block puzzle. Each working node needs to solve such a puzzle to generate a valid block.

[0044] The present invention also designs two block reference strategies for the consensus protocol in Phantasm, namely the highest cumulative score strategy and the longest shortest path strategy. Honest working nodes first solve the block puzzle and then use the block reference strategy to issue the mined blocks. By setting the priority of block reference selection, the additional blocks affect the topology of the directed acyclic graph in a positive way, thereby resisting possible attacks.

[0045] In the execution of the highest cumulative score strategy, the protocol assigns a score to each block at the beginning, and the new block accumulates the score of the referenced block. The final score of the block consists of the assigned score plus the cumulative score extended from the reference block, that is, the final score = the initial assigned score + the accumulation of (the score of the new block * the contribution rate). In order to avoid including stale blocks, the working node first refers to the block with the largest cumulative score and defines the score calculation method. The closer the score of the reference block is, the greater the cumulative score. Taking the maximum score of the reference block as the benchmark, each block contributes the cumulative score to the mining block in a certain proportion. The farther the score is from the maximum score, the smaller the contribution. Finally, the selected reference of the mining block is obtained and its score is updated.

[0046] In the execution of the longest shortest path strategy, the purpose of the longest shortest path strategy is to find the branch containing the outdated block and suggest the working node not to expand it. In the present invention, the length of the block is defined as the length of the shortest path from the current block to the genesis block in the graph. The Dijkstra algorithm is called to obtain the length of the path in the blockchain system based on the directed acyclic graph. The longest shortest path strategy uses the block length to sort the subset of all candidate unreferenced blocks. The larger the block length, the higher the priority of the reference.

[0047] Step 5: The working node uses the consensus protocol to create a new block based on the maximum block reference number of the new block and the previous block reference priority, and adds the transaction information in the transaction pool to the new block;

[0048] Step 6: Verify the new block and broadcast the verified new block to the blockchain network.

[0049] The present invention further illustrates the above method of the present invention in conjunction with specific embodiments below:

[0050] (1) Consensus protocol execution:

[0051] In the blockchain system, valid transactions can be verified and proceed to the consensus protocol execution step. The consensus protocol plays a key role in proposal generation. Workers compete for the right to create new blocks by solving complex mathematical problems. The proposal generation process involves selecting appropriate transactions and building new blocks, and the consensus protocol ensures fair competition and that the node's chance to create a new block is proportional to its computing power.

[0052] The key to controlling the number of block references is to defer the decision of block references to the mining phase. A common approach is to select a referenced block and calculate the current block puzzle. The puzzle is calculated by building a hash tree of these referenced blocks, using the root hash as the reference of the block. Once a valid block is mined, the actual reference is attached to the block in the form of a hash proof and broadcast.

[0053] In the Phantasm consensus protocol, the block header in the block structure changes the data field of the previous hash value to refs_root (element), which is used to store the root of the hash tree built by all candidate block references. A new reference data field (array) is added to the block body, where each element includes a hash (element) and proof (array) data field to form the hash path of the selected block reference.

[0054] When the consensus protocol is executed, the hash tree is first constructed using the hashes of the subset of all blocks that have not been referenced in the current blockchain system based on a directed acyclic graph. And the block is required to reference the root of the constructed hash tree. Next, a similar program logic is followed to try the random number of the block puzzle. The block header only contains the root of the hash tree referenced by the block, and its content can be specified after the solution to the block puzzle is found in the consensus protocol execution. Subsequently, the protocol evaluates the block difficulty and calculates the maximum number of block references allowed. The lower the hash value of the block, the larger the number of the maximum number of block references allowed. Such steps meet the principle that blocks with higher difficulty are recommended to reference more blocks and adapt to the block difficulty. Finally, the consensus protocol sorts the subset of all blocks that have not been referenced, and obtains blocks with higher priorities that do not exceed the maximum number of block references allowed. The hash paths corresponding to these blocks are iteratively attached to the block and returned.

[0055] (2) Block reference strategy execution:

[0056] In this step, the block reference strategy designed for the consensus protocol in (4) is executed. In the above, the present invention proposes two block reference strategies, the highest cumulative score strategy and the longest shortest path strategy. In this step, any one of the two reference strategies is selected for execution.

[0057] In the execution of the highest cumulative score strategy, the working node first refers to the block with the largest cumulative score and defines the score calculation method. The closer the score of the reference block is, the greater the cumulative score is. The strategy uses a logarithmic function to calculate the score contribution rate and introduces a contribution parameter α∈(0,1] to control the reference range. For a subset of all unreferenced blocks sorted by cumulative score, let C max represents the maximum score, C i Represents the score of the i-th block and calculates the contribution rate r of each tip i =log(α+C i / C max ) / log(α+1). The larger the parameter α, the greater the contribution score. Taking the maximum score of the reference block as the benchmark, each block contributes a certain proportion to the mining block. The farther the score is from the maximum score, the smaller the contribution. The allocation score of the current block is represented as a, so the cumulative score is calculated as s=a+C i *r i According to the principle that blocks with higher difficulty are recommended to cite more blocks, the actual number of block citations is regarded as the allocated score of the mined block in the execution of the highest cumulative score strategy. That is, the minimum score of a block is 1, and the score of the genesis block is set to 1 by default.

[0058] In the execution of the longest shortest path strategy, the strategy guides the direction of lengthening the length of the blockchain based on the directed acyclic graph. The block length is used in the strategy to sort the subsets of all candidate unreferenced blocks. The larger the length, the higher the priority of the reference. Following the principle that blocks that can determine the order of parallel blocks have high priority to be referenced, the maximum number of block references currently allowed in the blockchain based on the directed acyclic graph and the maximum number of references calculated based on the block difficulty are input, and the ranked block length is output. The longest shortest path strategy guides the working nodes to refer to the blocks with the longest shortest path, which means that the working nodes tend to refer to newer blocks rather than older or outdated blocks.

[0059] (3) Block Verification:

[0060] In this step, it is verified whether the newly created block complies with the consensus rules and network protocols. This includes verification of the format of the block header and transaction, digital signature, Merkle tree, consensus rules, etc. Verification is an important part of ensuring the legitimacy of the new block and the security of the entire blockchain system. The blocks generated by the consensus protocol need to go through the block verification step to ensure their validity and compliance with network rules.

[0061] (4) Sorting protocol execution:

[0062] In the Phantasm consensus protocol, an asynchronous sorting protocol is used. Sorting protocol execution and block verification are performed in parallel. The sorting protocol execution in the Phantasm consensus protocol usually has two phases. First, it divides the blocks in the directed acyclic graph into blue and red (called block coloring). The blue group represents the blocks published by the majority of honest computing power, while the red group represents the blocks created by a small number of malicious working nodes. Second, it determines the order based on topological sorting, breaking ties by blocks with the lowest hash value (called block sorting). To maintain consistency, only blocks in the blue set are used to make the final ledger. Honest nodes always publish mined blocks immediately and reference other received blocks.

[0063] The sorting protocol introduces a clustering factor parameter k to estimate the average number of blocks created per round. The set of blocks created by honest nodes should be well-connected, where the anti-cone of each block is usually lower than k. Therefore, the blue set should satisfy the maximum k-cluster subgraph. The maximum k-cluster subgraph means that, given a blockchain based on a directed acyclic graph with G = (ν, ε), if for any B∈S, |anticone(B,G)∩S|≤k, then the subset It is called a k-cluster. Here, the subset ν-S is the red set. The sorting protocol uses the above definition to find the largest k-cluster subgraph to output the blue set, and uses a greedy algorithm to sort the subgraph from the genesis block to the subset of blocks that have not been referenced yet.

[0064] (5) Block addition:

[0065] In (4), the sorting protocol selects one or more previous blocks as the parent blocks for the newly generated block. The new block references the information of the selected parent blocks into itself. After the new block is added, it will be broadcast to the entire network so that other nodes can verify and add it to their respective copies of the blockchain.

[0066] like Figure 1 As shown, the present invention provides a threat model of a process instance of a traditional blockchain system being attacked by a split attack. Initially, the balances of two accounts A and B in the network are both set to 100. A initiates a total of two transactions to B in the process of generating blocks a, b, c, ... One of the transactions is that A transfers half of the balance to B, which is packaged in block b. The other transaction is that A transfers 40 to B, which is packaged in block c. If b precedes c, the final balance of A is 10 and the final balance of B is 190. If c precedes b, the final balance of A is 30 and the final balance of B is 170. From Figure 2 It can be seen that the number of sequential b and c blocks directly affects the order of transactions, resulting in differences in the final account balances of A and B. This means that if the adversary can reverse the order of b and c through a split attack, the account balance of the entire network can be changed, which is catastrophic in the blockchain system.

[0067] The use of the Phantasm consensus protocol proposed by the present invention can avoid the impact of the above-mentioned split attack. In a split attack, the adversary will insert the conflict block into the honest subgraph and create a subgraph to sort the conflict block before the attacked block. Once the conflict block and the attacked block are both in the blue set, and the block sorting stage determines that the conflict block is prioritized, the adversary will publish the remaining subgraphs to make the attack successful. The Phantasm consensus protocol can adjust the structure of the directed acyclic graph to stabilize the sorting results, thereby effectively reducing the probability of a successful split attack. Since referencing a subset of all unreferenced blocks in a blockchain system using the Phantasm consensus protocol is equivalent to a useless vote on block coloring, the reference strategy given by the Phantasm consensus protocol provides the ability to resist such malicious behavior, guiding the honest block to reference a subset of unreferenced blocks with a larger block length. Since malicious blocks must contain conflict blocks with shorter block lengths, the reference strategy adopted by the honest working node can resist the insertion of conflict blocks, stabilize the system, and thus resist split attacks.

[0068] like Figure 2 As shown, the present invention designs an adaptive and scalable consensus protocol and system (Phantasm) based on blockchain and stable directed acyclic graph. The system mainly includes a network layer and a data layer.

[0069] The network layer consists of interconnected worker nodes that generate and broadcast blocks to build the data layer. In the network layer, each worker node randomly connects to multiple worker nodes as neighbors to build a peer-to-peer network. Worker nodes use the gossip protocol to propagate new blocks and transactions.

[0070] The data layer is abstracted from the blocks stored by the worker nodes, where each block has multiple references to previous blocks. The worker nodes depict a directed acyclic graph of blocks through reference relationships. Due to network latency, different worker nodes may have different views of this directed acyclic graph. After syncing with others, they will eventually get a global view.

[0071] The system works as follows:

[0072] (1) Initialize the system:

[0073] First, the system initializes the blockchain network based on the directed acyclic graph and builds a p2p distributed network. The entire process of the Phantasm consensus protocol is completed by the blockchain network.

[0074] (2) Transaction Broadcast:

[0075] Blockchain transaction broadcasting refers to the process of propagating new transaction information from one user (or node) to the entire blockchain network.

[0076] First, the user initiates a new transaction, which may be a transfer, smart contract execution, or other types of blockchain operations. Transactions are usually packaged into a data structure called transaction information. This information includes key information such as the sender, receiver, amount, signature, etc.

[0077] The user who initiates the transaction broadcasts the transaction information to other nodes in the blockchain network. This can be done through peer-to-peer communication protocols, network broadcasts, or dedicated transaction broadcast protocols.

[0078] (3) Transaction Verification:

[0079] In the blockchain system, transaction verification is a key step to ensure the validity of new transactions. Nodes ensure the legitimacy and consistency of transactions through multiple steps such as checking transaction format, verifying digital signatures, and confirming the legitimacy of inputs. This process prevents fraud and maintains the security and immutability of the blockchain. Through these verifications, valid transactions are added to the transaction pool, waiting for further block generation and broadcasting.

[0080] (4) Phantasm consensus protocol execution:

[0081] The Phantasm consensus protocol execution includes the execution of the consensus protocol and the sorting protocol. Workers can adaptively and scalably select a subset of unreferenced blocks (leaf blocks) in the directed acyclic graph of blocks to reference previous blocks. By modifying the block structure, workers can adjust block references after obtaining a solution to a block puzzle, and the maximum number of block references is determined by its block difficulty. Subsequently, the Phantasm consensus protocol selects a strategy from the two block reference strategies of maximum cumulative score and longest shortest path to guide honest workers to reference blocks that have a higher impact on the consensus result. By using this adaptive and scalable mining protocol to append blocks, the directed acyclic graph of blocks can effectively help the sorting protocol distinguish malicious blocks.

[0082] (5) Block addition:

[0083] In (4), the Phantasm consensus protocol selects a parent block for the newly added block and ensures the legitimacy and validity of the block through block verification. This step refers to the parent block information in the newly added block, updates the status of the entire network, and finally broadcasts the new block to the network. Consensus confirmation then ensures that other nodes also agree to accept the block and maintain the consistency of the network. In a blockchain based on a directed acyclic graph, multiple parent blocks are selected to build a nonlinear structure, making the block addition process more flexible and parallel. The entire process ensures the consistency and security of the blockchain.

[0084] According to the specific embodiments of the present invention, the present invention provides the following beneficial effects:

[0085] 1. High throughput: Directed acyclic graph technology is introduced into the blockchain system. Compared with the linear block structure in the traditional blockchain, the directed acyclic graph adopts a graph structure, and each transaction can be connected to multiple previous transactions. At the same time, nodes can process multiple transactions in parallel. This makes the system have higher concurrency when processing transactions and improves the overall throughput.

[0086] 2. Scalability: When the consensus protocol is executed, the hash tree is first constructed using the hashes of a subset of all blocks that have not yet been referenced in the current blockchain system based on a directed acyclic graph. The block is required to reference the root of the constructed hash tree. Next, a similar program logic is followed to try the random number of the block puzzle. The block header only contains the root of the hash tree referenced by the block, and its content can be specified after the solution to the block puzzle is found in the consensus protocol execution, making the consensus protocol scalable.

[0087] 3. Anti-splitting attack: In a splitting attack, the adversary will insert the conflicting block into the honest subgraph and create a subgraph to sort the conflicting block before the attacked block. Once the conflicting block and the attacked block are both in the blue set, and the block sorting stage determines that the conflicting block is prioritized, the adversary will release the remaining subgraphs to make the attack successful. The consensus protocol designed by the present invention can adjust the structure of the directed acyclic graph to stabilize the sorting results, thereby effectively reducing the probability of a successful splitting attack.

[0088] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and characterized in that the computer program implements the steps in the above-mentioned adaptive and scalable consensus method based on blockchain and directed acyclic graph when executed by the processor. Compared with the prior art, the beneficial effects of an electronic device provided by the present invention are the same as the beneficial effects of the adaptive and scalable consensus method based on blockchain and directed acyclic graph described in the above technical solution, and will not be elaborated here.

[0089] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps in the above-mentioned adaptive and scalable consensus method based on blockchain and directed acyclic graph are implemented. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present invention are the same as the beneficial effects of the adaptive and scalable consensus method based on blockchain and directed acyclic graph described in the above technical solution, which will not be elaborated here.

[0090] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the method disclosed in the embodiment, since it corresponds to the device disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the device part description.

[0091] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. An adaptive and scalable consensus method based on blockchain and directed acyclic graph, characterized in that: include: Initialize a blockchain network based on a directed acyclic graph and build a p2p distributed network; When any node in the blockchain network initiates a new transaction, the node broadcasts the transaction information to other nodes in the blockchain network; When the transaction information is verified by other nodes, the valid transaction information is added to the transaction pool; The worker nodes use the consensus protocol to determine the maximum number of block references for a new block based on the block difficulty, and determine the priority of previous block references based on the block reference strategy; The working node uses a consensus protocol to create a new block based on the maximum block reference number of the new block and the previous block reference priority, and adds the transaction information in the transaction pool to the new block; The new block is verified and the verified new block is broadcasted to the blockchain network.

2. According to claim 1, an adaptive and scalable consensus method based on blockchain and directed acyclic graph, characterized in that: In a directed acyclic graph blockchain network, each block has one or more references to previous blocks, and the reference relationship between each block depicts a directed acyclic graph in the blockchain network.

3. According to claim 2, an adaptive and scalable consensus method based on blockchain and directed acyclic graph, characterized in that: The block reference strategies include: a maximum cumulative score strategy and a longest and shortest path strategy.

4. According to claim 3, an adaptive and scalable consensus method based on blockchain and directed acyclic graph, characterized in that: In the execution of the longest shortest path strategy, the Dijkstra algorithm is called to obtain the length of each block in the blockchain network based on the directed acyclic graph, and the block length is used to sort the subset of all candidate unreferenced blocks. The larger the block length, the higher the reference priority.

5. An electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, wherein: When the computer program is executed by the processor, the steps of an adaptive and scalable consensus method based on blockchain and directed acyclic graph as described in any one of claims 1 to 4 are implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of an adaptive and scalable consensus method based on blockchain and directed acyclic graph as described in any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Consensus mechanism architecture of directed acyclic graph structure block chain and method thereof

    CN112202775A

  • Optimized asynchronous BFT consensus implementation method suitable for alliance chain

    CN117792608A

Cited By

  • Intelligent consensus method and device for block chain and directed acyclic graph network fusion

    CN119865302A

  • An intelligent consensus method and device integrating blockchain and directed acyclic graph network

    CN119865302B