CN114331430A - Block chain consensus method, apparatus, device and medium - Google Patents

Block chain consensus method, apparatus, device and medium Download PDF

Info

Publication number
CN114331430A
CN114331430A CN202111599589.8A CN202111599589A CN114331430A CN 114331430 A CN114331430 A CN 114331430A CN 202111599589 A CN202111599589 A CN 202111599589A CN 114331430 A CN114331430 A CN 114331430A
Authority
CN
China
Prior art keywords
node
secret
sub
accounting
secrets
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.)
Granted
Application number
CN202111599589.8A
Other languages
Chinese (zh)
Other versions
CN114331430B (en
Inventor
王家恒
杨兹博
乐煜炜
凌昕彤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Tidu Technology Co ltd
Original Assignee
Hangzhou Tidu Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hangzhou Tidu Technology Co ltd filed Critical Hangzhou Tidu Technology Co ltd
Priority to CN202111599589.8A priority Critical patent/CN114331430B/en
Publication of CN114331430A publication Critical patent/CN114331430A/en
Application granted granted Critical
Publication of CN114331430B publication Critical patent/CN114331430B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

One or more embodiments of the present specification provide a method, an apparatus, a device, and a medium for block chain consensus, where the method is applied to a node device in a block chain network, and includes: receiving a sub-secret assigned by an accounting node for a current accounting period in the blockchain network; the sub-secrets comprise secret fragments obtained by the accounting node by dividing the generated master secret competing for the accounting right of the next accounting period based on a secret sharing algorithm; sending the received sub-secret broadcast to other node equipment, and collecting the sub-secrets broadcast by other node equipment; recovering the master secret based on the secret sharing algorithm and the collected sub-secrets, and determining whether the time when the node device recovers the master secret is earlier than the time when other node devices recover the master secret; if yes, determining the node equipment as the accounting node of the next accounting period.

Description

Block chain consensus method, apparatus, device and medium
Technical Field
One or more embodiments of the present disclosure relate to the field of blockchain technology, and in particular, to a method, an apparatus, a device, and a medium for blockchain consensus.
Background
The block chain technology, also called as distributed ledger technology, is an emerging technology in which a plurality of computing devices participate in 'accounting' together, and a complete distributed intelligent database is maintained together. The blockchain technology has been widely applied in many fields due to the characteristics of decentralization, transparency in disclosure, capability of participating in database recording by each computing device, capability of rapidly performing data synchronization among the computing devices, and support of consistent execution of distributed programs.
Disclosure of Invention
The present specification proposes a block chain consensus method, which is applied to a node device in a block chain network; the method comprises the following steps:
receiving a sub-secret assigned by an accounting node for a current accounting period in the blockchain network; the sub-secrets comprise secret fragments obtained by the accounting node by dividing the generated master secret competing for the accounting right of the next accounting period based on a secret sharing algorithm;
sending the received sub-secret broadcast to other node equipment, and collecting the sub-secrets broadcast by other node equipment;
recovering the master secret based on the secret sharing algorithm and the collected sub-secrets, and determining whether the time when the node device recovers the master secret is earlier than the time when other node devices recover the master secret;
if yes, determining the node equipment as the accounting node of the next accounting period.
The present specification also provides a device for block chain consensus, which is applied to a node device in a block chain network; the device comprises:
a receiving module, configured to receive a sub-secret distributed by an accounting node of a current accounting period in the blockchain network; the sub-secrets comprise secret fragments obtained by the accounting node by dividing the generated master secret competing for the accounting right of the next accounting period based on a secret sharing algorithm;
the collecting module is used for sending the received sub-secret broadcast to other node equipment and collecting the sub-secrets broadcast by other node equipment;
a recovery module, configured to recover the master secret based on the secret sharing algorithm and the collected sub-secrets, and when the master secret is recovered, determine whether a time at which the node device recovers the master secret is earlier than times at which other node devices recover the master secret;
and the determining module is used for determining that the node equipment is the accounting node in the next accounting period when the time for recovering the master secret by the node equipment is earlier than the time for recovering the master secret by other node equipment.
This specification also proposes an electronic device including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the steps of the method as described in any one of the above by executing the executable instructions.
The present specification also proposes a computer-readable storage medium having stored thereon computer instructions which, when executed by a processor, carry out the steps of the method according to any one of the preceding claims.
In the foregoing technical solution, an accounting node in a current accounting period in a blockchain network may divide a generated master secret competing for accounting right of a next round of accounting period, and allocate a plurality of obtained sub-secrets to each node device in the blockchain network, where each node device may broadcast a received sub-secret to other node devices, and collect the sub-secrets broadcast by the other node devices, so as to recover the master secret based on the collected sub-secrets, so that a node device that recovers the master secret earliest may be determined as an accounting node in the next round of accounting period.
By adopting the mode, on one hand, compared with common identification algorithms such as PoW, PoS, DPoS and the like, the calculation amount of a block chain common identification stage can be reduced, so that the calculation power consumption can be reduced, and meanwhile, the time duration for node equipment in a block chain to achieve common identification can be shortened, so that the block chain block outlet interval can be shortened, the block chain throughput rate can be improved, and the confirmation time delay of transaction can be shortened; on the other hand, by the secret sharing algorithm, the node devices in the block chain can recover the master secret only when acquiring the sub-secret meeting the specific condition, so that the safety and reliability of the block chain consensus mechanism can be improved.
Drawings
FIG. 1 is a schematic diagram of a blockchain network shown in an exemplary embodiment of the present description;
FIG. 2 is a flow chart of a blockchain consensus method shown in an exemplary embodiment of the present description;
fig. 3 is a flow chart illustrating another blockchain consensus method in an exemplary embodiment of the present specification;
fig. 4 is a schematic diagram of a candidate block according to an exemplary embodiment of the present disclosure;
fig. 5 is a hardware structure diagram of an electronic device in which a blockchain consensus device is located according to an exemplary embodiment of the present disclosure;
fig. 6 is a block diagram of a blockchain consensus apparatus according to an exemplary embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of one or more embodiments of the specification, as detailed in the claims which follow.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the method may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
Blockchains are generally divided into three types: public chain (Public Blockchain), Private chain (Private Blockchain), and federation chain (Consortium Blockchain). In addition, there may be various combinations of the above, such as a combination of a private chain and a federation chain, a combination of a federation chain and a public chain, and so on.
Among them, the most decentralized is the public chain. A party joining the public chain (which may also be referred to as a node in the blockchain) may read the data records on the chain, participate in transactions, compete for accounting rights for new blocks, etc. Moreover, each node can freely join or leave the network and perform related operations.
Private chains are the opposite, with the network's write rights being controlled by an organization or organization and the data read rights being specified by the organization. Briefly, a private chain can be viewed as a weakly centralized system with strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for use within a particular establishment.
The federation chain is between the public chain and the private chain, and partial decentralization can be realized. Each node in a federation chain typically has a physical organization or organization corresponding to it; the nodes are authorized to join the network and form a benefit-related alliance, and the operation of the block chain is maintained together.
In a blockchain network, nodes are logical communication entities; the different types of block chain nodes can run on the same physical server or different physical servers.
Based on the basic characteristics of a blockchain, a blockchain is usually composed of several blocks. The time stamps corresponding to the creation time of the block are recorded in the blocks respectively, and all the blocks form a time-ordered data chain according to the time stamps recorded in the blocks strictly.
The data generated outside the chain can be constructed into a standard transaction (transaction) format supported by the blockchain, then the data is issued to the blockchain, the node equipment in the blockchain network identifies the transaction, and after the identification is achieved, the node equipment serving as an accounting node in the blockchain network packages the transaction into a block, and the block chain stores the transaction persistently.
The consensus algorithm supported in the blockchain may include:
the first kind of consensus algorithm, namely the consensus algorithm that the node device needs to contend for the accounting right in each accounting period; consensus algorithms such as Proof of workload (Proof of Work, PoW), Proof of equity (Proof of stamp, PoS), and Proof of delegation of rights (DPoS);
the second kind of consensus algorithm, namely the consensus algorithm which elects accounting nodes in advance for each accounting period (without competing for accounting right); for example, a consensus algorithm such as a Practical Byzantine Fault Tolerance (PBFT) is used.
In a blockchain network employing a first type of consensus algorithm, node devices competing for billing rights can execute a transaction upon receipt. One of the node devices competing for the accounting right may win in the process of competing for the accounting right in the current round, and become an accounting node. The accounting node may package the received transaction with other transactions to generate a candidate block and send the generated candidate block or a block header of the candidate block to other node devices for consensus.
In the block chain network adopting the second type of consensus algorithm, the node equipment with the accounting right is agreed before accounting in the current round. Thus, the node device, after receiving the transaction, may send the transaction to the accounting node if it is not the accounting node of its own round. For the accounting node of the current round, the transaction may be performed during or before packaging the transaction with other transactions to generate candidate blocks. After generating the candidate block, the accounting node may send the candidate block or a block header of the candidate block to other node devices for consensus.
As described above, regardless of which consensus algorithm is used by the blockchain, the accounting node of the current round may package the received transaction to generate a candidate block and send the generated candidate block or the block header of the candidate block to other node devices for consensus verification. If no problem is verified after the other node device receives the candidate block or the block header of the candidate block, the candidate block can be added to the end of the original block chain as the latest block, thereby completing the accounting process of the block chain. The transaction contained in the block may also be performed by other nodes in verifying the new block or block header sent by the accounting node.
However, the above consensus algorithm commonly used in the related art generally has the problems of large calculation amount in the block chain consensus phase and long time consumption for node devices in the block chain to achieve consensus. Taking the PoW consensus algorithm as an example, the node devices in the block chain need to prove their contribution values through workload to compete for the accounting right, so the amount of calculation in the consensus phase is large, and the time spent in reaching consensus is long; in addition, since computing power is usually provided by computer hardware, a large amount of power resources are consumed, which is not in line with the development trend of energy conservation and environmental protection.
In order to solve the above problems, the present specification proposes a block chain consensus method, apparatus, device, and medium.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating a blockchain network according to an exemplary embodiment of the present disclosure.
In the blockchain network, a plurality of node devices may be included; and interaction can be carried out among the node devices. In each accounting period, the node devices competing for the accounting right become accounting nodes, package transactions for generating the latest block to generate a candidate block, and initiate consensus on the candidate block; after the consensus for the candidate block passes, the candidate block may be stored in the block chain.
Referring to fig. 2, fig. 2 is a flowchart illustrating a block chain consensus method according to an exemplary embodiment of the present disclosure.
The block chain consensus method as shown in fig. 2 may be applied to node devices in a block chain network. It should be noted that, for a blockchain network, any node device in the blockchain network may contend for accounting right for a certain round of accounting period to become an accounting node, so the blockchain consensus method can be applied to any node device in the blockchain network.
The block chain consensus method may comprise the following steps:
step 201: receiving a sub-secret assigned by an accounting node for a current accounting period in the blockchain network; the sub-secrets comprise secret fragments obtained by the accounting node by dividing the generated master secret competing for the accounting right of the next accounting period based on a secret sharing algorithm.
In this embodiment, for the above block chain network, a node device (hereinafter, referred to as node device a) as an accounting node of a current accounting period (hereinafter, the current accounting period is referred to as an nth accounting period) may generate a secret (may be referred to as a master secret) for competing for an accounting right of a next accounting period (i.e., an N +1 th accounting period), and divide the generated master secret based on a secret sharing algorithm to obtain a plurality of secret segments (may be referred to as sub-secrets).
Wherein, the secret sharing algorithm may be a common secret sharing algorithm; secret sharing algorithms such as Shamir secret sharing scheme, Feldman verifiable secret sharing scheme, and the like; this is not limited by the present description.
In one embodiment, the node device a divides the master secret competing for the accounting right of the N +1 th round accounting period, and the number of the obtained sub-secrets should be no greater than the number of node devices in the blockchain network. For example, assuming that there are 5 node devices in the blockchain network, node device a may obtain up to 5 sub-secrets by splitting the master secret.
In an illustrated embodiment, when generating the master secret for competing the accounting right of the N +1 th round accounting period, the node device a may specifically generate the master secret based on the block feature of the candidate block corresponding to the nth round accounting period.
Further, in one illustrated embodiment, the above-mentioned tile characteristics may include a tile root hash value in the tile header.
In one example, the block feature may be calculated based on a one-way hash function, and the calculated fixed-length output string may be used as the master secret.
When the node device a obtains the plurality of sub-secrets, the node device a may send the plurality of sub-secrets to each node device in the block chain network, so that each node device in the block chain network may receive the sub-secret assigned by the node device a.
Step 202: and transmitting the received sub-secret broadcast to other node devices, and collecting the sub-secrets broadcast by other node devices.
In this embodiment, for any node device in the above block chain network (hereinafter, this node device is referred to as node device X), on one hand, the node device X may send the received sub-secret broadcast to other node devices in the block chain network; on the other hand, node device X may collect the sub-secrets sent by other node devices in the blockchain network.
In an embodiment shown, in order to guarantee data security of the sub-secret and avoid forgery or falsification of the sub-secret, the node device X may specifically perform digital signature on the sub-secret when broadcasting and transmitting the received sub-secret, and broadcast and transmit the sub-secret and a digital signature for the sub-secret to other node devices in the blockchain network.
In the above case, when receiving the sub-secret broadcast by each of the other node apparatuses and the digital signature for the sub-secret, the node apparatus X may verify the digital signature first, and collect the sub-secret after the digital signature verification is passed. Accordingly, if the digital signature verification fails, the received sub-secret may be considered anomalous and may not be collected.
Step 203: and recovering the master secret based on the secret sharing algorithm and the collected sub-secrets, and determining whether the time when the node device recovers the master secret is earlier than the time when other node devices recover the master secret.
In this embodiment, the node device X may recover the master secret competing for the accounting right of the (N + 1) th round accounting period based on the secret sharing algorithm and the collected sub-secrets, so as to attempt to recover the master secret through the collected sub-secrets.
In the case where the master secret is recovered through the collected children, the node device X may determine whether or not the time at which the node device (i.e., the node device X) recovers the master secret is earlier than the time at which the other node devices in the block chain network recover the master secret.
In one example, when recovering the master secret, the node device in the block chain network may broadcast and transmit a notification message indicating that the master secret is recovered to other node devices. In this case, in the case of recovering the master secret, the node apparatus X may detect whether a notification message, which is sent by any one of the other node apparatuses and instructs to recover the master secret, has been received, and if not, may determine that the time at which the node apparatus recovers the master secret is earlier than the time at which the other node apparatuses in the block chain network recover the master secret.
Step 204: if yes, determining the node equipment as the accounting node of the next accounting period.
In this embodiment, if the time when the node device X recovers the master secret competing for the accounting right in the (N + 1) th round of accounting period is earlier than the time when each of the other node devices in the blockchain network recovers the master secret, the node device X may determine that the node device (i.e., the node device X) is an accounting node in the (N + 1) th round of accounting period.
The blockchain consensus method shown in fig. 2 is exemplified below by using Shamir secret sharing scheme as an example.
In conjunction with the blockchain network shown in fig. 1, assume that there are 5 node devices in the blockchain network, which are node device X1, node device X2, node device X3, node device X4, and node device X5; wherein, the node device X1 is the accounting node of the nth accounting period in the blockchain network.
The node device X1 may generate a master secret S for competing the accounting right of the N +1 th round of accounting period, and partition the master secret S based on the Shamir secret sharing algorithm to obtain 4 sub-secrets, respectively: the sub-secret S1, the sub-secret S2, the sub-secret S3, and the sub-secret S4.
Subsequently, the node device X1 may send the sub-secret S1 to the node device X2, send the sub-secret S2 to the node device X3, send the sub-secret S3 to the node device X4, and send the sub-secret S4 to the node device X5.
And the node device X2 may receive the sub-secret S1 assigned by the node device X1 on the one hand and may broadcast the sub-secret S1 to the node device X3, the node device X4 and the node device X5 on the other hand; the node device X3 may receive the sub-secret S2 assigned by the node device X1 on the one hand and may broadcast the sub-secret S2 to the node device X2, the node device X4 and the node device X5 on the other hand; the node device X4 may receive the sub-secret S3 assigned by the node device X1 on the one hand and may broadcast the sub-secret S3 to the node device X2, the node device X3 and the node device X5 on the other hand; the node device X5 may receive the sub-secret S4 assigned by the node device X1 on the one hand and may broadcast the sub-secret S4 to the node device X2, the node device X3 and the node device X4 on the other hand. In this way, each node device can collect the sub-secrets broadcast by other node devices.
Note that, in the Shamir secret sharing scheme, the threshold value n may be set in advance. In this case, if the master is divided into m (m ≧ n) shares, at least n of the m shares of the child secret need to be obtained to recover the master secret based on the n obtained shares; if less than n shares of the sub-secret are obtained, the master secret cannot be recovered.
Therefore, assuming that the preset threshold value is 3, taking the node device X2 as an example, when any two sub-secrets among the sub-secret S2, the sub-secret S3, and the sub-secret S4 are collected, the node device X2 may recover the master secret S based on the Shamir secret sharing algorithm and the collected 3 sub-secrets, in addition to the sub-secret S1.
Upon recovering the master secret S, the node device X2 may determine whether the time at which the master secret S was recovered is earlier than the time at which any one of the node device X3, the node device X4, and the node device X5 recovered the master secret. If so, it may be determined that node device X2 is the accounting node for the accounting period of round N + 1.
In the foregoing technical solution, an accounting node in a current accounting period in a blockchain network may divide a generated master secret competing for accounting right of a next round of accounting period, and allocate a plurality of obtained sub-secrets to each node device in the blockchain network, where each node device may broadcast a received sub-secret to other node devices, and collect the sub-secrets broadcast by the other node devices, so as to recover the master secret based on the collected sub-secrets, so that a node device that recovers the master secret earliest may be determined as an accounting node in the next round of accounting period.
By adopting the mode, on one hand, compared with common identification algorithms such as PoW, PoS, DPoS and the like, the calculation amount of a block chain common identification stage can be reduced, so that the calculation power consumption can be reduced, and meanwhile, the time duration for node equipment in a block chain to achieve common identification can be shortened, so that the block chain block outlet interval can be shortened, the block chain throughput rate can be improved, and the confirmation time delay of transaction can be shortened; on the other hand, by the secret sharing algorithm, the node devices in the block chain can recover the master secret only when acquiring the sub-secret meeting the specific condition, so that the safety and reliability of the block chain consensus mechanism can be improved.
Referring to fig. 3, fig. 3 is a flowchart illustrating another block chain consensus method according to an exemplary embodiment of the present disclosure.
The blockchain formula method shown in fig. 3 can be regarded as a specific implementation method of the blockchain consensus method shown in fig. 2.
The block chain consensus method may comprise the following steps:
step 301: receiving a sub-secret assigned by an accounting node for a current accounting period in the blockchain network; the sub-secrets comprise secret fragments obtained by the accounting node by dividing the generated master secret competing for the accounting right of the next accounting period based on a secret sharing algorithm.
Step 302: and transmitting the received sub-secret broadcast to other node devices, and collecting the sub-secrets broadcast by other node devices.
Step 303: and recovering the master secret based on the secret sharing algorithm and the collected sub-secrets, and determining whether the time when the node device recovers the master secret is earlier than the time when other node devices recover the master secret.
Step 304: if yes, determining the node equipment as the accounting node of the next accounting period.
The specific implementation of the steps 301-304 can refer to the steps 201-204; this description is not repeated herein.
Step 305: generating a candidate block corresponding to the next accounting period and initiating consensus on the candidate block.
In this embodiment, when determining that the node device is the accounting node in the (N + 1) th accounting period, the node device X may package transactions for generating the latest block to generate a candidate block corresponding to the (N + 1) th accounting period, and initiate consensus on the candidate block in the blockchain network.
In one embodiment, in order to save the master secret competing for the accounting right in the nth round accounting period and the sub-secrets obtained by dividing the master secret, when the node apparatus X generates a candidate block corresponding to the (N + 1) th round accounting period, the node apparatus X may write the collected sub-secrets and the recovered master secret into a block header of the candidate block.
For example, the specific content of the candidate block may be as shown in fig. 4.
Step 306: storing the candidate block in the block chain after passing the consensus for the candidate block.
In this embodiment, after the consensus on the candidate block corresponding to the N +1 th accounting period passes, the candidate block may be stored in the block chain.
In one embodiment, in order to guarantee data security of the master secret and avoid counterfeiting or tampering with the master secret, the node device a may digitally sign the generated master secret when generating the master secret for competing for the accounting right of the nth accounting period; when the master secret is divided, the master secret and the digital signature for the master secret may be divided to obtain a plurality of sub-secrets.
In this case, after the consensus for the candidate block corresponding to the N +1 th accounting period passes and the digital signature verification for the master secret passes, the candidate block may be stored in the block chain.
With continued reference to fig. 4, the node device X may also write the digital signature for the master secret into the block header of the candidate block corresponding to the N +1 th accounting period. In conjunction with step 202 above, node device X may also write a digital signature for the collected sub-secrets to the chunk header of the candidate chunk.
Step 307: and generating a master secret for competing the accounting right of the next accounting period, and dividing the master secret based on the secret sharing algorithm to obtain a plurality of sub-secrets.
In this embodiment, the node device X may further generate a master secret for competing for the accounting right of the next accounting period (i.e. the N +2 th accounting period), and segment the generated master secret based on the secret sharing algorithm to obtain a plurality of sub-secrets.
Step 308: and respectively sending the plurality of sub-secrets to each node device in the block chain network so as to receive the sub-secrets distributed by the node device by each node device in the block chain network.
In this embodiment, when the node device X obtains the plurality of sub-secrets, the plurality of sub-secrets may be respectively sent to the node devices in the blockchain network, so that each node device in the blockchain network may receive the sub-secret assigned by the node device X, and the node device that recovers the master secret through the collected sub-secrets at the earliest time may become the accounting node in the N +2 th accounting period.
By analogy, in the blockchain network, for each round of accounting period, all node devices in the blockchain network can compete for the accounting right of the round of accounting period through the blockchain consensus method.
In the illustrated embodiment, if the master secret used for competing the accounting right in the N +1 th round accounting period is generated based on the block characteristics of the candidate block corresponding to the nth round accounting period, the master secret used for competing the accounting right in the first round accounting period cannot be generated for the created block (i.e., the first block in the block chain) because the created block is the candidate block corresponding to the first round accounting period.
The node device X may determine whether the node device (i.e., the node device X) is the accounting node in the first accounting period based on a preset blockchain consensus algorithm. If so, node device X may generate a created block corresponding to the first billing cycle and initiate consensus for the created block in the blockchain network. After the consensus on the created block passes, the created block may be stored in the block chain.
The block chain consensus algorithm may be a block chain consensus algorithm that determines the accounting node of the (N + 1) th accounting period without using the candidate block corresponding to the nth accounting period, and specifically may be a commonly used block chain consensus algorithm; for example, consensus algorithms such as PoW consensus algorithm, PoS consensus algorithm, DPoS consensus algorithm, PBFT consensus algorithm, etc.; this is not limited by the present description.
Subsequently, the node device X may generate a master secret competing for the accounting right of the second round accounting period based on the block features of the created block, divide the generated master secret based on the secret sharing algorithm to obtain a plurality of sub-secrets, and respectively send the plurality of sub-secrets to each node device in the blockchain network, so that each node device in the blockchain network may receive the sub-secret assigned by the node device X, and the node device that recovers the master secret through the collected sub-secrets at the earliest time may become an accounting node of the second round accounting period.
In practical applications, the master secret used for competing the accounting right of the N +1 th accounting period may also be a random number randomly generated in the blockchain network. In this case, the created blocks may be generated by a block chain consensus method as shown in fig. 2 and 3.
In the foregoing technical solution, an accounting node in a current accounting period in a blockchain network may divide a generated master secret competing for accounting right of a next round of accounting period, and allocate a plurality of obtained sub-secrets to each node device in the blockchain network, where each node device may broadcast a received sub-secret to other node devices, and collect the sub-secrets broadcast by the other node devices, so as to recover the master secret based on the collected sub-secrets, so that a node device that recovers the master secret earliest may be determined as an accounting node in the next round of accounting period.
By adopting the mode, on one hand, compared with common identification algorithms such as PoW, PoS, DPoS and the like, the calculation amount of a block chain common identification stage can be reduced, so that the calculation power consumption can be reduced, and meanwhile, the time duration for node equipment in a block chain to achieve common identification can be shortened, so that the block chain block outlet interval can be shortened, the block chain throughput rate can be improved, and the confirmation time delay of transaction can be shortened; on the other hand, by the secret sharing algorithm, the node devices in the block chain can recover the master secret only when acquiring the sub-secret meeting the specific condition, so that the safety and reliability of the block chain consensus mechanism can be improved.
In correspondence with the foregoing embodiments of the blockchain consensus method, the present specification also provides embodiments of a blockchain consensus apparatus.
The embodiment of the block chain consensus device in the present specification can be applied to electronic devices. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. Taking a software implementation as an example, as a logical device, the device is formed by reading, by a processor of the electronic device where the device is located, a corresponding computer program instruction in the nonvolatile memory into the memory for operation. From a hardware aspect, as shown in fig. 5, the block chain common identification apparatus in this specification is a hardware structure diagram of an electronic device, where the block chain common identification apparatus is located, and besides the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 5, the electronic device where the apparatus is located in the embodiment may also include other hardware according to the actual function that the block chain common identification apparatus is usually located, which is not described again.
Referring to fig. 6, fig. 6 is a block diagram illustrating a block chain consensus apparatus according to an exemplary embodiment of the present disclosure.
The block chain consensus apparatus can be applied to the electronic device shown in fig. 5; the electronic device may act as a node device in a blockchain network.
The block chain consensus device may comprise:
a receiving module 601, configured to receive a sub-secret allocated by an accounting node of a current accounting period in the blockchain network; the sub-secrets comprise secret fragments obtained by the accounting node by dividing the generated master secret competing for the accounting right of the next accounting period based on a secret sharing algorithm;
a collecting module 602, configured to send the received sub-secret broadcast to other node devices, and collect the sub-secrets broadcast by other node devices;
a recovering module 603, configured to recover the master secret based on the secret sharing algorithm and the collected sub-secrets, and when the master secret is recovered, determine whether a time at which the node device recovers the master secret is earlier than times at which other node devices recover the master secret;
a determining module 604, configured to determine that the node device is an accounting node in the next accounting period when the time when the node device recovers the master secret is earlier than the time when the other node devices recover the master secret.
The implementation process of the functions and actions of each module in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the modules described as separate parts may or may not be physically separate, and the parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or Flash memory (Flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable Media does not include Transitory computer readable Media such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The terminology used in the description of the one or more embodiments is for the purpose of describing the particular embodiments only and is not intended to be limiting of the description of the one or more embodiments. As used in one or more embodiments of the present specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present description to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of one or more embodiments herein. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The above description is only for the purpose of illustrating the preferred embodiments of the one or more embodiments of the present disclosure, and is not intended to limit the scope of the one or more embodiments of the present disclosure, and any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the one or more embodiments of the present disclosure should be included in the scope of the one or more embodiments of the present disclosure.

Claims (12)

1. A block chain consensus method is applied to node equipment in a block chain network; the method comprises the following steps:
receiving a sub-secret assigned by an accounting node for a current accounting period in the blockchain network; the sub-secrets comprise secret fragments obtained by the accounting node by dividing the generated master secret competing for the accounting right of the next accounting period based on a secret sharing algorithm;
sending the received sub-secret broadcast to other node equipment, and collecting the sub-secrets broadcast by other node equipment;
recovering the master secret based on the secret sharing algorithm and the collected sub-secrets, and determining whether the time when the node device recovers the master secret is earlier than the time when other node devices recover the master secret;
if yes, determining the node equipment as the accounting node of the next accounting period.
2. The method of claim 1, further comprising:
generating a candidate block corresponding to the next accounting period, and initiating consensus aiming at the candidate block;
storing the candidate tile in the chain of tiles after passing consensus for the candidate tile;
generating a master secret for competing the accounting right of the next accounting period, and dividing the master secret based on the secret sharing algorithm to obtain a plurality of sub-secrets;
and respectively sending the plurality of sub-secrets to each node device in the block chain network so as to receive the sub-secrets distributed by the node device by each node device in the block chain network.
3. The method of claim 2, wherein the master secret is digitally signed by a billing node for a current billing period;
the storing the candidate block in the block chain after passing the consensus for the candidate block comprises:
storing the candidate tile in the chain of tiles after the consensus for the candidate tile passes and the digital signature for the master secret verifies.
4. The method of claim 2, wherein the generating the candidate block corresponding to the next accounting period comprises:
writing the collected sub-secrets and the recovered master secret to a block header of the candidate block.
5. The method of claim 1, wherein the number of sub-secrets into which the master secret is partitioned is no greater than the number of node devices in the blockchain network.
6. The method of claim 1, wherein the master secret is generated by an accounting node of the current accounting period based on block characteristics of candidate blocks corresponding to the current accounting period.
7. The method of claim 6, wherein the tile characteristics comprise a tile root hash value in a tile header.
8. The method of claim 1, further comprising:
determining whether the node equipment is an accounting node of the first accounting period based on a preset block chain consensus algorithm;
if yes, generating an created block corresponding to the first accounting period, and initiating consensus aiming at the created block;
after the consensus on the created block passes, storing the created block in the block chain;
generating a master secret competing for the accounting right of the second round of accounting period, and dividing the master secret based on the secret sharing algorithm to obtain a plurality of sub-secrets;
and respectively sending the plurality of sub-secrets to each node device in the block chain network so as to receive the sub-secrets distributed by the node device by each node device in the block chain network.
9. The method of claim 1, wherein the transmitting the received sub-secret broadcast to other node devices comprises:
carrying out digital signature on the received sub-secret, and broadcasting the sub-secret and the digital signature aiming at the sub-secret to other node devices;
the collecting the sub-secrets broadcast by other node devices includes:
and when receiving the sub-secrets broadcast by other node devices and the digital signatures aiming at the sub-secrets, verifying the digital signatures, and collecting the sub-secrets after the digital signature verification is passed.
10. The block chain consensus device is applied to node equipment in a block chain network; the device comprises:
a receiving module, configured to receive a sub-secret distributed by an accounting node of a current accounting period in the blockchain network; the sub-secrets comprise secret fragments obtained by the accounting node by dividing the generated master secret competing for the accounting right of the next accounting period based on a secret sharing algorithm;
the collecting module is used for sending the received sub-secret broadcast to other node equipment and collecting the sub-secrets broadcast by other node equipment;
a recovery module, configured to recover the master secret based on the secret sharing algorithm and the collected sub-secrets, and when the master secret is recovered, determine whether a time at which the node device recovers the master secret is earlier than times at which other node devices recover the master secret;
and the determining module is used for determining that the node equipment is the accounting node in the next accounting period when the time for recovering the master secret by the node equipment is earlier than the time for recovering the master secret by other node equipment.
11. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the method of any one of claims 1-9 by executing the executable instructions.
12. A computer-readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the method of any one of claims 1-9.
CN202111599589.8A 2021-12-24 2021-12-24 Block chain consensus method, apparatus, device and medium Active CN114331430B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111599589.8A CN114331430B (en) 2021-12-24 2021-12-24 Block chain consensus method, apparatus, device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111599589.8A CN114331430B (en) 2021-12-24 2021-12-24 Block chain consensus method, apparatus, device and medium

Publications (2)

Publication Number Publication Date
CN114331430A true CN114331430A (en) 2022-04-12
CN114331430B CN114331430B (en) 2023-03-31

Family

ID=81013805

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111599589.8A Active CN114331430B (en) 2021-12-24 2021-12-24 Block chain consensus method, apparatus, device and medium

Country Status (1)

Country Link
CN (1) CN114331430B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080137857A1 (en) * 2006-11-07 2008-06-12 Mihir Bellare Systems and methods for distributing and securing data
US20180234239A1 (en) * 2015-10-16 2018-08-16 Tohoku University Information processing system, information processing apparatus, method for information processing, and non-transitory computer-readable recording medium having stored therein information processing program
US20200374106A1 (en) * 2019-05-22 2020-11-26 Salesforce.Com, Inc. System or method to implement record level access on metadata driven blockchain using shared secrets and consensus on read
CN112329051A (en) * 2020-10-23 2021-02-05 中国科学院数据与通信保护研究教育中心 Safe and efficient consensus mechanism implementation method and system
CN112468302A (en) * 2020-10-23 2021-03-09 湖南天河国云科技有限公司 Editable blockchain based on verifiable multiparty secret sharing
CN112734576A (en) * 2021-01-19 2021-04-30 广东工业大学 Block chain consensus system and method
CN113098697A (en) * 2021-06-08 2021-07-09 清华大学 Block chain data writing and accessing method and device
WO2021163960A1 (en) * 2020-02-20 2021-08-26 深圳市汇尊区块链技术有限公司 Blockchain-based random number generation method and system, and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080137857A1 (en) * 2006-11-07 2008-06-12 Mihir Bellare Systems and methods for distributing and securing data
US20180234239A1 (en) * 2015-10-16 2018-08-16 Tohoku University Information processing system, information processing apparatus, method for information processing, and non-transitory computer-readable recording medium having stored therein information processing program
US20200374106A1 (en) * 2019-05-22 2020-11-26 Salesforce.Com, Inc. System or method to implement record level access on metadata driven blockchain using shared secrets and consensus on read
WO2021163960A1 (en) * 2020-02-20 2021-08-26 深圳市汇尊区块链技术有限公司 Blockchain-based random number generation method and system, and storage medium
CN112329051A (en) * 2020-10-23 2021-02-05 中国科学院数据与通信保护研究教育中心 Safe and efficient consensus mechanism implementation method and system
CN112468302A (en) * 2020-10-23 2021-03-09 湖南天河国云科技有限公司 Editable blockchain based on verifiable multiparty secret sharing
CN112734576A (en) * 2021-01-19 2021-04-30 广东工业大学 Block chain consensus system and method
CN113098697A (en) * 2021-06-08 2021-07-09 清华大学 Block chain data writing and accessing method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘锋等: "一个完善的可公开验证秘密分享方案", 《计算机应用研究》 *

Also Published As

Publication number Publication date
CN114331430B (en) 2023-03-31

Similar Documents

Publication Publication Date Title
CN108182581B (en) Accounting method and device for block chain
US10929198B2 (en) Blockchain-based resource allocation method and apparatus
CN110800250B (en) Controlled release of encrypted private keys
EP3859647A1 (en) Blockchain transaction generation method and device
CN108985742B (en) Transaction processing method and device and block chain system
CN111539731A (en) Block chain-based federal learning method and device and electronic equipment
CN109299336A (en) Data back up method, device, storage medium and calculating equipment
CN113765657A (en) Key data processing method and device and server
CN109064325B (en) Intelligent contract implementation method and device based on block chain
CN111898360A (en) Text similarity detection method and device based on block chain and electronic equipment
CN110189122B (en) Method and device for anchoring time for data on block chain and electronic equipment
CN113570466B (en) Transaction data processing method and device and readable storage medium
CN110798308A (en) Block chain signature method and system
CN111914023A (en) Bill management method and device based on block chain and electronic equipment
CN112907369B (en) Block chain-based data consensus method and device, electronic equipment and storage medium
CN114143041A (en) Identity verification method, device and equipment based on block chain and storage medium
CN106650496B (en) Data processing method and device
CN108765159A (en) A kind of cochain based on block chain and condition processing method, device and interacted system
CN109242676B (en) Block issuing method and device and electronic equipment
CN109815289A (en) Block generation method, calculating equipment, storage medium for block chain network
CN109587131A (en) Data communications method and device between a kind of block chain network
CN111966538A (en) Block chain data recovery method and device
CN109981586B (en) Node marking method and device
CN111582935A (en) Block chain-based integral mutual identification method and system
CN110443612A (en) A kind of dividing method of submitting an expense account, device and electronic equipment based on block chain

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
GR01 Patent grant
GR01 Patent grant