Block chain consensus method and system based on contribution value and proof of workload, and medium
By dividing the mining process into stages A and B in the blockchain consensus, and setting the mining target value according to the contribution value, the problems of wasted computing power and insufficient security in the existing blockchain consensus mechanism are solved, and the effect of reducing system energy consumption and improving security and decentralized characteristics is achieved.
Patent Information
- Application Number
- CN202411968352.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-09
AI Technical Summary
Existing blockchain consensus mechanisms such as proof of work (PoW) lead to waste of computing power. Other mechanisms such as proof of stake (PoS), practical Byzantine fault tolerance algorithm (PBFT) and proof of contribution value (PoC) have security and application limitations. There is urgent need for a blockchain consensus solution that can greatly reduce system energy consumption and have high security.
Using a blockchain consensus method based on contribution value and proof of work, the mining process is divided into multiple cycles of the same length of time, each cycle is divided into stage A and stage B. In stage A, all nodes participate in mining, and in stage B, only nodes with higher contribution values are selected for mining, and the mining target value is related to the contribution value.
Through phased mining, the system energy consumption is reduced, and the contribution value factor is combined to incentivize nodes with more contributions, which improves decentralization characteristics and security, and increases user participation.
Smart Images

Figure CN119967004A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain consensus method, system and medium based on contribution value and proof of work. Background Art
[0002] In the current blockchain system, Proof of Work (PoW) is widely regarded as one of the most reliable and secure consensus mechanisms. However, when it is used as a consensus mechanism, a large amount of computing power is wasted on hash calculations that have no actual value to the system.
[0003] In addition, blockchain developers have proposed consensus mechanisms such as Proof of Stake (PoS), Practical Byzantine Fault Tolerance (PBFT) and Proof of Contribution (PoC), but each has its own shortcomings.
[0004] For example, in proof of stake, an attacker can increase the probability of becoming a bookkeeper by betting on different branches. Although there are methods to deal with such attacks, the security of PoS still needs time to be tested.
[0005] In addition, PBFT's high communication complexity limits its application in networks with a large number of nodes.
[0006] In the proof of contribution, block producers are not random and are easily predictable. Attackers can actively attack the one with the highest contribution value during the block production stage. Even if the one with the highest contribution value is not attacked, the block production may fail due to disconnection or network reasons.
[0007] Therefore, there is an urgent need to provide a blockchain consensus solution that can greatly reduce system energy consumption and has high security. Summary of the invention
[0008] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and to provide a blockchain consensus method, system and medium based on contribution value and proof of work that can greatly reduce system energy consumption and have high security.
[0009] The purpose of the present invention can be achieved by the following technical solutions:
[0010] A blockchain consensus method based on contribution value and proof of work, comprising the following steps:
[0011] Divide the mining process in the blockchain into multiple cycles of equal length;
[0012] Each cycle is divided into Phase A and Phase B. In Phase A, all nodes participate in mining, and the mining target value is the same. When the first node mines a legal block, it becomes the Phase A block accountant of the cycle, and the mining of Phase A ends and enters Phase B.
[0013] In phase B, nodes with higher contribution values are selected for mining, and the mining target value is related to the contribution value; the remaining nodes wait for the blocks in phase B to be mined before entering a new cycle to continue mining.
[0014] Furthermore, the process of setting the mining target value in the B phase includes:
[0015] According to the ranking order of contribution values of each node entering Phase B, the corresponding target value parameters are calculated to determine the mining target setting value;
[0016] According to the size of the target value parameter, the coefficient value and exponent value in the block difficulty bit are determined, and then the size of the final mining target value is determined according to the difficulty bit value.
[0017] Furthermore, the calculation expression of the mining target setting value is:
[0018] Target = 2 W(i,n)
[0019]
[0020] F(n)=α*2 n
[0021] In the formula, Target is the mining target setting value, n is the contribution ranking order of the node, W(i,n) is the target value coefficient of the node with contribution ranking n in the i-th cycle, is the number of reference bits corresponding to stage B in the i-th cycle, F(n) is the adjustment parameter, and α is the fairness coefficient.
[0022] Furthermore, the coefficient value and exponent value in the difficulty bit of the block are determined by:
[0023] If W(i,n) is less than 24, then:
[0024] coefficient = 2 W(i,n)
[0025] exponent=0
[0026] In the formula, coefficient is the coefficient value, and exponent is the exponent value;
[0027] otherwise:
[0028] coefficient=int(2 W(i,n)mod24 )
[0029]
[0030] Where mod represents the modulo operation.
[0031] Furthermore, the calculation expression of the mining target value is:
[0032] D=coefficient*2 24*exponent
[0033] Where D is the mining target value.
[0034] Furthermore, the mining target value is a string of 256-bit binary numbers.
[0035] Furthermore, the coefficient value and the exponent value of the mining target value constitute the difficulty bit of the mining target value, and the difficulty bit occupies four bytes, the first three bytes are the coefficient value, and the last byte is the exponent value, and all four bytes are in hexadecimal.
[0036] Furthermore, according to the quantity or contribution value, the nodes with higher contribution values in phase A are selected to enter phase B.
[0037] The present invention also provides a blockchain consensus system based on contribution value and proof of work, including a memory and a processor, wherein the memory stores a computer program, and the processor calls the computer program to execute the steps of the method described above.
[0038] The present invention also provides a computer-readable storage medium, on which a computer program is stored, and the computer program is used by a processor to execute the steps of the method described above.
[0039] Compared with the prior art, the present invention has the following advantages:
[0040] (1) The present invention divides the mining process into multiple phase cycles, each cycle is divided into phase A and phase B; in phase A, all nodes can participate in mining; in phase B, only a few nodes with higher contribution values are eligible to enter phase B for mining, and the mining target value is related to the contribution value;
[0041] Since the total computing power of the miners participating in phase B is much lower than that in phase A, the mining difficulty in phase B is much lower than that in phase A under the premise of maintaining the same block time, thus saving a lot of computing resources. At the same time, combined with the contribution value of the node in the system, the nodes with more contributions are incentivized to attract more people to participate in bookkeeping, which not only improves the decentralization and security, but also increases user participation.
[0042] (2) Overall, the present invention generates blocks in stages according to different criteria, incentivizes nodes that contribute greatly to the system, and encourages more people to participate in bookkeeping. This consensus mechanism reduces system energy consumption while having good anti-centralization characteristics and high security. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A flowchart of a blockchain consensus method based on contribution value and proof of work provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0045] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of 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.
[0046] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0047] Example 1
[0048] like Figure 1 As shown, this embodiment provides a blockchain consensus method based on contribution value and proof of work, including the following steps:
[0049] S1: Divide the mining process in the blockchain into multiple cycles of equal length;
[0050] S2: Each cycle is divided into Phase A and Phase B. In Phase A, all nodes participate in mining, and the mining target value is the same. When the first node mines a legal block, it becomes the Phase A block accountant of the cycle, and the Phase A mining ends and enters Phase B.
[0051] S3: In phase B, nodes with higher contribution values are selected for mining, and the mining target value is related to the contribution value;
[0052] S4: After waiting for the blocks in phase B to be mined, all nodes re-enter a new cycle to continue mining.
[0053] Specifically, in Phase A, the mining process is similar to the proof-of-work mechanism. All nodes can participate in mining. The first miner who mines a legal block will become the accountant of the first block of the cycle, and Phase A mining ends.
[0054] In Phase B, only a few nodes with higher contribution values are eligible to enter Phase B for mining, and the mining target value is related to the contribution value. Other nodes wait for the blocks in Phase B to be mined before entering the new phase to continue mining.
[0055] Since the total computing power of the miners participating in phase B is much lower than that in phase A, the mining difficulty in phase B is much lower than that in phase A under the premise of maintaining the same block time, thus saving a lot of computing resources. At the same time, combined with the contribution value of the node in the system, the nodes with more contributions are incentivized to attract more people to participate in bookkeeping, which not only improves the decentralization and security, but also increases user participation.
[0056] In Phase B, participating nodes are ranked from high to low according to their contribution values, and different mining target values are assigned according to their contribution values, i.e., mining difficulty is adjusted. The process includes:
[0057] According to the ranking order of contribution values of each node entering phase B, the corresponding benchmark digits are calculated;
[0058] According to the size of the benchmark digit, the coefficient value and exponent value of the mining target value are determined, thereby determining the size of the mining target value.
[0059] The specific steps are:
[0060] In SPoC, the mining process is divided into two stages: in stage A, all nodes participate in mining, and the process is similar to PoW; and only a few nodes with high contribution value rankings can enter stage B for mining. SPoC will adjust the difficulty according to the contribution value ranking of the participating nodes in stage B. The general target value is a string of 256-bit binary numbers, which is:
[0061] Target = 2 W(i,n)
[0062]
[0063] F(n)=α*2 n
[0064] Among them, Target is the mining target setting value, is the number of benchmark bits corresponding to phase B in the ith cycle, n is the ranking order of the contribution value of the node, and α is the fairness coefficient, which can be adjusted according to system requirements and actual conditions.
[0065] Finally, the target value is divided into two parts and written into the difficulty bit of the block, occupying a total of four bytes. The first three bytes are coefficients, and the last byte is exponent, both in hexadecimal. If W(i,n) is less than 24, then:
[0066] coefficient = 2 W(i,n)
[0067] exponent=0
[0068] otherwise:
[0069] coefficient=int(2 W(i,n)mod24 )
[0070]
[0071] Therefore, the mining target value can be calculated by the following formula:
[0072] D=coefficient*2 24*exponent
[0073] In summary, the blockchain consensus method based on contribution value and proof of work proposed in this invention generates blocks in stages according to different criteria, incentivizes nodes with high contributions to the system, and encourages more people to participate in bookkeeping. This consensus mechanism reduces system energy consumption while having good anti-centralization characteristics and high security.
[0074] This embodiment also provides a blockchain consensus system based on contribution value and proof of work, including a memory and a processor, wherein the memory stores a computer program, and the processor calls the computer program to execute the steps of the blockchain consensus method based on contribution value and proof of work as described above.
[0075] The present invention also provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to perform the steps of the blockchain consensus method based on contribution value and proof of work as described above.
[0076] Computer readable storage medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. Computer readable storage medium can be a machine readable signal medium or a machine readable storage medium. Computer readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the above. More specific examples of machine readable storage mediums can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0077] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A blockchain consensus method based on contribution value and proof of work, characterized in that: The following steps are involved: Divide the mining process in the blockchain into multiple cycles of equal length; Each cycle is divided into Phase A and Phase B. In Phase A, all nodes participate in mining, and the mining target value is the same. When the first node mines a legal block, it becomes the Phase A block accountant of the cycle, and the mining of Phase A ends and enters Phase B. In phase B, nodes with higher contribution values are selected for mining, and the mining target value is related to the contribution value; The remaining nodes wait for the blocks in phase B to be mined and then enter a new cycle to continue mining.
2. A blockchain consensus method based on contribution value and proof of work according to claim 1, characterized in that: The process of setting the mining target value in the B phase includes: According to the ranking order of contribution values of each node entering Phase B, the corresponding target value parameters are calculated to determine the mining target setting value; According to the size of the target value parameter, the coefficient value and exponent value in the block difficulty bit are determined, and then the size of the final mining target value is determined according to the difficulty bit value.
3. A blockchain consensus method based on contribution value and proof of work according to claim 2, characterized in that: The calculation expression of the mining target setting value is: Target=2 W(i,n) F(n)=α*2 n Where Target is the mining target setting value, n is the contribution ranking order of the node, W(i,n) is the target value coefficient of the node with contribution ranking n in the i-th cycle, and W i 2 is the number of reference bits corresponding to stage B in the i-th cycle, F(n) is the adjustment parameter, and α is the fairness coefficient.
4. A blockchain consensus method based on contribution value and proof of work according to claim 3, characterized in that: The determination expression of the coefficient value and exponent value in the difficulty bit of the block is: If W(i, n) is less than 24, then: coefficient=2 W(i,n) exponent=0 In the formula, coefficient is the coefficient value, and exponent is the exponent value; otherwise: coefficient=int(2 W(i,n)mod24 ) Where mod represents the modulo operation.
5. A blockchain consensus method based on contribution value and proof of work according to claim 4, characterized in that: The calculation expression of the mining target value is: D=coefficient*2 24*exponent Where D is the mining target value.
6. A blockchain consensus method based on contribution value and proof of work according to claim 2, characterized in that: The mining target value is a string of 256-bit binary numbers.
7. A blockchain consensus method based on contribution value and proof of work according to claim 6, characterized in that: The coefficient value and exponent value of the mining target value constitute the difficulty bit of the mining target value. The difficulty bit occupies four bytes, the first three bytes are the coefficient value, and the last byte is the exponent value. All four bytes are in hexadecimal.
8. A blockchain consensus method based on contribution value and proof of work according to claim 1, characterized in that: According to the quantity or contribution value, the nodes with higher contribution value in phase A are selected to enter phase B.
9. A blockchain consensus system based on contribution value and proof of work, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor calls the computer program to execute the steps of any one of the methods according to claims 1 to 8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which is used by a processor to execute the steps of the method according to any one of claims 1 to 8.