Method and System for Blockchain Continuous Proof of Work

By adopting a continuous proof of work Merkel tree structure in the blockchain system, the problems of unfairness and centralization of block generation in the PoW system are solved, and the fairness of block generation between nodes and the rational utilization of resources are achieved.

CN114638611BActive Publication Date: 2025-06-24SHANGHAI WANXIANG BLOCK CHAIN CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210318798.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-29
Publication Date
2025-06-24
Estimated Expiration
2042-03-29

AI Technical Summary

Technical Problem

In the existing PoW-based blockchain system, nodes with a large amount of computing power can increase the speed of block generation through parallel computing, resulting in unfair block generation and increasing centralized risk.

Method used

Using a continuous proof of work Merkel tree structure, nodes must continuously hash operations in order of transaction arrival until the root of the Merkel tree is calculated to ensure that each node has the same fairness when generating blocks.

Benefits of technology

Through continuous calculation, nodes are prevented from using the advantages of computing power to perform parallel calculations, ensuring that all nodes are equal in terms of probability of success in block production, avoid centralized risks, and do not waste computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114638611B_ABST
    Figure CN114638611B_ABST
Patent Text Reader

Abstract

The present invention provides a method and system for continuous proof of work in a blockchain, including: Step S1: When a node in the blockchain system generates a block, the arrival of transactions is monitored through the blockchain system, and the transactions are continuously hashed in the order of arrival until the root of the Merkle tree is calculated. The Merkle tree root is written into the block and consensus for block production is performed; Step S2: After successful consensus for block production, other nodes in the blockchain system monitor the generation of the current block and verify the correctness of the transactions in the block. When the verification passes, the current block is added to the current blockchain system. The present invention enables nodes to prove that they have indeed done a certain amount of work by using the hard disk capacity and computing power resources, which is a simple solution for proof of space-time without wasting too much computing resources and without the risk of a large number of nodes concentrating on hash operations with large computing power.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and specifically, to a method and system for continuous proof of work in blockchain. Background Art

[0002] Most of the existing blockchain systems based on PoW use the data structure of traditional Merkle trees for transaction storage. When using this data structure for storage, nodes with a large amount of computing power can perform parallel calculations on transactions through a parallel pool, and thus can have a faster block generation speed. This does not conform to the fairness in the blockchain system. The blockchain system hopes that each node participating in PoW calculation has the same block generation speed. Therefore, in order to solve the problem of possible parallel transaction calculations in traditional PoW-based blockchain systems, the present invention proposes a continuous proof of work Merkle tree. With the Merkle tree using this structure, nodes must perform sequential calculations on the monitored transactions and cannot use their own computing power advantages to increase the speed of calculating the Merkle tree, which will greatly ensure the fairness of each node.

[0003] Patent document CN113439415A (application number: 201980082693.4) discloses a proof of work for blockchain applications. The block record includes payload data, a proof of work, and a unique identifier of the previous block record of the blockchain. Wherein, the method includes: receiving a data packet from an authorized server, the data packet including a plurality of data sets, and each of the plurality of data sets including signal information; analyzing the data packet to convert the signal information of each data set into a corresponding data output; transmitting the plurality of data outputs to the authorized server, and the plurality of data outputs are used in establishing a proof of work for adding a block record to the blockchain. Summary of the Invention

[0004] Aiming at the defects in the prior art, the purpose of the present invention is to provide a method and system for continuous proof of work in blockchain.

[0005] According to a method for continuous proof of work in blockchain provided by the present invention, it includes:

[0006] Step S1: When a node in the blockchain system generates a block, the blockchain system listens for the arrival of transactions and continuously performs hash operations on the transactions in the order of arrival until the root of the Merkle tree is calculated, writes the Merkle tree root into the block, and conducts consensus for block generation;

[0007] Step S2: After successful consensus for block generation, other nodes in the blockchain system listen for the generation of the current block and verify the correctness of the transactions in the block. When the verification passes, the current block is added to the current blockchain system.

[0008] Preferably, the step S1 adopts:

[0009] Step S1.1: Sort the transactions in the order received from the neighbor nodes;

[0010] Step S1.2: Continuously perform hash calculations on the transactions in the arranged order until the root hash of the Merkle tree is generated.

[0011] Preferably, in the step S1.2: The generation of the hash value of the next transaction must be based on the previous transaction until the root hash of the Merkle tree is generated.

[0012] Preferably, the step S2 adopts: The node verifies the transaction according to the continuous Merkle tree, and proves that the node has generated the continuous Merkle tree according to the order through the verification result.

[0013] Preferably, the step S2 adopts: The node recalculates the root of the Merkle tree of the continuous proof of work according to the hash value of the leaf node of the verified transaction and the path from the current leaf node's sibling node to the root node. If the hash value of the root matches the root hash value of the continuous proof of work of the block header monitored by the current node, it proves that the current transaction is indeed in the block and has been on the blockchain.

[0014] Preferably, when performing hash calculation, the node uses the proof of disk space to generate a hash proof. The process of generating the proof requires the node to pay disk space and computing power to calculate the root hash, which can be applied to both the proof of space and the proof of time in the blockchain system.

[0015] A blockchain continuous proof of work system provided by the present invention includes:

[0016] Continuous proof of work Merkle tree generation module: When a node in the blockchain system generates a block, it listens for the arrival of transactions through the blockchain system, and continuously performs hash operations on the transactions in the order of arrival until the root of the Merkle tree is calculated. The Merkle tree root is written into the block and consensus is reached to produce a block;

[0017] Transaction verification module: After the consensus to produce a block is successful, other nodes in the blockchain system listen for the generation of the current block and verify the correctness of the transactions in the block. When the verification passes, the current block is added to the current blockchain system.

[0018] Preferably, in the continuous proof of work Merkle tree generation module,

[0019] Module M1.1: Sort the transactions in the order received from the neighbor nodes;

[0020] Module M1.2: Continuously calculate the hash of transactions in the arranged order until the root hash of the Merkle tree is generated.

[0021] The said module M1.2: The generation of the hash value of the next transaction must be based on the previous transaction until the root hash of the Merkle tree is generated.

[0022] Preferably, in the transaction verification module, the node verifies the transaction according to the continuous Merkle tree, and the verification result proves that the node has generated the continuous Merkle tree according to the order;

[0023] The node recalculates the root of the Merkle tree for the continuous proof of work based on the hash value of the leaf node of the verified transaction and the path from the current leaf node's sibling node to the root node. If the hash value of the root matches the root hash value of the continuous proof of work of the block header monitored by the current node, it proves that the current transaction is indeed in the block and has been on the blockchain.

[0024] Preferably, when calculating the hash, the node uses the proof of disk space to generate a hash proof. The process of generating the proof requires the node to expend disk space and computing power to calculate the root hash, which can be applied to both the proof of space and the proof of time in the blockchain system.

[0025] Compared with the prior art, the present invention has the following beneficial effects:

[0026] 1. The present invention enables the node to prove that the node has indeed done a certain amount of work by using disk capacity and computing power resources. It is a simple solution for the proof of space and time, without wasting too much computing resources and without the risk of a large number of nodes concentrating on hash operations with large computing power;

[0027] 2. The sequential calculation in the process of generating the proof of the present invention ensures the continuity of storage;

[0028] 3. The continuous proof of work Merkle tree generation module of the present invention can ensure that transactions must be executed sequentially until the root hash is generated;

[0029] 4. The transaction verification module of the present invention can quickly verify the correctness of the transaction. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] By reading the detailed description of the non-restrictive embodiments with reference to the following drawings, other features, objects, and advantages of the present invention will become more apparent:

[0031] Figure 1 It is a schematic diagram of the continuous proof of work Merkle tree.

[0032] Figure 2 It is a schematic diagram of the Merkle tree structure of the traditional pow-type blockchain. Detailed implementation manners

[0033] The present invention will be described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but do not limit the present invention in any form. It should be noted that those of ordinary skill in the art can make several changes and improvements without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0034] Example 1

[0035] A method and system for continuous proof of work in a blockchain improves the Merkle tree structure used for transaction storage in a PoW-based blockchain system, and proposes a new transaction storage structure - a continuous proof of work Merkle tree. The present invention solves the following problems: (1) A blockchain system using PoW as the proof of work needs to spend a large amount of useless computing power; (2) Nodes with large computing resources may perform parallel computing, increasing the probability of successful block production, resulting in the emergence of a large number of nodes concentrating on hash operations, causing the problem of unfair block production and increasing the risk of centralization; (3) PoW can only use computing resources as a means of competing for block production and cannot reasonably utilize storage resources such as hard disks, while storage resources happen to be a necessary requirement for the development of today's consortium blockchains. Based on this, the feature of this solution is that it can use hard disk space as a competitive resource, combine simple calculations to produce blocks, and can extremely well alleviate the problem of node resource waste. At the same time, the continuous proof of work Merkle tree requires nodes to perform continuous calculations in the order of transaction arrival when generating the Merkle tree until the root of the Merkle tree is calculated. This makes nodes with large hard disks and nodes with overly strong computing resources not have an advantage under this storage structure. They must perform certain storage and computing work according to the method of continuous proof of work. The probability of successful block production for all nodes participating in block production is equal, which is a fair implementation solution for all nodes and will not have the risk of centralization caused by a large number of nodes concentrating on hash operations and aggregating a large number of nodes. The present invention is divided into a continuous proof of work Merkle tree generation module and a transaction verification module.

[0036] The continuous proof of work Merkle tree generation module uses an improved way of generating the Merkle tree. First, the transactions are sorted in the order received from neighbor nodes, and then sequential hash calculations are performed on the transactions in this order to prevent malicious nodes from improving the block production speed by parallel computing the hash values, which will affect the fairness of block production for each node. This calculation process requires that transaction 2 must be executed after transaction 1 until the root hash of the Merkle tree is finally generated.

[0037] As Figure 1As shown, when the node obtains transactions 1, 2 to 8 in sequence and calculates the hash values H1, H2, H3 to H8 of each transaction respectively. Next, the leaf node 000 at the lower left corner is equal to H1. That is, starting from the leaf node at the lower left corner, after calculating 000, 001 needs to be calculated. 001 is equal to hash(H2, 000), that is, the hash calculation of H2 and 000 is performed to obtain 001. At the same time, by calculating the two leaf nodes, the hash value of the upper layer node of this leaf node can be obtained, that is, the hash value of the parent node of this leaf node. That is, hash(000, 001) can obtain 00. When calculating 010, hash(H3, 00) is required, and so on. It can be seen here that even if the node has obtained the hash values of all transactions, it still needs to perform hash calculations in the order in which the node receives the transactions. Finally, the root is calculated through the calculated "0" and "1".

[0038] Comparing with the Merkle tree structure of the traditional pow-type blockchain, as Figure 2 shown, 000 is equal to H1, 001 is equal to H2, and the node can directly calculate 00 through 000 and 001, that is, calculate hash(H1, H2) to obtain 00. Similarly, the node can perform a hash operation on H3 and H4 to obtain 01. This means that malicious nodes can perform parallel calculations on H1 and H2, H3 and H4, and can also perform parallel calculations on H7 and H8 all the way. Finally, miners with greater computing power use parallel computing technology, such as opening a parallel pool, and can calculate root faster (obtained through hash(0, 1)). Comparing with the structure of the traditional Merkle tree, the technology proposed by the present invention cannot directly calculate 000 through H1 and H2. When obtaining 000, it is necessary to first calculate H1, and then calculate H2 through H1. This is continuous hash calculation. Therefore, the characteristic of the present invention is that compared with the structure of the traditional calculated Merkle tree, the node must perform continuous hash calculations, which ensures that miners with a large amount of computing power cannot improve the block generation efficiency through parallel calculations, and ensures the fairness of hash calculations.

[0039] For the continuous proof-of-work Merkle tree generation module, there is no method that can enable the node to execute in parallel to generate the root of the transaction. It must be executed continuously in the order in which the transactions arrive in order to pass the subsequent verification. This continuous calculation method prevents the node from using the remaining computing resources for parallel block generation, enabling nodes with sufficient resources to have the same block generation probability.

[0040] The transaction verification module requires the node to verify the transaction according to the continuous Merkle tree, and the verification result proves that the node has indeed generated the continuous Merkle tree according to the order.

[0041] The transaction verification module can prove with a probability infinitely close to 1 that the submitted proof is correct, that the nodes have indeed generated and executed transactions in the order of the continuous Merkle tree, and the probability that an incorrect proof can finally pass the verification is extremely low. Finally, this module also satisfies the characteristics of block generation where it is difficult to generate nodes but easy to verify them.

[0042] When the nodes in the blockchain system package transactions and generate blocks, they need to listen for the arrival of transactions in the system, use the continuous proof-of-work Merkle tree generation module to package the listened transactions into blocks, and finally conduct consensus for block generation. After successful block generation, other nodes in the network will use the transaction verification module to verify the correctness of the transactions in the block. If the final verification passes, the block is added to its own blockchain network. If the verification fails, the block is directly ignored.

[0043] The basic structure of the continuous proof-of-work Merkle tree generation module is as Figure 1 shown. In this module, the nodes sort the listened transactions according to the arrival order of the transactions. Each leaf node is divided into two types, left and right, according to its relative position. For example, 000 is the left leaf node and 001 is the right leaf node, and so on. If it is a left leaf node, the hash of the transaction and the hash value of the left subtree parent node are hashed together. If it is a right leaf node, the hash value of the left leaf node also needs to be added.

[0044] For example Figure 1 in which 8 transactions H1 to H8 are listened. H1 represents the hash value of transaction 1. The direction of the arrow indicates the direction of performing the hash operation. The process of the node generating the continuous proof-of-work Merkle tree is as follows:

[0045] After the node gets transaction 1, it calculates the hash of transaction 1 to get H1. Initially, H1 is equal to 000.

[0046] The node uses 000 and the hash H2 of transaction 2 to perform a hash calculation together to get 001.

[0047] 000 and 001 are jointly calculated to get 00.

[0048] 00 and H3 are calculated to get 010.

[0049] And so on in the direction of the arrow. Finally, the root root of the continuous proof-of-work Merkle tree is calculated based on 0 and 1.

[0050] It can be seen that the characteristic of this module compared with the traditional PoW module is that it must calculate H2 based on H1, while the traditional

[0051] In the PoW module, 000 and 001 can be generated in parallel without generating 001 based on 000. The general generation process of transactions can refer to the direction indicated by the arrows in the figure. It can be seen that the generation of the hash value of the next transaction must be based on the previous transaction, and finally a correct root can be generated. Secondly, using this structure, nodes do not need to spend a large amount of computing resources. They only need to prove that the node has indeed stored certain data in chronological order. The difficulty value is much smaller than that of traditional PoW (Proof of Work), and there will be no resource waste. Moreover, nodes with large hard disks and nodes with overly strong computing resources do not have an advantage under this storage structure. They must perform certain storage and computing work according to the method of continuous proof of work. The probability of all nodes participating in block production to succeed in block production is equal. It is a fair implementation scheme for all nodes and will not pose the risk of centralization caused by a large number of nodes concentrating on hash operations and aggregating a large number of nodes.

[0052] Finally, this storage structure is applied to the proof of space and time. When nodes perform hash operations, they can use the proof of hard disk space to generate hash proofs. The process of generating proofs requires nodes to pay a certain amount of hard disk space and computing power to calculate the root hash. It can be applied to both the proof of space and the proof of time in the blockchain system at the same time. It is a simple storage structure for the proof of space and time.

[0053] In the transaction verification module, nodes can, according to the hash value of the leaf node of the transaction to be verified and the path path from the sibling node of this leaf node to the root node, such as Figure 1 shown in the figure, H1 is the sibling node of the leaf node and is H2, and the parent node of H1 is 00. At this time, if it is necessary to verify whether H1 is in the Merkle tree of continuous proof of work, as Figure 1 shown, only the paths 001, 01, and 1 are needed to calculate the root of the Merkle tree.

[0054] Verify whether the transaction of this leaf node is in the Merkle tree of continuous proof of work. When lightweight nodes need to verify the received transactions, they can simply use the above method to verify the transactions. As long as it is proved that the transactions are indeed in the Merkle tree of your continuous proof of work, that is, there is no need to store all transactions like full nodes to verify the existence of transactions. They only need to obtain the path from full nodes, recalculate the root of the Merkle tree of continuous proof of work. If the hash value of the root matches the root hash value of the Merkle tree of continuous proof of work in the block header monitored by the lightweight node, it can be simply proved that the transaction is indeed in the block and is a transaction that has been on the blockchain. It can prevent malicious nodes from using incorrect transactions to deceive lightweight nodes to pass verification.

[0055] For example, if it is necessary to verify whether H3 is in the Merkle tree, only the three hash values 011, 00, and 1 need to be obtained and calculated:

[0056] root = hash(010, 011, 00, 1). Determine whether the calculated root matches the continuous proof-of-work Merkle tree in the block header. If it matches, it proves that the transaction is correct. The feature of this module is that compared with the complex process of generating proofs, the verification process is very simple. Nodes can quickly verify the correctness of a transaction.

[0057] The present invention can be extended to a storage structure for the proof-of-space-time transaction tree. The continuous proof-of-work Merkle tree generation module can prove in sequence whether a certain transaction really exists on the chain. At this time, in addition to verifying the signature of the transaction, certain operations need to be performed on the hard disk to verify the signature of the transaction. During this verification process, due to network reasons, the verification process efficiency will be very slow. Based on this, an endorsement method can be adopted. Nodes need to deposit a certain amount of funds on the chain to participate in consensus block production. Then add random verification, that is, nodes only need to verify the signature and randomly select a few transactions to verify whether certain data is really stored. If not stored, all the pledged tokens generated for this transaction will be deducted. This random verification method can somewhat reduce the complexity of verification.

[0058] The blockchain continuous proof-of-work system provided by the present invention can be implemented through the step process in the blockchain continuous proof-of-work method provided by the present invention. Those skilled in the art can understand the blockchain continuous proof-of-work method as a preferred example of the blockchain continuous proof-of-work system.

[0059] The present invention solves the problems of resource waste and possible parallel computing by nodes in the PoW consensus system of traditional blockchain systems. This method does not require nodes to spend a large amount of computing resources. It only needs to prove that the node has indeed stored certain data in chronological order. The difficulty value is much smaller than the traditional PoW proof-of-work and will not cause resource waste; nodes with large hard disks and nodes with overly strong computing resources will not have an advantage under this storage structure. They must perform certain storage and computing work according to the method of continuous proof-of-work. The probability of all participating block-producing nodes to successfully produce a block is equal. It is a fair implementation scheme for all nodes and will not present the centralization risk brought by a large number of nodes concentrating on hash operations and aggregating a large number of nodes. Based on this structure, the proof process requires nodes to pay a certain amount of hard disk space and time. However, after a block is successfully produced, the verification process is very simple. Only a small amount of calculation is required to verify whether the transaction is on the block. Moreover, there is a possibility of parallel execution for the proof-of-work using PoW. The method proposed in this paper must be calculated continuously and cannot be parallel, which ensures fairness to a certain extent.

[0060] Those skilled in the art know that, in addition to implementing the systems, devices, and their respective modules provided by the present invention in the form of pure computer-readable program code, the method steps can be logically programmed to enable the systems, devices, and their respective modules provided by the present invention to be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers, etc., to achieve the same program. Therefore, the systems, devices, and their respective modules provided by the present invention can be considered as a kind of hardware components, and the modules included therein for implementing various programs can also be regarded as the structures within the hardware components; the modules for implementing various functions can also be regarded as either software programs for implementing the methods or the structures within the hardware components.

[0061] The specific embodiments of the present invention have been described above. It should be understood that the present invention is not limited to the above specific implementation manners, and those skilled in the art can make various changes or modifications within the scope of the claims, which do not affect the essence of the present invention. Without conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A method for continuous proof of work in a blockchain, characterized in that Including: Step S1: When a node in the blockchain system generates a block, the arrival of transactions is monitored through the blockchain system, and the transactions are continuously hashed in the order of arrival until the root of the Merkle tree is calculated. The Merkle tree root is written into the block and consensus for block production is carried out. Step S2: After successful consensus for block production, other nodes in the blockchain system monitor the generation of the current block and verify the correctness of the transactions in the block. When the verification passes, the current block is added to the current blockchain system. The said Step S1 adopts: Step S1.1: Sort the transactions in the order received from neighbor nodes. Step S1.2: Continuously perform hash calculations on the transactions in the sorted order until the root hash of the Merkle tree is generated. The said Step S1.2: The generation of the hash value of the next transaction must be based on the previous transaction until the root hash of the Merkle tree is generated. The said Step S2 adopts: The node verifies the transaction according to the continuous Merkle tree, and the verification result proves that the node has generated the continuous Merkle tree in order. The said Step S2 adopts: The node recalculates the root of the Merkle tree for continuous proof of work according to the hash value of the leaf node of the verified transaction and the path from the sibling node of the current leaf node to the root node. If the hash value of the root matches the root hash value of the continuous proof of work Merkle tree in the block header monitored by the current node, it proves that the current transaction is indeed in the block and has been on the blockchain.

2. The method for continuous proof of work of a blockchain according to claim 1, wherein When performing hash calculations, the node uses proof of hard disk space to generate a hash proof. The process of generating the proof requires the node to expend hard disk space and computing power to calculate the root hash, which can be applied to both proof of space and proof of time in the blockchain system.

3. A system for continuous proof of work in a blockchain, characterized in that, Including: Continuous proof of work Merkle tree generation module: When a node in the blockchain system generates a block, the arrival of transactions is monitored through the blockchain system, and the transactions are continuously hashed in the order of arrival until the root of the Merkle tree is calculated. The Merkle tree root is written into the block and consensus for block production is carried out. Transaction verification module: After successful consensus for block production, other nodes in the blockchain system monitor the generation of the current block and verify the correctness of the transactions in the block. When the verification passes, the current block is added to the current blockchain system. In the said continuous proof of work Merkle tree generation module, Module M1.1: Sort the transactions in the order received from neighbor nodes. Module M1.2: Continuously perform hash calculations on the transactions in the sorted order until the root hash of the Merkle tree is generated. The said Module M1.2: The generation of the hash value of the next transaction must be based on the previous transaction until the root hash of the Merkle tree is generated. In the said transaction verification module, the node verifies the transaction according to the continuous Merkle tree, and the verification result proves that the node has generated the continuous Merkle tree in order. The node recalculates the root of the Merkle tree for the continuous proof of work based on the hash value of the leaf node of the verified transaction and the path from the sibling node of the current leaf node to the root node. If the hash value of the root matches the root hash value of the continuous proof of work in the block header monitored by the current node, it proves that the current transaction is indeed in the block and has been on the blockchain.

4. The system for continuous proof of work of blockchain according to claim 3, wherein When calculating the hash, the node uses the proof of hard disk space to generate a hash proof. The process of generating the proof requires the node to expend hard disk space and computing power to calculate the root hash, which can be applied to both the proof of space and the proof of time in the blockchain system.

Citation Information

Patent Citations

  • Proof-of-work for blockchain applications

    CN113439415A

  • Proof of Work for Blockchain Applications

    CN113439415B

  • Novel block chain consensus method based on shared storage

    CN112187866A

  • Blockchain transaction certification method and device

    CN112348518A