This application is the U.S. national phase entry of PCT Patent Application No. PCT/CN2018/086154 filed May 9, 2018.

TECHNICAL FIELD

The present disclosure relates to a field of internet technology, and particularly to a method and an apparatus for reaching a blockchain consensus.

BACKGROUND

Blockchain technology is a distributed accounting technology, which has been widely valued for its advantages of decentralization, immutability, and no third-party trust guarantee. Due to features of the distributed storage and decentralization of blockchain technology, a consensus mechanism is particularly important in blockchain technology. In particular, a Proof of Work consensus mechanism, a Proof of Stake consensus mechanism, and a Delegated Proof of Stake consensus mechanism are widely known.

In a process of realizing the concept of the present disclosure, the inventor found that there are at least following problems in the prior art: the Proof of Work consensus mechanism needs to consume a lot of computing resources, and the Proof of Stake consensus mechanism and the Delegated Proof of Stake consensus mechanism have a problem of a certain degree of centralization. As the blockchain nodes that produce the block data structure in the blockchain network will get token rewards, based on the above two consensus mechanisms, the blockchain nodes that initially hold more tokens will get more opportunities to produce block data structures, thereby obtaining more tokens and causing the blockchain network to become more and more centralized.

SUMMARY

In view of this, the present disclosure provides a method and an apparatus for reaching a blockchain consensus.

An aspect of the embodiments of the present disclosure provides a method for reaching a blockchain consensus, comprising: receiving election data transmitted from a blockchain node having a first account balance and/or a second account balance, the election data comprising information about a blockchain node selected by the blockchain node that transmits the election data; and determining a consensus blockchain node from blockchain nodes selected by each election data based on the election data received in this round, so that the consensus blockchain node performs a block packaging operation in a new round; wherein a value in the first account of each blockchain node indicates a number of digital currencies that the blockchain node has, and a value in the second account of each blockchain node indicates a number of votes that the blockchain node has.

Optionally, the method further comprising: receiving transaction information transmitted from a blockchain node; determining whether the transaction information satisfies a predetermined condition or not, and if yes, determining a first numerical value, and the first numerical value indicates a value added to the second account of a blockchain node being a provider of a transaction object corresponding to the transaction information; and transmitting the first numerical value to other blockchain nodes, so that each blockchain node stores the first numerical value in its corresponding blockchain database.

Optionally, the determining whether the transaction information satisfies a predetermined condition or not described above comprises: determining whether the transaction object corresponding to the transaction information is a consumable resource or not; if yes monitoring whether the transaction object corresponding to the transaction information is used up by a blockchain node being a purchaser of the transaction object corresponding to the transaction information or not; if yes determining that the transaction information satisfies the predetermined conditions.

Optionally, the consumable resource comprises at least one of the following: network traffic data resources and computing power resources of a processor; wherein the monitoring whether the transaction object corresponding to the transaction information is used up by a blockchain node being a purchaser of the transaction object corresponding to the transaction information or not described above comprises: receiving transaction feedback information transmitted from the blockchain node being the purchaser of the transaction object, and determining whether the transaction object is used up by the blockchain node based on the transaction feedback information or not; or acquiring a usage log of the transaction object, and determining whether the transaction object is used up by the blockchain node being the purchaser of the transaction object based on the usage log or not.

Optionally, the election data further comprises: a second numerical value and/or a third numerical value; for the election data transmitted from each blockchain node, a sum of the second numerical values in the election data is not greater than the first account balance of the blockchain node, and a sum of the third numerical values in the election data is not greater than the second account balance of the blockchain node; wherein the method further comprises: acquiring a weight of the second numerical value and a weight of the third numerical value; wherein the determining a consensus blockchain node from blockchain nodes selected by each election data based on the election data received in this round comprises: counting a sum of the second numerical values corresponding to each selected blockchain node in the election data received in this round, and a sum of the third numerical values corresponding to each selected blockchain node in the election data received in this round; obtaining an election score of each selected blockchain node according to the sum of the second numerical values and the weight of the second numerical value corresponding to each selected blockchain node, and the sum of the third numerical values and the weight of the third numerical value corresponding to each selected blockchain node; and sorting the selected blockchain nodes in the election data received in this round according to the election scores from high to low, and determining the first predetermined number of blockchain nodes as consensus blockchain nodes, so that the consensus blockchain nodes sequentially perform block packaging operations according to predetermined rules in a new round.

Optionally, the acquiring a weight of the second numerical value and a weight of the third numerical value comprises: counting a sum of the second numerical values and a sum of the third numerical values in the election data received in this round; and determining a weight of the second numerical value and a weight of the third numerical value to satisfy that a product of the sum of the second numerical values and the weight of the second numerical value is equal to a product of the sum of the third numerical values and the weight of the third numerical value.

Optionally, the method described above further comprising: determining a fourth numerical value for each blockchain node that transmits election data, the fourth numerical value is equal to the sum of the third numerical values in the election data transmitted from the blockchain node in this round, and the fourth numerical value indicates a value decreased from the second account of the blockchain node; and transmitting the fourth numerical value to other blockchain nodes, so that each blockchain node stores the fourth numerical value in its corresponding blockchain database.

Optionally, the method described above further comprises: after determining a predetermined number of consensus blockchain nodes, for each consensus blockchain node, generating a non-repeated random number, so that the consensus blockchain node sequentially performs a predetermined number of block packaging operations in an order of the corresponding random numbers in a new round.

Another aspect of the embodiments of the present disclosure provides an apparatus for reaching a blockchain consensus, comprising: a receiving module configured to receive election data transmitted from a blockchain node having a first account balance and/or a second account balance, the election data comprising information about a blockchain node selected by the blockchain node that transmits the election data; and a consensus module configured to determine a consensus blockchain node from blockchain nodes selected by each election data based on the election data received in this round, so that the consensus blockchain node performs a block packaging operation in a new round; wherein a value in the first account of each blockchain node indicates a number of digital currencies that the blockchain node has, and a value in the second account of each blockchain node indicates a number of votes that the blockchain node has.

Optionally, the apparatus described above further comprising: a vote issuing module; the receiving module is further configured to receive transaction information transmitted from a blockchain node; and the vote issuing module is configured to determine whether the transaction information satisfies a predetermined condition or not, and if yes, determine a first numerical value, and the first numerical value indicates a value added to the second account of a blockchain node being a provider of a transaction object corresponding to the transaction information; and transmit the first numerical value to other blockchain nodes, so that each blockchain node stores the first numerical value in its corresponding blockchain database.

Optionally, the vote issuing module is configured to determine whether the transaction object corresponding to the transaction information is a consumable resource or not; if yes, monitor whether the transaction object corresponding to the transaction information is used up by a blockchain node being a purchaser of the transaction object corresponding to the transaction information or not; if yes, determine that the transaction information satisfies the predetermined conditions.

Optionally, the consumable resource comprises at least one of the following: network traffic data resources and computing power resources of a processor; and/or wherein the vote issuing module is configured to receive transaction feedback information transmitted from the blockchain node being the purchaser of the transaction object, and determine whether the transaction object is used up by the blockchain node based on the transaction feedback information or not; or acquire a usage log of the transaction object, and determine whether the transaction object is used up by the blockchain node being the purchaser of the transaction object based on the usage log or not.

Optionally, the election data further comprises: a second numerical value and/or a third numerical value; for the election data transmitted from each blockchain node, a sum of the second numerical values in the election data is not greater than the first account balance of the blockchain node, and a sum of the third numerical values in the election data is not greater than the second account balance of the blockchain node; the consensus module is further configured to acquire a weight of the second numerical value and a weight of the third numerical value; the consensus module is configured to count a sum of the second numerical values corresponding to each selected blockchain node in the election data received in this round, and a sum of the third numerical values corresponding to each selected blockchain node in the election data received in this round; obtain an election score of each selected blockchain node according to the sum of the second numerical values and the weight of the second numerical value corresponding to each selected blockchain node, and the sum of the third numerical values and the weight of the third numerical value corresponding to each selected blockchain node; and sort the selected blockchain nodes in the election data received in this round according to the election scores from high to low, and determine the first predetermined number of blockchain nodes as consensus blockchain nodes, so that the consensus blockchain nodes sequentially perform block packaging operations according to predetermined rules in a new round.

Optionally, the consensus module is configured to count a sum of the second numerical values and a sum of the third numerical values in the election data received in this round; and determine a weight of the second numerical value and a weight of the third numerical value to satisfy that a product of the sum of the second numerical values and the weight of the second numerical value is equal to a product of the sum of the third numerical values and the weight of the third numerical value.

Optionally, the consensus module is further configured to determine a fourth numerical value for each blockchain node that transmits election data, the fourth numerical value is equal to the sum of the third numerical values in the election data transmitted from the blockchain node in this round, and the fourth numerical value indicates a value decreased from the second account of the blockchain node; and transmit the fourth numerical value to other blockchain nodes, so that each blockchain node stores the fourth numerical value in its corresponding blockchain database.

Optionally, the consensus module is further configured to generate a non-repeated random number for each consensus blockchain node after determining a predetermined number of consensus block chain nodes, so that the consensus blockchain node sequentially executes a predetermined number of block packaging operations in an order of the corresponding random numbers in a new round.

Another aspect of the embodiments of the present disclosure provides a computer system, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, and when the processor executes the program, the method as described above.

Another aspect of the embodiments of the present disclosure provides an electronic device, comprising: a memory having stored thereon executable instructions, and a processor configured to implement the method described above when the executable instructions are executed.

Another aspect of the embodiments of the present disclosure provides a non-volatile storage medium storing computer-executable instructions, which are used to implement the method described above when executed.

Another aspect of the embodiments of the present disclosure provides a non-transitory computer-readable medium having stored thereon executable instructions which, when executed by a processor, cause the processor to implement the method described.

Another aspect of the embodiments of the present disclosure provides a computer program. The computer program includes computer-executable instructions that, when executed, are used to implement the method described above.

