CN112118117A - Block chain consensus method based on Paxos algorithm - Google Patents
Block chain consensus method based on Paxos algorithm Download PDFInfo
- Publication number
- CN112118117A CN112118117A CN202010877492.8A CN202010877492A CN112118117A CN 112118117 A CN112118117 A CN 112118117A CN 202010877492 A CN202010877492 A CN 202010877492A CN 112118117 A CN112118117 A CN 112118117A
- Authority
- CN
- China
- Prior art keywords
- block
- block chain
- blockchain
- proposal
- node
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/02—Details
- H04L12/16—Arrangements for providing special services to substations
- H04L12/18—Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
- H04L12/185—Arrangements for providing special services to substations for broadcast or conference, e.g. multicast with management of multicast group membership
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1095—Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
Abstract
The block chain consensus method based on the Paxos algorithm comprises the following steps: s1: the information needing to be stored in the block chain is distributed in a block chain network in a broadcasting mode; s2: a main node is periodically elected based on a Paxos algorithm; s3: the master node is responsible for packaging the information broadcast and issued to the block chain in the step S1 into a block, and issuing the block to the block chain network; s4: confirming that the information in the block issued by the current master node is error-free by more than 50% of nodes in the block chain; s5: adding the block to a blockchain, and synchronizing the content of the block by all nodes on the blockchain and adding the content of the block to the blockchain; s6: and the task of the main node is ended, the normal state is returned, and a new main node is selected based on the Paxos algorithm for the next time. The method abandons meaningless operation, only needs negotiation, has low energy consumption, no resource waste and high efficiency, all time delays are network transmission delay, and the calculation hardly consumes time.
Description
Technical Field
The invention relates to the technical field of block chains, in particular to a block chain consensus method based on a Paxos algorithm
Background
The commonly used consensus mechanism of the block chain at present is a PoW algorithm, a PoW algorithm (profofofoffice), that is, a workload certification system, and is mainly characterized in that a client needs to do work with certain difficulty to obtain a result, and a verifier can easily check whether the client does corresponding work or not through the result. One of the core features of this scheme is asymmetry, i.e. work is large for the requestor and easy for the authenticator to authenticate. Therefore, the efficiency of the PoW workload proving mechanism is low, the energy consumption is very high, and the resource waste is serious. In addition, an expansion algorithm PoS algorithm and a DPoS algorithm based on the PoW algorithm are provided, wherein the PoS algorithm has the main idea that the difficulty in obtaining the node billing right is inversely proportional to the rights and interests held by the nodes, and compared with the PoW algorithm, the resource consumption is reduced to a certain extent, but the problems of constant strength of strong persons, monopoly of rights and interests of large users and low decentralization degree are possibly caused. There is a need for a method of generating a consensus mechanism that can both conserve resources and maintain the de-centralization feature of the blockchain.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a block chain consensus method based on a Paxos algorithm, which can eliminate meaningless operation, only needs negotiation, has low energy consumption, no resource waste and high efficiency, has all time delay in network transmission delay, and hardly consumes time in calculation.
In order to achieve the above object, the block chain consensus method based on Paxos algorithm of the present invention includes the following steps:
s1: the information needing to be stored in the block chain is distributed in a block chain network in a broadcasting mode;
s2: a main node is periodically elected based on a Paxos algorithm;
s3: the master node is responsible for packaging the information broadcast and issued to the block chain in the step S1 into a block, and issuing the block to the block chain network;
s4: confirming that the information in the block issued by the current master node is error-free by more than 50% of nodes in the block chain;
s5: adding the block to a blockchain, and synchronizing the content of the block by all nodes on the blockchain and adding the content of the block to the blockchain;
s6: and the task of the main node is ended, the normal state is returned, and a new main node is selected based on the Paxos algorithm for the next time.
Further, in step S2, the Paxos algorithm includes the following steps:
s201: the proposer selects a proposal number Mn, and then sends a prepare request with the number Mn to some more than half of subset members of the acceptor;
s202: if an acceptor receives a prefix request with the number Mn, and the number Mn is greater than the numbers of all the prefix requests to which the acceptor has responded, the acceptor feeds back the proposal with the maximum number accepted by the acceptor as a response to a promoter, and meanwhile, the acceptor promises not to accept any proposal with the number less than Mn;
s203: if the response is received by the proxy, more than half of the requests sent by the acceptors for which the prefix request with the number of Mn is sent, the proxy sends an accept request for [ Mn, Vn ] proposals to the acceptors, the value of Vn is the value of the proposal with the largest number in the received response, and if no proposal is contained in the response, the value of Vn is any value;
s204: if an accept receives this accept request for the [ Mn, Vn ] proposal, it accepts the proposal as long as it has not responded to the prefix request with a number greater than Mn.
Further, in step S1, a selected server sends information that needs blockchain storage to other servers in the blockchain network.
Further, in step S4, the node checks whether the contents of the chunk packaged by the master node are correct with its own stored message record, and if so, returns correct, and adds the chunk to its own chunk chain.
Further, in step S1, the information that needs to be stored by the blockchain includes a transaction or message for a period of time.
Further, in step S2, the master node election is performed at a certain time interval or after a certain number of messages are accumulated.
Further, in step S4, for the contents of the block issued by the master node, the node holding different opinions or not recognizing the contents of the block will not mount the block on its own block chain, and initiate the next round of voting, in this scenario, there will be two block chains in the system, and when there is the conflict, the longest block chain and more than 50% of the block chains recognized by the nodes will be used as the criteria.
The block chain consensus method based on the Paxos algorithm gets rid of meaningless operation, only negotiation is needed, energy consumption is low, no resource is wasted, efficiency is high, all time delays are network transmission delay, and calculation is almost not time-consuming.
Drawings
The present invention will be further described and illustrated with reference to the following drawings.
Fig. 1 is a flowchart of step S1;
fig. 2 is a flowchart of step S2;
fig. 3 is a flowchart of step S4.
Detailed Description
The technical solution of the present invention will be more clearly and completely explained by the description of the preferred embodiments of the present invention with reference to the accompanying drawings.
The block chain consensus method based on the Paxos algorithm in the preferred embodiment of the present invention comprises the following steps:
s1: as shown in fig. 1, a selected server sends information that needs to be stored in a blockchain to other servers in a blockchain network, and the information that needs to be stored in the blockchain is distributed in the blockchain network in a broadcast manner, where the information that needs to be stored in the blockchain includes transactions or messages within a period of time;
s2: as shown in fig. 2, after a certain time is set every interval or a certain number of messages are accumulated, a master node is periodically elected based on Paxos algorithm;
s201: the proposer selects a proposal number Mn, and then sends a prepare request with the number Mn to some more than half of subset members of the acceptor;
s202: if an acceptor receives a prefix request with the number Mn, and the number Mn is greater than the numbers of all the prefix requests to which the acceptor has responded, the acceptor feeds back the proposal with the maximum number accepted by the acceptor as a response to a promoter, and meanwhile, the acceptor promises not to accept any proposal with the number less than Mn;
s203: if the response is received by the proxy, more than half of the requests sent by the acceptors for which the prefix request with the number of Mn is sent, the proxy sends an accept request for [ Mn, Vn ] proposals to the acceptors, the value of Vn is the value of the proposal with the largest number in the received response, and if no proposal is contained in the response, the value of Vn is any value;
s204: if an accept receives this accept request for the [ Mn, Vn ] proposal, it accepts this proposal as long as it has not responded to the prefix request with a number greater than Mn;
s3: the master node is responsible for packaging the information broadcast and issued to the block chain in the step S1 into a block, and issuing the block to the block chain network;
s4: as shown in fig. 3, the node checks whether the block content packaged by the master node is correct by using the message record stored in the node, if so, replies to the correct block, and adds the block to its own block chain, and more than 50% of the nodes in the block chain confirm that the information in the block issued by the current master node is correct, and for the content of the block issued by the master node, the node holding different opinions or not recognizing the content of the block will not mount the block on its own block chain, and initiate the next round of voting, and in this scenario, there will be two block chains in the system, and when there is the conflict, the longest block chain and more than 50% of the block chains recognized by the nodes are taken as the reference;
s5: adding the block to a blockchain, and synchronizing the content of the block by all nodes on the blockchain and adding the content of the block to the blockchain;
s6: and the task of the main node is ended, the normal state is returned, and a new main node is selected based on the Paxos algorithm for the next time.
The block chain consensus method based on the Paxos algorithm gets rid of meaningless operation, only negotiation is needed, energy consumption is low, no resource is wasted, efficiency is high, all time delays are network transmission delay, and calculation is almost not time-consuming.
The above detailed description merely describes preferred embodiments of the present invention and does not limit the scope of the invention. Without departing from the spirit and scope of the present invention, it should be understood that various changes, substitutions and alterations can be made herein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims and their equivalents. The scope of the invention is defined by the claims.
Claims (7)
1. A block chain consensus method based on a Paxos algorithm is characterized by comprising the following steps:
s1: the information needing to be stored in the block chain is distributed in a block chain network in a broadcasting mode;
s2: a main node is periodically elected based on a Paxos algorithm;
s3: the master node is responsible for packaging the information broadcast and issued to the block chain in the step S1 into a block, and issuing the block to the block chain network;
s4: confirming that the information in the block issued by the current master node is error-free by more than 50% of nodes in the block chain;
s5: adding the block to a blockchain, and synchronizing the content of the block by all nodes on the blockchain and adding the content of the block to the blockchain;
s6: and the task of the main node is ended, the normal state is returned, and a new main node is selected based on the Paxos algorithm for the next time.
2. The method of claim 1, wherein in step S2, the Paxos algorithm comprises the following steps:
s201: the proposer selects a proposal number Mn, and then sends a prepare request with the number Mn to some more than half of subset members of the acceptor;
s202: if an acceptor receives a prefix request with the number Mn, and the number Mn is greater than the numbers of all the prefix requests to which the acceptor has responded, the acceptor feeds back the proposal with the maximum number accepted by the acceptor as a response to a promoter, and meanwhile, the acceptor promises not to accept any proposal with the number less than Mn;
s203: if the response is received by the proxy, more than half of the requests sent by the acceptors for which the prefix request with the number of Mn is sent, the proxy sends an accept request for [ Mn, Vn ] proposals to the acceptors, the value of Vn is the value of the proposal with the largest number in the received response, and if no proposal is contained in the response, the value of Vn is any value;
s204: if an accept receives this accept request for the [ Mn, Vn ] proposal, it accepts the proposal as long as it has not responded to the prefix request with a number greater than Mn.
3. The method of claim 1, wherein in step S1, a selected server sends information to other servers in the blockchain network that requires blockchain storage.
4. The method of claim 1, wherein in step S4, the node checks whether the content of the tile packaged by the master node is correct with its stored message record, and if so, returns the correct content, and adds the tile to its own tile chain.
5. The method of claim 1, wherein the information to be stored in the blockchain comprises a transaction or a message within a period of time in step S1.
6. The method of claim 1, wherein in step S2, the master node election is performed at regular intervals or after a certain number of messages are accumulated.
7. The method as claimed in claim 1, wherein in step S4, for the contents of the block issued by the master node, the node holding different opinions or not recognizing the contents of the block will not mount the block on its own block chain, and initiate the next round of voting, in which there are two block chains in the system, and when there is the conflict, the longest block chain and more than 50% of the block chains recognized by the nodes are used as the criteria.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010877492.8A CN112118117A (en) | 2020-08-27 | 2020-08-27 | Block chain consensus method based on Paxos algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010877492.8A CN112118117A (en) | 2020-08-27 | 2020-08-27 | Block chain consensus method based on Paxos algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112118117A true CN112118117A (en) | 2020-12-22 |
Family
ID=73803811
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010877492.8A Pending CN112118117A (en) | 2020-08-27 | 2020-08-27 | Block chain consensus method based on Paxos algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112118117A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113342893A (en) * | 2021-06-09 | 2021-09-03 | 网易(杭州)网络有限公司 | Node synchronization method and device based on block chain, storage medium and server |
CN113645295A (en) * | 2021-08-09 | 2021-11-12 | 东南大学 | Block chain network security setting method based on Paxos algorithm |
CN114422526A (en) * | 2021-12-31 | 2022-04-29 | 支付宝(杭州)信息技术有限公司 | Block synchronization method and device, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103914313A (en) * | 2012-12-31 | 2014-07-09 | 北京新媒传信科技有限公司 | Paxos example updating method, device and system |
CN108492103A (en) * | 2018-02-07 | 2018-09-04 | 北京大学深圳研究生院 | A kind of alliance's block chain common recognition method |
US20200104293A1 (en) * | 2018-09-28 | 2020-04-02 | Thunder Token Inc. | High throughput blockchain consensus systems and methods with low finalization time |
-
2020
- 2020-08-27 CN CN202010877492.8A patent/CN112118117A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103914313A (en) * | 2012-12-31 | 2014-07-09 | 北京新媒传信科技有限公司 | Paxos example updating method, device and system |
CN108492103A (en) * | 2018-02-07 | 2018-09-04 | 北京大学深圳研究生院 | A kind of alliance's block chain common recognition method |
US20200104293A1 (en) * | 2018-09-28 | 2020-04-02 | Thunder Token Inc. | High throughput blockchain consensus systems and methods with low finalization time |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113342893A (en) * | 2021-06-09 | 2021-09-03 | 网易(杭州)网络有限公司 | Node synchronization method and device based on block chain, storage medium and server |
CN113645295A (en) * | 2021-08-09 | 2021-11-12 | 东南大学 | Block chain network security setting method based on Paxos algorithm |
CN114422526A (en) * | 2021-12-31 | 2022-04-29 | 支付宝(杭州)信息技术有限公司 | Block synchronization method and device, electronic equipment and storage medium |
CN114422526B (en) * | 2021-12-31 | 2024-03-15 | 支付宝(杭州)信息技术有限公司 | Block synchronization method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112118117A (en) | Block chain consensus method based on Paxos algorithm | |
CN111475576B (en) | Block chain-based distributed database storage method and system | |
WO2010127618A1 (en) | System and method for implementing streaming media content service | |
Tang et al. | GoCast: Gossip-enhanced overlay multicast for fast and dependable group communication | |
CN108390881A (en) | A kind of distribution high concurrent real-time messages method for pushing and system | |
CN101378409A (en) | Optimal operation of hierarchical peer-to-peer networks | |
CN111355986B (en) | Message processing method and device in live broadcast room and storage medium | |
US20220067063A1 (en) | Apparatus and method for adaptively managing sharded blockchain network based on deep q network | |
Yu et al. | Improved blockchain consensus mechanism based on PBFT algorithm | |
JP2022517436A (en) | Transaction system based on blockchain | |
CN110705893B (en) | Service node management method, device, equipment and storage medium | |
CN109919760A (en) | Byzantine failure tolerance common recognition algorithm based on voting mechanism | |
CN114218612A (en) | Consensus method suitable for high-frequency trading scene of alliance chain | |
US20020129133A1 (en) | Managing network traffic using hashing functions | |
CN103546528A (en) | Distributed message pushing method and system | |
US9015273B2 (en) | Methods and devices for transmitting and receiving sequential content in a content centric network | |
Mišić et al. | PBFT-based ordering service for IoT domains | |
Lim et al. | Unstructured deadlock detection technique with scalability and complexity‐efficiency in clouds | |
EP2025133B1 (en) | Repository synchronization in a ranked repository cluster | |
CN102761520B (en) | Method and system for processing authentication information | |
CN113347174A (en) | Consensus method and device in block chain and electronic equipment | |
Jin et al. | Content routing and lookup schemes using global bloom filter for content-delivery-as-a-service | |
Huang et al. | Consensus of whom? A spectrum of blockchain consensus protocols and new directions | |
CN116260826A (en) | Bayesian-busy fault tolerance consensus method and system in supply chain tracing | |
CN101883101B (en) | Vaccine distributing method based on double-layer Chord ring network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201222 |