Block chain system based on parallel chain structure and construction method thereof
By adopting a parallel chain structure and a random weight assignment mechanism in the blockchain system, the problem of traditional blockchain systems being susceptible to active attacks is solved, and an efficient, secure and fast-responsive blockchain system is achieved.
Patent Information
- Application Number
- CN202510055579.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2045-01-14
AI Technical Summary
Traditional blockchain systems based on tree graph structures are susceptible to active attacks, resulting in the inability to converge the ledger state, and the adaptive weight adjustment mechanism is time-consuming and resource consumption is high.
A blockchain system based on a parallel chain structure is adopted, and transactions are recorded through multiple parallel chains and the heaviest subtree principle is used for ledger construction. Each block is assigned a random weight based on the leading 0 numbers of the hash value, decoupling the block creation from the chain-up process. After the mining is successful, the node determines which chain to add the block to according to the last log2 k bits of the block hash value, and improves system security through the tamper-proof hash value set and PoW consensus mechanism.
It significantly improves the system's transaction processing speed and ledger update speed, enhances the system's attack resistance and security, reduces the ledger convergence time, and improves the system's stability and reliability.
Smart Images

Figure CN119853926A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain, and in particular to an efficient and secure blockchain system based on a parallel chain structure and a construction method thereof. Background Art
[0002] DAG has the characteristics of high concurrency and is considered to be one of the most promising directions for solving the scalability of blockchain. DAG-based distributed ledger structures can be divided into the following three types: 1) DAG distributed ledger structure based on the main chain, first a main chain is agreed upon in the ledger, and then other blocks in the DAG are topologically sorted according to the main chain to determine the final order of blocks in the entire ledger; 2) DAG ledger structure based on parallel chains, each node or account in the network maintains a chain to record local information, and the chains interact and reference each other to form a DAG ledger based on parallel chains; 3) Distributed ledger structure based on naive DAG, using the topological properties of DAG to sort blocks, and when there are multiple blocks to choose from, a voting mechanism is used for consensus.
[0003] GHOST and Conflux are the mainstream DAG-based blockchain systems. The GHOST protocol first proposed using a tree structure to store blocks, reduce the difficulty of mining, and use the blocks on the branch and the heaviest subtree principle to determine the order of blocks in the ledger and prevent the system from being attacked by double spending. However, GHOST is vulnerable to active attacks by malicious nodes, that is, attackers use network delays to control the order and time of block arrival, so that there are two or more heaviest subtrees with equal weights in the node's local ledger, and it is impossible to determine which is the heaviest subtree.
[0004] In response to the problem that GHOST is vulnerable to active attacks, Conflux proposed an adaptive weight adjustment mechanism. When mining, nodes detect whether the system may be subject to active attacks by comparing the weights between subtrees and the duration of the ledger being in an unconverged state. If it is detected that it may be subject to active attacks, the system will increase the difficulty of mining, and successfully mined blocks will be given higher weights.
[0005] However, the above adaptive weight adjustment mechanism requires nodes to monitor the local ledger status all the time, and the weight adjustment process is time-consuming. Therefore, how to increase the difficulty of active attacks by attackers, reduce the ledger convergence time, save node local resources and improve system security has become the current research focus in this field. Summary of the invention
[0006] The present invention aims to solve one of the technical problems existing in the related art at least to a certain extent.
[0007] One object of the present invention is to provide a blockchain system based on a parallel chain structure to solve the problem that the traditional blockchain system based on a tree graph structure is susceptible to active attacks, while improving the security of the system and ensuring the high throughput of the system.
[0008] Another object of the present invention is to provide a method for constructing the above-mentioned blockchain system based on the parallel chain structure.
[0009] In order to achieve the above-mentioned purpose, the present invention provides a blockchain system based on a parallel chain structure, including:
[0010] Multiple parallel chains, each chain is used to record transactions and use the heaviest subtree principle to build the ledger;
[0011] After creation, each block is assigned a random weight based on the number of leading 0s in its hash value;
[0012] Decouple the block creation from the chain process. After the node successfully mines, if there are k chains in the system, according to the last log of the block hash value 2 The k bit determines which chain the block is added to;
[0013] Each block contains a set of tamper-proof hash values, which are selected by traversing each chain and following the heaviest subtree principle;
[0014] The node performs a verification mechanism on the received block, verifying its hash value and tamper-proof hash value set.
[0015] A further preferred technical solution of the present invention is that when a node joins a network, it establishes a connection with other nodes through broadcasting, synchronizes historical data and the status of other nodes in the network, and verifies historical data through a PoW consensus mechanism.
[0016] Preferably, each block is assigned a random weight according to the number of leading zeros in its hash value after creation, specifically: a weight is assigned to each block by calculating the number of leading zeros in the hash value, and the block weight is equal to the number of leading zeros in the hash value.
[0017] Preferably, the method for selecting the tamper-proof hash value set for each block is:
[0018] Traverse each chain, and perform depth-first traversal on each chain according to the heaviest subtree principle;
[0019] If there are multiple blocks with equal weights in the same layer, select the block with the smaller hash value to continue traversing downwards;
[0020] If there are multiple blocks with the same hash value and the same block weight, select the earlier created block to continue traversing downwards based on the timestamp of block creation.
[0021] Preferably, the node performs a verification mechanism on the received block to verify its hash value and tamper-proof hash value set, and the specific method is:
[0022] After receiving a block in the network, the node first verifies whether the hash value of the block meets the conditions. If the conditions are met, it then traverses k chains to determine whether the block in the tamper-proof hash value set actually exists in each chain and is located on the main chain.
[0023] As a preferred method, the node sorts the blocks in the ledger as follows:
[0024] The node traverses each chain in turn, starting from the genesis block, and selects the child block with the largest weight, adding it to the end of the block sequence;
[0025] Add the child blocks of the sub-block with the largest weight to the block sequence in order of hash values from small to large;
[0026] Select a block with the largest weight from all child blocks and continue traversing until the leaf node is reached.
[0027] Another aspect of the present invention provides a method for constructing the above-mentioned blockchain system based on the parallel chain structure, comprising the following steps:
[0028] S100. When a node joins the network, a genesis block containing no transactions is created for each chain to initialize the ledger structure.
[0029] S200, nodes use PoW mechanism for mining;
[0030] S300, when the node is mining, it selects a part of the content and adds it to the block header for hash value calculation;
[0031] S400: After receiving the blocks sent by other nodes in the network, the node stores them locally and puts the blocks on the chain through the consensus mechanism;
[0032] S500, select a tamper-proof block for each chain based on the heaviest subtree principle;
[0033] S600: The node newly added to the network establishes connections with other nodes and synchronizes historical data.
[0034] Preferably, the parameters of the genesis block of each chain in step S100 are fixed and written in the Genesis FIle. When downloading the client, the node obtains the file through the built-in Genesis FIle download address. After the download is completed, the file signature is verified through the public key.
[0035] Preferably, in step S400, after receiving the block sent by other nodes in the network, the node puts the block on the chain through the consensus mechanism, including verifying and putting the received block on the chain; wherein:
[0036] To verify the received block, first verify whether its hash value meets the conditions, that is, whether the hash value of the block is less than a certain value; then verify the correctness of the transactions in the block, that is, check whether the transactions have been tampered with;
[0037] The chain operation is as follows: the node converts the calculated hash value into a decimal and takes the modulus of k to get a number, which indicates which chain the block needs to be added to.
[0038] Preferably, when the node newly added to the network establishes a connection with other nodes in step S600, other nodes in the network are discovered through the DNS domain name resolution service, and the new node establishes a connection with other nodes through the TCP / IP protocol. Once the connection is successful, the new node sends identity information to the node, including the node's public key, version information, IP address and port;
[0039] At the same time, the newly joined node will obtain the request node list from this node, obtain other active nodes in the current network, and connect to the nodes that have not yet established a connection with itself based on the node list;
[0040] After successfully establishing a connection, the new node obtains ledger data from other nodes and synchronizes them.
[0041] Beneficial effects: The present invention provides an efficient, secure, and fast-response blockchain system solution. The parallel chain structure and decoupling mechanism significantly improve the system's transaction processing speed and account book update speed, thereby improving throughput and efficiency. The random weight assignment mechanism and tamper-proof hash value set improve the security and tamper resistance of the account book, while enhancing the system's anti-attack capability. The optimized account book convergence mechanism can quickly stabilize the account book state when subjected to active attacks, thereby improving the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a structural diagram of the blockchain system based on the parallel chain structure of the present invention.
[0043] Figure 2 This is a comparison chart of the confirmation delay between the blockchain system of the present invention and other blockchain systems without being attacked by active attacks.
[0044] Figure 3 This is a comparison chart of the confirmation delay between the blockchain system of the present invention and other blockchain systems under active attacks.
[0045] Figure 4This is a comparison chart of the throughput of the blockchain system of the present invention and the throughput of other blockchain systems. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments, and they should not be understood as limitations on the present invention. 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. In the description of the present invention, it should be understood that the terms used are only for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0047] Although the traditional blockchain system based on tree graph structure can significantly improve the throughput by utilizing the concurrency of tree graph structure, there are still many problems to be solved in terms of security. In view of the problem that the blockchain system based on tree graph structure is vulnerable to active attacks and the ledger state cannot converge, the present invention proposes a scalable blockchain system P-DAG (Parallel-Directed Acyclic Graph) based on parallel chain structure with high throughput, high security and low confirmation delay.
[0048] Combine the following Figure 1-Figure 4 The present invention specifically describes a blockchain system based on a parallel chain structure and a construction method thereof.
[0049] Embodiment 1: This embodiment provides a blockchain system based on a parallel chain structure, such as Figure 1 As shown. Includes:
[0050] Multiple parallel chains, each chain is used to record transactions and use the heaviest subtree principle to construct the ledger.
[0051] A node does not need to register when joining the network. When a node first joins the network, it needs to establish a connection with other nodes through broadcasting to synchronize historical data and the status of other nodes in the network.
[0052] The nodes in the network perform mining based on the PoW (proof of work) consensus mechanism. During mining, in order to ensure the tamper-proof nature of the blockchain system, it is necessary to select a tamper-proof block on each chain and save the hash values of these blocks in the block header for mining.
[0053] The node that successfully mines the block assigns a weight to the block according to the size of the hash value, calculates how many leading 0s the hash value contains, and the block weight is equal to the number of leading 0s in the hash value. The node broadcasts the mined block to other nodes in the network. The random weight assignment mechanism is used to assign weights to blocks to reduce the time for ledger convergence. The hash value has the characteristics of randomness, and attackers cannot predict the hash value size of the next block in the network, which increases the difficulty for attackers to launch active attacks on the system by maintaining equal tree weights.
[0054] Decouple block creation from chaining. When mining, nodes do not need to select a parent block to include it in the block header to calculate the hash value. After the node mining is successful, if there are k chains in the system, the last log of the block hash value is calculated. 2 k determines which chain the block needs to be added to.
[0055] Changing the block structure ensures the system's tamper-proof characteristics. Each block contains a set of tamper-proof hash values, which are selected by traversing each chain, and each chain is traversed depth-first according to the heaviest subtree principle;
[0056] If there are multiple blocks with equal weights in the same layer, select the block with the smaller hash value to continue traversing downwards;
[0057] If there are multiple blocks with the same hash value and the same block weight, the earlier created block will be selected to continue traversing downwards based on the timestamp of block creation.
[0058] The way nodes verify blocks is different from the traditional blockchain system. After receiving blocks from other nodes in the network, the node verifies the block, checks whether the mining difficulty proof of the block is correct, and checks whether the tamper-proof hash value set has a corresponding block in each chain. If the verification is successful, the node verifies the block based on the final log of the hash value. 2 The k-bit adds the block to the leaf node with the largest weight in the heaviest subtree in the chain. If there are multiple leaf nodes with the same weight, the block is added to the leaf node with the smallest hash value. If there are multiple leaf nodes with equal hash values, the block is added to the earliest created leaf node.
[0059] The way nodes sort blocks in the ledger is different from that of traditional blockchain systems; the nodes in the network reach a consensus on the order of blocks in the ledger, and the nodes traverse each chain in turn, starting from the genesis block, selecting the child block with the largest weight, adding the block to the end of the block sequence, and adding the child blocks of the child block with the largest weight to the block sequence in ascending order of hash values, and selecting the block with the largest weight from all child blocks to continue traversing until the leaf node is reached.
[0060] Embodiment 2: This embodiment provides a method for constructing a blockchain system. The blockchain system is a blockchain system based on a parallel chain structure, and each node local ledger in the network is composed of k chains. The specific construction steps are:
[0061] S100. When a node joins the network, a genesis block containing no transactions is created for each chain to initialize the ledger structure.
[0062] The parameters of the Genesis block are fixed to ensure that the nodes in the network reach a consensus on the blockchain ledger. Since the present invention is a blockchain system designed based on a public chain environment, nodes can freely join and exit the network, so it is necessary to ensure that the ledger structure can be correctly initialized when the node joins the network, so the parameters of the Genesis block of each chain are written in the Genesis FIle. When the node downloads the client, it obtains the file through the built-in Genesis FIle download address. After the download is completed, the client verifies the file signature through the public key to ensure that the file has not been tampered with.
[0063] In order to prevent the Genesis FIle download address in step S100 from being invalid, multiple secondary download addresses are set to ensure that when the primary download address is unavailable, the node obtains the Genesis FIle through the secondary download address.
[0064] For the Genesis FIle obtained in step S100, the node needs to compare the hash value of the downloaded Genesis File content with the hash value hard-coded in the code. If they match, it is confirmed. If they do not match, it prompts that the download failed.
[0065] In order to further improve the reliability of nodes when creating genesis blocks and prevent network forks, seed nodes are preset in the network. Nodes newly added to the network connect to the seed nodes and verify the correctness of the hash value. This ensures that nodes newly added to the network can correctly initialize the ledger structure in many ways.
[0066] S200, nodes conduct mining and package transactions to obtain profits. The present invention adopts the PoW mechanism for mining. Nodes continuously try the value of random numbers, put the value of random numbers into the block header for hash value calculation until a hash value less than a specific target value is found. The node that is found first obtains the profit.
[0067] Since the SHA-256 algorithm is highly resistant to collisions and is quantum secure, the SHA-256 algorithm is used for calculating the hash value in step S200 .
[0068] S300, when the node is mining, it selects a part of the content and adds it to the block header for hash value calculation;
[0069] This step shows how the node selects the content to be put into the block header. In order to ensure the tamper-proof feature, the node needs to select a tamper-proof hash value set. In order to ensure the transparency and traceability of the blockchain, the block header needs to contain the timestamp of block creation.
[0070] At the same time, in order to ensure the security of the blockchain system, the hash value of the Merkle tree root needs to be placed in the block header. The Merkle tree is created based on the hash value of the transaction. Each transaction is used as a leaf node to calculate the hash value for each leaf node, and the two adjacent leaf nodes are combined to calculate a new hash value to generate a parent node, and so on. The hash value of the root node is placed in the block header to verify the validity of the block.
[0071] The size of the block weight is the size of the block's own weight, and its value is equal to the number of leading 0s in the calculated hash value.
[0072] S400: After receiving the blocks sent by other nodes in the network, the node stores them locally and puts the blocks on the chain through the consensus mechanism;
[0073] The consensus mechanism mainly includes the verification and chain operation of the received blocks. For the verification of the block, firstly, it is necessary to verify whether its hash value meets the conditions, that is, whether the hash value of the block is less than a certain value.
[0074] At the same time, the node also needs to verify the correctness of the transactions in the block, that is, it needs to check whether the transactions have been tampered with. This is achieved by constructing a Merkle tree of transactions, and by comparing whether the hash value of the constructed Merkle tree root is equal to the hash value of the Merkle tree root in the block header to determine whether the block content has been tampered with.
[0075] For the chain-up operation, the node converts the hash value calculated by SHA256 into a decimal and takes the modulus of k to get a number, which indicates which chain the block needs to be added to.
[0076] After determining which chain to add to, the node adds the block after the tamper-proof block to form an edge.
[0077] S500. Select a tamper-proof block for each chain based on the heaviest subtree principle; specifically, the weight of a subtree with a certain block as the root is equal to the sum of the weights of all blocks on the subtree.
[0078] The nodes are traversed starting from the genesis block, and each time a block is selected from the child blocks to continue traversing until the leaf node is reached.
[0079] For the selection of child blocks, it is necessary to satisfy that the weight of the subtree with the child block as the root is greater than the weight of the subtree with any of its brother blocks as the root. If there are multiple subtrees with the same weight, select the block with a smaller hash value for traversal. If there are multiple subtrees with equal weights and the hash values of these blocks are also equal, select the block with a smaller timestamp for traversal.
[0080] S600, the node newly added to the network establishes connections with other nodes and synchronizes historical data. When a node wants to join the network, it needs to discover other nodes in the network through the DNS domain name resolution service. The new node establishes connections with other nodes through the TCP / IP protocol. Once the connection is successful, the new node will send identity information to the node, including the node's public key, version information, IP address and port. At the same time, the newly added node will obtain the request node list from the node, obtain other active nodes in the current network, and connect to the nodes that have not yet established a connection with itself based on the node list.
[0081] After successfully establishing a connection, the new node obtains ledger data from other nodes and synchronizes them.
[0082] The theoretical analysis of the blockchain system (P-DAG system) based on the parallel chain structure constructed in the above embodiment is as follows:
[0083] In order to analyze the P-DAG system, we first need to define some parameters. Assume that the number of nodes in the network is n, and there is an attacker A in the network. A can control the proportion of nodes in the network to be ρ. The controlled nodes are called Byzantine nodes, and the proportion of honest nodes is μ=1-ρ. Assume that the number of chains in the local ledger of each node in the system is k, and the hash function is modeled as a random oracle. Each node can only perform one hash operation at any time. Therefore, the number of hash operations that attacker A can perform at any time in this system is ρ·n times. Assume that the mining difficulty of the node is Where c is the expected time required for a new block to be generated in the network. The distance between blocks represents the number of edges on the path between two blocks.
[0084] Lemma 1: For any δ∈(0,1), at t=r, in a chain of the local ledger of an honest node in the network, for any block b located in the heaviest subtree, when t=r+T, the increase in the expected weight of block b and the block pointed to by block b is greater than or equal to Where avg is the weight of each block.
[0085] Proof: The weight of a block is equal to the weight of the block itself plus the weight of the blocks on the subtree with the block as the root. Since the hash value is random and uniformly distributed, according to the random weight assignment mechanism based on the hash value, the weight value range of each block is [x, 255], where x represents the number of leading 0s that a valid block hash value needs to contain. To simplify the analysis, the following analysis assumes that the weight of each block is equal. S represents the main chain selected by any chain in the ledger according to the heaviest weighted subtree principle. Whenever a node packs a block or receives a block b' from other nodes in the network, the b' block is either on S or starts from the root node and forks at a block b on S, that is, block b' is a child block of block b. The random variable X represents the time required for the length of S to increase by 1. If an honest node successfully mines a block, all honest nodes in the network will receive the block after a maximum of Δ time. Since the average time required for an honest node to mine a block is so So the maximum time required to increase the weight of a block by avg is The random variable N(T) represents the number of blocks in the T time period, so According to the Chernoff-Hoeffding inequality, the weight of the main chain S selected by each chain in the ledger according to the heaviest subtree principle increases within time T. The probability of
[0086] Lemma 2: Let subTree represent the subtree of a chain in the ledger at time r. This subtree satisfies that only malicious nodes mine on this subtree, honest nodes mine on another subtree, and they have the same parent node. At time r+T, an honest node in the network receives the block in subTree for the first time. There exists a negligible function ∈(·) that satisfies when When , the probability that subTree intersects with the main chain of any honest node (that is, the probability that the attacker successfully carries out a double-spending attack) is less than or equal to ∈(T).
[0087] Proof: Following the assumption in Lemma 1, the weight of each block is avg. Let block b represent the parent block of subTree. Since the honest nodes in the network do not know the existence of subTree, they mine on the subtree with other child nodes of block b as the root. Assume that the subtree is B. At time r+T, the honest node receives the block in subTree for the first time. In order to ensure that the node cannot successfully carry out a double-spending attack, the number of blocks mined by the honest node within time T needs to be greater than the number of blocks mined by the attacker. According to Lemma 1, the mining rate of the honest node is The attacker’s mining rate is Attackers can use network delays to make local ledgers of some nodes inconsistent. Therefore, in order to eliminate the impact of network delays, if If it holds, then according to the Chernoff-Hoeffding inequality, it can be guaranteed that the probability that the attacker makes subTree the heaviest subtree is less than ∈(T) = e +7)(8) .
[0088] Lemma 3: Let the weight increase of the heaviest subtree of a chain in the ledger in time T be S(T), then there exists a threshold So that when At this time, attackers cannot exploit network delays to carry out liveness attacks.
[0089] Proof: Lemma 3 gives the conditions and proof for the confirmation of a block. The block generation process on each chain follows a Poisson distribution with parameter λ, where The random variable W represents the weight of the block itself, and S(t) represents the sum of the weights of the blocks on a certain chain in the system at time t. Suppose that the hash value that meets the mining conditions needs to contain at least x leading 0s. Since the hash value follows a uniform distribution, E[S(t)] = λ·E[W]. The random variable N(T) represents the number of blocks generated in time T, and the random variable W Q Represents the block weight, then in time T, the total weight of the new blocks added to the system is Since N(T) and W U Independent and identically distributed, each random variable has a finite expectation and variance, so according to the central limit theorem, S(T) can be approximated as a normal distribution, that is, S(T)~N(T·λ·E[W], T·λ·(σ 2 (W)+E 2 [w])), where σ 2 (W) represents the variance of the sum of weights of all blocks in the system.
[0090] Assume that attacker A wants to attack a chain. A needs to maintain at least one subtree on the chain with a weight close to the weight of the heaviest subtree. Start timing from the moment attacker A attacks, and use the random variable and They represent the increase in the weight of the subtree maintained by the honest node and the attacker within time T, respectively. and They represent the mean weights of blocks generated by honest nodes and attackers on a certain chain within time T, and They represent the variance of the sum of block weights generated by honest nodes and attackers in time period T. Let ΔS = S ;(T)-S < (T). Because S ; (T) and S < (T) are all normally distributed and independent of each other, so ΔS also obeys the normal distribution. Converting ΔS into a standard normal distribution gives A block can be safely confirmed if the probability of the main chain of the block being replaced in the future is very small after the block is confirmed, that is, the probability of P(ΔS<0) is very small. Assuming this probability is 1%, P(ΔS<0)≤0.01 is converted into Assume z j Under the standard normal distribution, P(Z<-z j )=τ, substituting τ=0.01 to get z h.h1 ≈2.326, D represents the confirmation threshold, we can get Simplified When ΔS≥D is satisfied, the root block of the heaviest subtree can be confirmed, and as T increases, the probability of the block being replaced by an attacker decreases exponentially. Therefore, when the difference between the weight of the heaviest subtree and the weight of any other subtree is greater than D, the root block of the subtree can be confirmed while ensuring security.
[0091] Lemma 1 shows that within time T, for any δ∈(0,1), the difference between the weight of the subtree maintained by the honest node and the weight of the subtree maintained by the attacker is Let Diffy ≥ D, we can get Therefore, as long as This can ensure that the system is protected from active attacks by attackers.
[0092] Since the k chains of the present invention are independent of each other, any chain satisfies the above three lemmas, so the entire system also satisfies the above three properties.
[0093] In order to verify the system performance, a simulation experiment was carried out on the system:
[0094] Figure 2 The comparison of confirmation delays between P-DAG of this system and GHOST and Conflux is shown when the attacker does not carry out active attacks and different parameters k are set. It can be seen that when k=16, the confirmation delay of P-DAG is the smallest and is smaller than that of GHOST and Conflux.
[0095] Figure 3 The convergence time of the ledgers of different blockchain systems is shown when the attacker implements a live attack. d is used to represent the weight difference between the two heaviest subtrees in P-DAG, as shown in Figure 3As shown in the figure, from the time the attacker launches a liveness attack, it takes about 1800 seconds to make the difference d between the weight of the heaviest subtree and the weights of other subtrees exceed D, and finally the ledger state converges. However, the adaptive adjustment mechanism of Conflux takes 4000 seconds to make the weight of the heaviest subtree significantly different from the weights of other subtrees, so that the ledger converges. It can be seen that under liveness attacks, the convergence speed of P-DAG is more than doubled compared to Conflux.
[0096] Figure 4 The throughput comparison between P-DAG, GHOST and Conflux is shown. It can be seen that the throughput of the P-DAG system is higher than that of the GHSOT system and close to that of the Conflux system. Theoretically, the throughput of the P-DAG system should be k times that of GHOST, but it has not achieved this effect, mainly due to physical factors such as network bandwidth. The throughput of the P-DAG system is slightly lower than that of Conflux because Conflux is a blockchain system based on a graph structure, and its concurrency is higher. All blocks in the ledger will be included in the block output sequence of Algorithm 3, while P-DAG is a blockchain system based on a tree structure. Although the ledger converges faster than Conflux, during the period from the system startup to the ledger convergence, some blocks will not be on the heaviest subtree that finally converges. For the sake of system security, these blocks are directly discarded and not counted in the system throughput.
[0097] The present invention uses multiple parallel chains as the ledger structure, decouples block creation from chaining, and thus disperses the computing power of malicious nodes to enhance the security of the entire system. By utilizing the randomness and uniform distribution of hash values, a random weight assignment mechanism based on hash values is designed to reduce the convergence time of each chain and the confirmation delay of blocks. Theoretical analysis and simulation experiments show that P-DAG and Conflux have similar throughputs, but the required ledger convergence time is reduced by about 50% compared with Conflux, and the block confirmation delay is reduced by about 30% compared with Conflux.
[0098] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0099] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A blockchain system based on a parallel chain structure, characterized in that: include: Multiple parallel chains, each chain is used to record transactions and use the heaviest subtree principle to build the ledger; After creation, each block is assigned a random weight based on the number of leading 0s in its hash value; Decouple block creation from the chain process. After a node successfully mines, if there are k chains in the system, it determines which chain to add the block to based on the last log2k bits of the block hash value. Each block contains a set of tamper-proof hash values, which are selected by traversing each chain and following the heaviest subtree principle; The node performs a verification mechanism on the received block, verifying its hash value and tamper-proof hash value set.
2. The blockchain system based on the parallel chain structure according to claim 1 is characterized in that: When a node joins the network, it establishes connections with other nodes through broadcasting, synchronizes historical data and the status of other nodes in the network, and verifies historical data through the PoW consensus mechanism.
3. The blockchain system based on a parallel chain structure according to claim 1 is characterized in that: After creation, each block is assigned a random weight according to the number of leading zeros in its hash value. Specifically, a weight is assigned to each block by calculating the number of leading zeros in the hash value, and the block weight is equal to the number of leading zeros in the hash value.
4. The blockchain system based on a parallel chain structure according to claim 1 is characterized in that: The tamper-proof hash value set for each block is selected as follows: Traverse each chain, and perform depth-first traversal on each chain according to the heaviest subtree principle; If there are multiple blocks with equal weights in the same layer, select the block with the smaller hash value to continue traversing downwards; If there are multiple blocks with the same hash value and the same block weight, select the earlier created block to continue traversing downwards based on the timestamp of block creation.
5. The blockchain system based on a parallel chain structure according to claim 1 is characterized in that: The node performs a verification mechanism on the received block to verify its hash value and tamper-proof hash value set. The specific method is as follows: After receiving a block in the network, the node first verifies whether the hash value of the block meets the conditions. If the conditions are met, it then traverses k chains to determine whether the block in the tamper-proof hash value set actually exists in each chain and is located on the main chain.
6. The blockchain system based on a parallel chain structure according to claim 1, characterized in that: The node sorts the blocks in the ledger as follows: The node traverses each chain in turn, starting from the genesis block, and selects the child block with the largest weight, adding it to the end of the block sequence; Add the child blocks of the sub-block with the largest weight to the block sequence in order of hash values from small to large; Select a block with the largest weight from all child blocks and continue traversing until the leaf node is reached.
7. A method for constructing a blockchain system according to any one of claims 1 to 6, characterized in that: The steps include: S100. When a node joins the network, a genesis block containing no transactions is created for each chain to initialize the ledger structure. S200, nodes use PoW mechanism for mining; S300, when the node is mining, it selects a part of the content and adds it to the block header for hash value calculation; S400: After receiving the blocks sent by other nodes in the network, the node stores them locally and puts the blocks on the chain through the consensus mechanism; S500, select a tamper-proof block for each chain based on the heaviest subtree principle; S600: The node newly added to the network establishes connections with other nodes and synchronizes historical data.
8. The construction method according to claim 7, characterized in that: In step S100, the parameters of the genesis block of each chain are fixed and written in the Genesis FIle. When the node downloads the client, it obtains the file through the built-in Genesis FIle download address. After the download is completed, the file signature is verified through the public key.
9. The construction method according to claim 7, characterized in that: In step S400, after receiving the block sent by other nodes in the network, the node puts the block on the chain through the consensus mechanism, including verifying and putting the received block on the chain; wherein: To verify the received block, first verify whether its hash value meets the conditions, that is, whether the hash value of the block is less than a certain value; then verify the correctness of the transactions in the block, that is, check whether the transactions have been tampered with; The chain operation is as follows: the node converts the calculated hash value into a decimal and takes the modulus of k to get a number, which indicates which chain the block needs to be added to.
10. The construction method according to claim 7, characterized in that: When the node newly added to the network establishes a connection with other nodes in step S600, the other nodes in the network are discovered through the DNS domain name resolution service. The new node establishes a connection with other nodes through the TCP / IP protocol. Once the connection is successful, the new node sends identity information to the node, including the node's public key, version information, IP address and port; At the same time, the newly joined node will obtain the request node list from this node, obtain other active nodes in the current network, and connect to the nodes that have not yet established a connection with itself based on the node list; After successfully establishing a connection, the new node obtains ledger data from other nodes and synchronizes them.
Citation Information
Patent Citations
Block chain consensus method and device, equipment and storage medium
CN114281888A
Tamper-proof block chain data storage method and system
CN115081031A
Method for improving security of block chain system based on hybrid consensus algorithm of PoW + PoS
CN115442379A
Building networking data management method based on block chain fragmentation and DAG
CN116405179A
Blockchain consensus method, apparatus, and device, and storage medium
US20240163121A1