CN114650145B - Method and device for generating blocks in block chain and electronic equipment - Google Patents
Method and device for generating blocks in block chain and electronic equipment Download PDFInfo
- Publication number
- CN114650145B CN114650145B CN202210336000.3A CN202210336000A CN114650145B CN 114650145 B CN114650145 B CN 114650145B CN 202210336000 A CN202210336000 A CN 202210336000A CN 114650145 B CN114650145 B CN 114650145B
- Authority
- CN
- China
- Prior art keywords
- block
- target
- node
- information
- public
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 65
- 238000012795 verification Methods 0.000 claims description 35
- 230000004044 response Effects 0.000 claims description 27
- 238000012545 processing Methods 0.000 claims description 13
- 238000004364 calculation method Methods 0.000 claims description 11
- 238000004590 computer program Methods 0.000 claims description 10
- 239000000523 sample Substances 0.000 claims 1
- 230000007246 mechanism Effects 0.000 abstract description 28
- 238000004422 calculation algorithm Methods 0.000 description 20
- 230000008569 process Effects 0.000 description 13
- 238000007599 discharging Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 9
- 230000008901 benefit Effects 0.000 description 7
- 230000000694 effects Effects 0.000 description 5
- 230000006399 behavior Effects 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 2
- 238000010168 coupling process Methods 0.000 description 2
- 238000005859 coupling reaction Methods 0.000 description 2
- 238000000354 decomposition reaction Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000005242 forging Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012163 sequencing technique Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 238000010200 validation analysis Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0618—Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
- H04L9/0631—Substitution permutation network [SPN], i.e. cipher composed of a number of stages or rounds each involving linear and nonlinear transformations, e.g. AES algorithms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0816—Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
- H04L9/0819—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s)
- H04L9/0825—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s) using asymmetric-key encryption or public key infrastructure [PKI], e.g. key signature or public key certificates
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/32—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
- H04L9/3236—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
- H04L9/3239—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L2209/00—Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
- H04L2209/46—Secure multiparty computation, e.g. millionaire problem
- H04L2209/463—Electronic voting
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a method and a device for generating blocks in a block chain and electronic equipment. To the field of blockchain, the method includes: acquiring a target history block; determining public promise information based on the target history block and a ring signature corresponding to the public promise information; broadcasting public promise information, a ring signature and mortgage rights and interests information to a last block outlet node in the current block outlet round, so that the last block outlet node generates target data based on the public promise information, the ring signature and the mortgage rights and interests information; a target rank of the current out-block node in the out-block order is determined based on the target data to generate a target block at the target rank. The method solves the technical problem of low safety of a consensus mechanism caused by easy identification of the block-out nodes of the block chain in the prior art.
Description
Technical Field
The present invention relates to the field of blockchains, and in particular, to a method, an apparatus, and an electronic device for generating blocks in a blockchain.
Background
The blockchain is a distributed database system participated by nodes, and has the characteristics of incapacity of forging, trace in the whole process, traceability, openness, transparency, collective maintenance and the like. The consensus algorithm is used as a core technology of a block chain, can realize distributed consistency of data in a network lacking central control, and plays an important role in maintaining stable operation of a system and mutual trust of nodes.
Currently, before a block is discharged from a block-discharging node in a related blockchain, an adversary easily recognizes the identity of the block-discharging node and influences the block-discharging behavior of the block-discharging node through social engineering or technical means, so that the safety of a common recognition mechanism in the blockchain is reduced.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a method, a device and electronic equipment for generating blocks in a blockchain, which at least solve the technical problem of low safety of a consensus mechanism caused by easy identification of block-out nodes of the blockchain in the prior art.
According to one aspect of an embodiment of the present invention, there is provided a method of generating a block in a blockchain, including: obtaining a target historical block, wherein the target historical block is a block in which target historical data is recorded in a block chain, the target historical data represents a block outlet sequence corresponding to each block outlet node in the current block outlet round, and the block outlet round represents a round that all block outlet nodes finish one block outlet; determining public promise information and a ring signature corresponding to the public promise information based on the target history block, wherein the public promise information is used for representing the identity of the current block-out node in the next block-out round; broadcasting public promise information, a ring signature and mortgage interest information to last-bit block-out nodes in the current block-out round, so that the last-bit block-out nodes generate target data based on the public promise information, the ring signature and the mortgage interest information, wherein the mortgage interest information represents the importance degree of the current block-out nodes in the next block-out round, and the target data represents the block-out sequence of at least one current block-out node in the next block-out round; a target rank of the current out-block node in the out-block order is determined based on the target data to generate a target block at the target rank.
Further, the method of generating a block in a blockchain further includes: signing the target history block based on a preset public key to obtain a promised certificate; carrying out hash calculation on the promised certificate to obtain public promised information; a ring signature is determined based on the target history block and the public commitment information.
Further, the method of generating a block in a blockchain further includes: acquiring a target public key set, wherein the target public key set comprises public keys of all block-out nodes in the current block-out round; determining a private key of a current block node; the ring signature is determined based on the target history block, the public commitment information, the target public key set, and the private key.
Further, the last-bit block-out node is used for verifying the ring signature based on the target public key set, and generating target data based on public promise information and mortgage rights and interests information corresponding to the successfully verified ring signature.
Further, the target data at least includes target public promise information, target mortgage interest information and a block sequence number corresponding to each of the current at least one block node, and the method for generating the block in the blockchain further includes: acquiring target public promise information corresponding to a block outlet serial number of a node to be blocked in target data; comparing the public promise information with the target public promise information; and under the condition that the public promise information is the same as the target public promise information, determining the bit number corresponding to the block outlet serial number of the block outlet node to be the target bit number, and determining the block outlet node to be the current block outlet node.
Further, the method of generating a block in a blockchain further includes: after determining the target rank of the current block-out node in the block-out sequence based on the target data, generating a transaction message based on the target block, the promise certificate and the block-out sequence number of the current block-out node; broadcasting the transaction message to other block-out nodes so that the other block-out nodes verify the transaction message, wherein the other block-out nodes are nodes except the current block-out node in all current block-out nodes; and broadcasting voting messages to other block-out nodes under the condition that all verification results represent that the bit of the current block-out node is the target bit.
Further, the method of generating a block in a blockchain further includes: signing the target block before broadcasting the voting message to other block-out nodes to obtain a target signature; and generating a voting message based on the target signature, the target block and the public promise information.
Further, the other block-out nodes comprise a first block-out node and at least one second block-out node; the first block-out node is used for verifying the voting message, generating a response message under the condition that the verification result corresponding to the voting message indicates that the identity of the current block-out node is the target identity, and acquiring the response message broadcasted by at least one second block-out node, wherein the response message at least comprises public promise information corresponding to the block-out node for generating the response message.
Further, the first output block node is further configured to determine target historical mortgage interest information of the output block node corresponding to each response message based on the target historical data, and determine whether to perform uplink processing on the target block based on the target historical mortgage interest information.
Further, determining a mortgage limit in the mortgage rights and interests information; under the condition that the mortgage limit is larger than or equal to a preset value, the type of the update node is an output block node; under the condition that the mortgage limit is smaller than a preset value, the type of the updated node is a common node, wherein the common node is a node which cannot generate a block.
According to another aspect of the embodiment of the present invention, there is also provided an apparatus for generating a block in a blockchain, including: the system comprises an acquisition module, a block generation module and a block generation module, wherein the acquisition module is used for acquiring a target historical block, the target historical block is a block in which target historical data is recorded in a block chain, the target historical data represents the block generation sequence corresponding to each block generation node in the current block generation turn, and the block generation turn represents the turn that all block generation nodes finish one block generation; the determining module is used for determining public promise information and a ring signature corresponding to the public promise information based on the target history block, wherein the public promise information is used for representing the identity of the current block-out node in the next block-out round; the processing module is used for broadcasting public promise information, ring signature and mortgage interest information to last-bit block outlet nodes in the current block outlet round so that the last-bit block outlet nodes generate target data based on the public promise information, the ring signature and the mortgage interest information, wherein the mortgage interest information represents the importance degree of the current block outlet nodes in the next block outlet round, and the target data represents the block outlet sequence of at least one current block outlet node in the next block outlet round; and the generation module is used for determining the target bit order of the current block-out node in the block-out sequence based on the target data so as to generate a target block at the target bit order.
According to another aspect of the embodiments of the present invention, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the above-described method of generating a block in a blockchain when run.
According to another aspect of an embodiment of the present invention, there is also provided an electronic device including one or more processors; and a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for running the programs, wherein the programs are configured to perform the method of generating blocks in a blockchain described above when run.
According to another aspect of embodiments of the present invention, there is also provided a computer program product comprising a computer program/instruction which, when executed by a processor, implements the method of generating blocks in a blockchain described above.
In the embodiment of the invention, a mode of determining the block outlet sequence of at least one current block outlet node in the next block outlet round based on ring signature, public promise information and mortgage rights information is adopted, a target history block is obtained, then the public promise information and the ring signature corresponding to the public promise information are determined based on the target history block, then the public promise information, the ring signature and the mortgage rights information are broadcast to the last block outlet node in the current block outlet round, so that the last block outlet node generates target data based on the public promise information, the ring signature and the mortgage rights information, and the target bit of the current block outlet node in the block outlet sequence is determined based on the target data, and the target block is generated in the target bit. The target historical block is a block in which target historical data is recorded in a block chain, the target historical data represents a block outlet sequence corresponding to each block outlet node in the current block outlet round, the block outlet round represents that all block outlet nodes finish one block outlet round, public promise information is used for representing the identity of the current block outlet node in the next block outlet round, the mortgage interest information represents the importance degree of the current block outlet node in the next block outlet round, and the target data represents the block outlet sequence of at least one current block outlet node in the next block outlet round.
In the process, the ring signature has the characteristics of unconditional concealment and non-counterfeitability, so that at least one block-out node of the next block-out round is concealed and selected by adopting the sorting algorithm based on the ring signature, namely, the corresponding block-out node in the target data is concealed and selected, the identity leakage of the block-out node corresponding to the public promise information is avoided, and thus, an adversary attack object can be effectively obscured, the self-adaptive attack can be effectively resisted, and the safety of a related consensus mechanism is improved. In addition, as the equity information characterizes the importance of the block-out nodes and the public promise information characterizes the identities of the block-out nodes, the block-out sequence of at least one current block-out node in the next block-out round is determined based on the mortgage equity information and the public promise information, on one hand, the rationality of the block-out sequence is ensured, and on the other hand, each block-out node can effectively identify the target bit corresponding to the block-out node in the block-out process, so that the bifurcation of a consensus mechanism is avoided.
Therefore, the scheme provided by the application achieves the aim of determining the block outlet sequence of at least one current block outlet node in the next block outlet round based on the ring signature, the public promise information and the mortgage rights and interests information, thereby realizing the technical effect of improving the safety of a formula mechanism and further solving the technical problem of low safety of a consensus mechanism caused by easy identification of block chain block outlet nodes in the prior art.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a schematic diagram of an alternative method of generating blockchain blocks in accordance with an embodiment of the present application;
FIG. 2 is a schematic diagram of an alternative blockchain in accordance with embodiments of the present application;
FIG. 3 is a schematic diagram of an alternative node in a blockchain in accordance with embodiments of the present application;
FIG. 4 is a schematic diagram of an alternative verified block node according to an embodiment of the application;
FIG. 5 is a flowchart of an alternative method of generating blocks in a blockchain in accordance with an embodiment of the present application;
FIG. 6 is a schematic diagram of an alternative apparatus for generating blocks in a blockchain in accordance with embodiments of the present application;
fig. 7 is a schematic diagram of an alternative electronic device according to an embodiment of the application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of description, the following will describe some terms or terminology involved in the embodiments of the present application:
harmless attack: in a blockchain network, when a highly consistent bifurcation occurs, a node can respectively perform block-out on two bifurcation in order to maintain the short-term benefit of the node, so that the situation that bifurcation chains exist in the blockchain network for a long time is caused, and the overall value of the bifurcation chains is reduced compared with the situation that no bifurcation exists between the bifurcation chains, and the phenomenon is called harmless attack.
Self-adaptive decay: under the high interest attraction, an adversary observes a certain blockchain for a long time and can estimate blockchain block outlet nodes with high probability, and before the block outlet nodes are used for discharging blocks, the block outlet behavior of the block outlet nodes is influenced by social engineering or technical means, so that attack is realized, and the phenomenon is called self-adaptive decomposition.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for presentation, analyzed data, etc.) related to the present disclosure are information and data authorized by the user or sufficiently authorized by each party.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a method of generating blockchain blocks, it being noted that the steps shown in the flowchart of the figures may be performed in a computer system, such as a set of computer executable instructions, and that, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order other than that shown or described herein.
FIG. 1 is a schematic diagram of an alternative method of generating blocks in a blockchain, as shown in FIG. 1, according to an embodiment of the invention, the method including the steps of:
Step S101, a target historical block is obtained, wherein the target historical block is a block with target historical data recorded in a block chain, the target historical data represents the block outlet sequence corresponding to each block outlet node in the current block outlet round, and the block outlet round represents the round that all the block outlet nodes finish one block outlet.
Optionally, as shown in fig. 2, the blockchain includes a blockout node and a common node, as shown in fig. 3, the blockout node and the common node are both provided with an account module and a storage module, wherein the account module can provide an account function for the node in the blockchain, a benefit quota is provided in the account, whether the node is the blockout node or the common node can be determined based on whether the node takes the benefit quota in the account as a mortgage and the benefit quota of the mortgage, and the storage module persists three parts of information, namely, blockout information (such as target historical data) on a block, public promise information of all blockout nodes in a certain blockout round of the whole blockchain, a ring signature and the like. In addition, the account module can provide a query interface which can be called by other nodes when the nodes in the blockchain become the block outlet nodes, so that the other nodes can determine whether the mortgage rights and interests information which is externally disclosed by the block outlet nodes is legal or not based on the query interface. And the round of block discharging characterizes that all reliable nodes for discharging blocks finish the round of once block discharging, namely, all nodes for discharging blocks in the public promise information sequencing list finish the round of once block discharging.
Wherein, as shown in FIG. 2, the block nodes are core nodes in the blockchain and are validation nodes in the blockchain. On one hand, the block-out node can execute the block-out operation, on the other hand, the block-out node can also receive the latest block broadcasted by other block-out nodes to verify and vote so as to determine whether the latest block is uplink. The common node is a participating node in the block chain, the common node has no right to output blocks and cannot vote on the latest block, but can accept the latest block from the verification node (namely the block outputting node) and verify the latest block, and if the verification is passed, the latest block is synchronized.
Further, the target history block is a block generated by the last block-out node in the previous round, and the target history data may be a public promise information sorting list generated by sorting the public promise information corresponding to the current round of each block-out node in the previous round. In the current block-out round, the block-out nodes in the block chain can perform block-out according to the above-mentioned public promise information sorting list, and when all the block-out nodes in the public promise information sorting list complete block-out, it is indicated that the current block-out round is finished, and the block-out of the next block-out round can be performed.
Step S102, determining public promise information and a ring signature corresponding to the public promise information based on the target history block, wherein the public promise information is used for representing the identity of the current block-out node in the next block-out round.
In step S102, as shown in fig. 4, the target history block may be calculated based on at least one algorithm of a hash algorithm, a public key cryptography signature algorithm, and the like, and a ring signature algorithm, so as to obtain public promise information and a ring signature corresponding to the public promise information, where in the present application, the ring signature may also be referred to as anonymous promise information, and the ring signature is used to verify the public promise information.
Optionally, in this embodiment, the public promise may be used to indirectly verify the validity of the identity of the current block-out node based on the public promise information ordered list, that is, whether the block-out node is turned to perform block-out, where the ring signature has unconditional secrecy and non-counterfeitability, and may be used to verify the reliability of the source of the ring signature, that is, verify whether the block-out node that generates the public promise information corresponding to the ring signature is a member in the ring, that is, verify whether the foregoing block-out node is authentic.
It should be noted that, by determining the public promise information and the ring signature, the subsequent generation of the target data can be facilitated.
Step S103, broadcasting public promise information, ring signature and mortgage interest information to last-bit block-out nodes in the current block-out round, so that the last-bit block-out nodes generate target data based on the public promise information, the ring signature and the mortgage interest information, wherein the mortgage interest information represents the importance degree of the current block-out nodes in the next block-out round, and the target data represents the block-out sequence of at least one current block-out node in the next block-out round.
Optionally, in this embodiment, a PoS consensus mechanism is adopted in the blockchain, as shown in fig. 3, a transceiver module is further provided in all nodes in the blockchain, where the transceiver module is configured to broadcast specific information, such as a blockout transaction, a ring signature, etc., to other nodes in the blockchain, and on the other hand, is also configured to accept and collect requests broadcast by other nodes and answer the requests. Specifically, based on the characteristics of the PoS consensus mechanism, after the current block-out node determines the public promise information and the ring signature, the current block-out node may broadcast the public promise information, the ring signature and the mortgage interest information to all the block-out nodes in the current block-out round based on the transceiver module, so that the last block-out node in the current block-out round obtains the public promise information, the ring signature and the mortgage interest information.
Further, before generating the target data, the last block-out node can verify the block-out node generating the public promise information based on the ring signature, and screen at least one block-out node for performing block-out in the next block-out round from all current block-out nodes based on the verification result, wherein the ring signature corresponding to the at least one block-out node for performing block-out in the next block-out round is a ring signature which is successfully verified, thereby ensuring the reliability of the block-out node in the next block-out round. Further, after determining the reliable block-out node based on the ring signature, the last block-out node may determine a block-out order in which the reliable block-out node performs the block-out in the next block-out round based on the public promise information of the reliable block-out node and the mortgage interest information, thereby generating the target data.
It should be noted that, since the last block-out node obtains the public promise information and also obtains the ring signature, the last block-out node can directly determine the reliability of the block node based on the ring signature without analyzing the public promise information or promise certificates, namely, adopting the sorting algorithm based on the ring signature to conceal and elect the block-out node of each block-out round, thereby avoiding the identity leakage of the block-out node corresponding to the public promise information, further avoiding the self-adaptive decomposition of the PoS mechanism, which is caused by the fact that the relevant identity information is mastered by an adversary before the block-out node leaves the block, thereby achieving the purposes of blurring the adversary attack object, effectively resisting the self-adaptive attack and improving the safety of the relevant consensus mechanism. In addition, since the block-out nodes corresponding to each ring signature or the public promise information are different, the block-out nodes in the next block-out round are determined based on the ring signature, and the public promise information corresponding to the block-out nodes is recorded in the target data, so that each block-out node can only block out once in each block-out round, and the problem that the Pos consensus mechanism or other consensus mechanisms are easy to have bifurcation due to unpredictable behavior of the block-out nodes and non-unique block-out nodes in the same time is avoided.
Step S104, determining the target rank of the current block-out node in the block-out sequence based on the target data to generate a target block at the target rank.
In step S104, the current block-out node may compare its own public promise information with the public promise information in the target data, so as to determine its own target rank based on whether the two are the same.
It should be noted that, because the target data includes the public promise information corresponding to each block-out node, and the public promise information corresponding to each block-out node is different, the target bit is determined based on the target data, so that each block-out node can effectively identify the target bit corresponding to itself, thereby ensuring that a unique block-out node always exists for block-out in the block-out process, and further avoiding the problem that the existing Pos consensus mechanism or other consensus mechanisms are easy to have bifurcation due to unpredictable behavior of the block-out node and non-unique block-out node in the same time.
Based on the scheme defined in the above steps S101 to S104, it may be known that, in the embodiment of the present invention, the method of determining the block-out order of the current at least one block-out node in the next block-out round based on the ring signature, the public promise information and the mortgage rights information is adopted, by acquiring the target history block, then determining the public promise information and the ring signature corresponding to the public promise information based on the target history block, and then broadcasting the public promise information, the ring signature and the mortgage rights information to the last block-out node in the current block-out round, so that the last block-out node generates the target data based on the public promise information, the ring signature and the mortgage rights information, thereby determining the target rank of the current block-out node in the block-out order based on the target data, and generating the target block at the target rank. The target historical block is a block in which target historical data is recorded in a block chain, the target historical data represents a block outlet sequence corresponding to each block outlet node in the current block outlet round, the block outlet round represents that all block outlet nodes finish one block outlet round, public promise information is used for representing the identity of the current block outlet node in the next block outlet round, the mortgage interest information represents the importance degree of the current block outlet node in the next block outlet round, and the target data represents the block outlet sequence of at least one current block outlet node in the next block outlet round.
It is easy to notice that in the above process, since the ring signature has the characteristics of unconditional secrecy and non-counterfeitability, at least one block-out node of the next block-out round is selected in a secrecy manner by adopting the sorting algorithm based on the ring signature, namely, the corresponding block-out node in the target data is selected in a secrecy manner, so that the identity leakage of the block-out node corresponding to the public promise information is avoided, thereby effectively blurring adversary attack objects, effectively resisting self-adaptive attack and improving the safety of a related consensus mechanism. In addition, as the equity information characterizes the importance of the block-out nodes and the public promise information characterizes the identities of the block-out nodes, the block-out sequence of at least one current block-out node in the next block-out round is determined based on the mortgage equity information and the public promise information, on one hand, the rationality of the block-out sequence is ensured, and on the other hand, each block-out node can effectively identify the target bit corresponding to the block-out node in the block-out process, so that the bifurcation of a consensus mechanism is avoided.
Therefore, the scheme provided by the application achieves the aim of determining the block outlet sequence of at least one current block outlet node in the next block outlet round based on the ring signature, the public promise information and the mortgage rights and interests information, thereby realizing the technical effect of improving the safety of a formula mechanism and further solving the technical problem of low safety of a consensus mechanism caused by easy identification of block chain block outlet nodes in the prior art.
In an alternative embodiment, in the initialization stage of the blockchain, that is, when the first round of block-out is not started in the blockchain yet, the block-out nodes existing in the blockchain may be determined, and the public promise information and the corresponding mortgage rights information of the block-out nodes are collected, so as to generate a public promise information ordered list about the block-out nodes in the first round of block-out, and an originating block is determined based on an instruction input by a user, and the generated public promise information ordered list is added into the originating block for uplink, so that each block-out node may acquire the public promise information list in the first round of block-out from the first round of block-out and output blocks according to the public promise information list. Further, in subsequent rounds, each block-out node may determine the block order and perform the block-out according to the methods described in the foregoing steps S101 to S104.
It should be emphasized that in the present application, the current block-out run is the same run, the next block-out run is the same run, and the next block-out run is the block-out run after the current block-out run.
In an alternative embodiment, as shown in fig. 3, a configuration module is further provided in all nodes in the blockchain, where the configuration module may determine a mortgage credit in the mortgage rights and interests information, and if the mortgage credit is greater than or equal to a preset value, the type of the update node is an out-block node, and if the mortgage credit is less than the preset value, the type of the update node is a normal node, where the normal node is a node that cannot generate a block.
Optionally, at the initial stage of the blockchain, each node is a common node by default, and a corresponding account is allocated. As shown in fig. 5, a user may set a right amount to be a mortgage of a block-out node through a configuration module in a node, execute a command to be the block-out node, when the configuration module obtains the command, the configuration module may determine the mortgage amount in the mortgage right information, then compare the mortgage amount with the mortgage amount based on a preset value, and update the type of the common node to be the block-out node if the mortgage amount is greater than or equal to the preset value; otherwise, in the subsequent process, the user can change the mortgage line of the block node, then the configuration module compares the new mortgage line with the preset value, and the type of the block node is updated to be a common node under the condition that the mortgage line is smaller than the preset value. The preset threshold value characterizes the right limit proportion of the mortgage required by the common node to be the block-out node. The configuration module is also used for configuring node related parameters such as user characteristic parameters (such as user ID and the like), technical parameters (such as common identification algorithm selection and the like) and the like in the block chain.
It should be noted that, by determining the node type based on the mortgage rights and interests, effective distinction between the block-out node and the common node is realized, so as to facilitate the consensus among the nodes.
In an alternative embodiment, in determining the public promise information and the ring signature corresponding to the public promise information based on the target history block, the current block-out node may sign the target history block based on a preset public key to obtain a promise credential, and then hash the promise credential to obtain the public promise information, thereby determining the ring signature based on the target history block and the public promise information.
Optionally, as shown in fig. 3 and fig. 4, a commitment module and a signature module are further disposed in all nodes in the blockchain. In the current block-out round, the current block-out node can determine the bit corresponding to the block-out node of the block to be blocked based on the public promise information ordered list, and when the current block-out node determines that the last block-out node is blocked out, the promise module in the current block-out node can call the signature module to sign the target historical block based on the public key cryptography signature algorithm to obtain a promise certificate, wherein the formula is as follows:
Cp=Sig(lastBlock)
where Cp represents the commitment credential, sig () represents the public key cryptographic signature algorithm, lastBlock represents the target history block.
Further, after determining the promise credential, the promise module may call the signature module to perform hash calculation on the promise credential to obtain public promise information, where the formula is as follows:
Comm=Hash(Cp)
where Comm represents public commitment information, hash () represents a Hash algorithm, and Cp represents commitment credentials.
Further, after determining the public promise information, the promise module may process the target history block and the public promise information based on a ring signature algorithm, thereby determining a ring signature.
It should be noted that, because the opponent easily deduces the identity of the block node corresponding to the promise credential based on the promise credential content, the public promise information is obtained based on hash calculation, so that the content of the promise credential can be effectively concealed, and further, the opponent is prevented from determining the identity of the block node. Thus, the self-adaptive attack can be effectively prevented, and the activity of a consensus mechanism is ensured.
In an alternative embodiment, in determining the ring signature based on the target history block and the public promise information, the current outbound node may obtain a target public key set, and determine a private key of the current outbound node, so as to determine the ring signature based on the target history block, the public promise information, the target public key set, and the private key, wherein the target public key set includes public keys of all outbound nodes in the current outbound round.
Alternatively, as shown in fig. 4, in the current outgoing block round, the target public key set is recorded as l=pk 1 ,pk 2 ,…,pk n Where n represents the total number of current block nodes. Specifically, the block-out node firstly performs hash calculation on the target history block, and the formula is as follows:
h 1 =Hash(lastBlock)
wherein h is 1 The Hash value corresponding to the target history block is represented, hash () represents the Hash algorithm, and lastBlock represents the target history block.
Then, hash calculation can be performed on hash values corresponding to the target public key set and the target history block, and the formula is as follows:
h=Hash(L||h 1 )
wherein h represents a first result, the first result represents a result obtained by carrying out hash calculation on a combination of hash values corresponding to the target public key set and the target history block, L represents the target public key set, and h 1 And representing the hash value corresponding to the target history block.
Further, the private key of the current block node may be determined, and the first result and the private key of the current block node may be calculated based on the commitment module, where the formula is as follows:
link=h sk
wherein link represents a commitment association, h represents a first result, sk represents a private key of a currently-exiting block node.
Further, the promise module may invoke the signature module to calculate the promise association, the target public key set and the public promise information by using a ring signature algorithm, where the formula is as follows:
AComm=RingSig(L,Comm,link)
Where AComm represents a ring signature, ringSig () represents a ring signature algorithm, L represents a target public key set, comm represents public promise information, and link represents promise association.
It should be noted that, the ring signature operation is performed on the public promise information to obtain the ring signature of the public promise information, so that when the target data is generated, the direct verification of the public promise information can be avoided, but the reliability of the block node is verified by verifying the ring signature, so that the identity of the block node can be hidden, and the security of the consensus mechanism is improved.
In an alternative embodiment, the last-bit out-block node is configured to verify the ring signature based on the target public key set, and generate the target data based on public promise information and mortgage rights and interests information corresponding to the successfully verified ring signature.
Optionally, as shown in fig. 3, all nodes in the blockchain are further provided with a signature verification module and a sorting module, where the signature verification module corresponds to a signature function of the signature module, provides a corresponding signature verification function for different signatures, can be used for verifying transaction or promise validity, and the sorting module is used for outputting a public promise information sorting list. Specifically, as shown in fig. 4, in the current block-out round, when the last block-out node is in the round, the block-out node may collect public promise information and ring signature broadcast by other block-out nodes based on the transceiver module, and verify the ring signature based on the signature verification module, where the formula is as follows:
IsVerified=RingVerify(L,AComm)
Where isverify represents the verification result, ringVerify () represents the signature verification algorithm corresponding to the ring signature algorithm, L represents the target public key set, AComm represents the ring signature.
Further, when the last block-out node determines that the ring signature verification is successful, the last block-out node marks the public promise information corresponding to the ring signature, and sorts all the public promise information corresponding to the ring signature which is successfully verified based on the sorting module, otherwise, when the last block-out node determines that the ring signature verification is failed, the block-out node corresponding to the ring signature is not sorted or the current round of block-out is cancelled. Specifically, the sorting module may determine the order of the block-out nodes based on the mortgage rights corresponding to the public promise information and other information, where, under the condition that other information is the same, the higher the mortgage credit limit corresponding to the mortgage rights, the higher the block-out order of the block-out nodes is. Further, after the ordering module determines the block-out sequence of each block-out node, the ordering module may record the block-out sequence number, the public promise information and the mortgage equity corresponding to each block-out node in the public promise information ordering list (i.e. the target data), so as to implement the characterization of the block-out sequence of each block-out node, and record the public promise information ordering list on the block generated by the last block-out node, thereby enabling all other block-out nodes in the block chain to acquire.
It should be noted that, by verifying the ring signature based on the target public key set, effective verification of the ring signature is achieved, so that reliable block-out nodes are conveniently screened out from all current block-out nodes, so that only reliable block-out nodes perform block-out in the next block-out round.
In an optional embodiment, in determining, based on the target data, a target rank of the current block-out node in the block-out sequence, so that in a process of generating the target block by the target rank, the current block-out node may acquire target public promise information corresponding to a block-out sequence number of the block-out node in the target data, and then compare the public promise information with the target public promise information, so as to determine, in a case that the public promise information is the same as the target public promise information, that the rank corresponding to the block-out sequence number of the block-out node is the target rank, and determine that the block-out node is the current block-out node. The target data at least comprises target public promise information, target mortgage interest information and a block sequence number corresponding to each block outlet node in the current at least one block outlet node.
Optionally, as shown in fig. 5, in the next block-out round, the current block-out node may determine the block-out sequence number of the block-out node from the open promise information ordered list generated in the current block-out round, and select the target open promise information Comm corresponding to the block-out sequence number of the block-out node block Then the public promise information Comm for representing the identity of the next block-out round of the self prev Comparing with the target public promise information, and determining the target public promise information Comm when the current block-out node block Commission Comm prev And when the current block outlet node is determined to be the block outlet node of the block to be discharged, otherwise, waiting for other block outlet nodes to discharge blocks, and comparing the next block outlet sequence number with target public promise information corresponding to the next block outlet sequence number, thereby realizing the determination of the self block outlet bit number and generating a target block at the target bit number.
It should be noted that, the target rank is determined by comparing the self-published promise information with the target published promise information, so that the leakage of the identity information of the node of the outgoing block before the outgoing block is avoided, and the security of the consensus mechanism and the blockchain is improved.
In an alternative embodiment, after determining the target rank of the current outbound block node in the outbound block sequence based on the target data, the current outbound block node may generate a transaction message based on the target block, the promise credential, and the outbound block sequence number of the current outbound block node, and then broadcast the transaction message to other outbound block nodes to enable the other outbound block nodes to verify the transaction message, thereby broadcasting a voting message to the other outbound block nodes if all verification results indicate that the rank of the current outbound block node is the target rank. And the other block-out nodes are nodes except the current block-out node in all the current block-out nodes.
Optionally, as shown in fig. 3 and fig. 5, all nodes in the blockchain are further provided with a transaction assembling module and a transaction verification module, where the transaction assembling module is configured to collect corresponding data and assemble and send a message according to a specific data structure before broadcasting related information to the outside, and the transaction verification module is configured to provide a verification means for validity of a transaction when the nodes in the blockchain receive other transaction information. In this embodiment, the verification means may be a comparison by means of a hash algorithm, or may be a verification by calling a signature verification module. Specifically, in the next block-out round, when the current block-out node determines that the current block-out node takes the round of self block-out, the current block-out node may collect the transaction recently submitted to the blockchain, package the transaction into a target block, assemble the target block, the promise certificate determined by the current block-out round and the block-out sequence number in the public promise information ordered list generated by the current block-out round into a transaction message based on the transaction assembling module, and then broadcast the transaction message to other block-out nodes in the next block-out round based on the transceiver module.
Further, as shown in fig. 4, when other block-out nodes in the blockchain receive the transaction message broadcasted by the current block-out node, the other block-out nodes can acquire the promise certificate and the block-out serial number in the transaction message, and acquire the public promise information to be verified corresponding to the block-out serial number from the public promise information ordered list (i.e. the target data) generated by the current block-out round, so as to invoke the transaction verification module to verify based on the following formula:
IsVerified=Hash(Cp)==Comm
Wherein IsVerified characterizes the verification result, has () characterizes a hash algorithm, cp characterizes the promise credential, and Comm characterizes the public promise information. Specifically, the verification result is used for representing whether the bit of the current block-out node is the target bit, so that verification of the validity of the transaction message is realized. It should be noted that, the ordinary node in the blockchain has no authority to verify the transaction message about the target block, and only receive the transaction message.
Further, in the case that all verification results indicate that the rank of the current outbound block node is the target rank, that is, in the case that all outbound block nodes in other outbound block nodes acknowledge the validity of the transaction message, the current outbound block node may broadcast a voting message to other outbound block nodes. Otherwise, when the verification result indicates that the bit of the current output block node is not the target bit, the output block of the round can be canceled, and the calculation of the target data can be restarted.
It should be noted that, other block-out nodes verify the transaction message generated by the current block-out node, so as to avoid the condition that illegal block uplink exists in the subsequent uplink process, thereby ensuring the security and authenticity of the block chain data.
In an alternative embodiment, the current outbound node may sign the target block to obtain a target signature before broadcasting the voting message to other outbound nodes, thereby generating the voting message based on the target signature, the target block, and the public promise information.
Optionally, in the next block-out round, after all verification results indicate that the bit of the current block-out node is the target bit, the current block-out node may sign the target block by using a ring signature based on the signature module to obtain a target signature, and the current block-out node may sign the target block by using a public key cryptography signature based on the signature module to obtain the target signature. And then, the current block-out node can assemble the target signature, the target block and the public promise information representing the identity of the block-out node in the current round into a voting message based on the transaction assembling module, and broadcast the voting message to other block-out nodes so that the other block-out nodes vote on the target block.
It should be noted that, by generating the voting message based on the target signature, the validity of the voting message is verified by other block-out nodes.
In an alternative embodiment, the other out-block nodes include a first out-block node and at least one second out-block node; the first block-out node is used for verifying the voting message, generating a response message under the condition that the verification result corresponding to the voting message indicates that the identity of the current block-out node is the target identity, and acquiring the response message broadcasted by at least one second block-out node, wherein the response message at least comprises public promise information corresponding to the block-out node generating the response message, and the response message can indicate the voting result.
Optionally, as shown in fig. 5, in the next block-out round, when the first block-out node and at least one second block-out node in the other block-out nodes receive the voting message broadcast by the current block-out node, the first block-out node and at least one second block-out node may acquire the target signature in the voting message, and verify the target signature based on the previous verification method of the ring signature, which is not described herein again.
Further, after the first outbound block node and the at least one second outbound block node successfully verify the target signature, the first outbound block node and the at least one second outbound block node may generate a response message including public promise information, where the public promise information is public promise information generated in the current round. And then the first block outlet node sends the generated response message to at least one second block outlet node, and collects the response message generated by at least one second block outlet node.
It should be noted that, the first outbound node obtains the response message generated by at least one second outbound node, so as to be used for accurately judging whether the target block is uplink or not in the subsequent implementation.
In an optional embodiment, the first output block node is further configured to determine, based on the target historical data, target historical mortgage rights information of the output block node corresponding to each response packet, and determine whether to perform uplink processing on the target block based on the target historical mortgage rights information.
Optionally, as shown in fig. 3 and fig. 5, in the next output round, the first output node may obtain the public promise information in the response message, and obtain, based on the public promise information, the mortgage benefit information corresponding to the public promise information from the public promise information ordered list generated in the previous output round, that is, determine the target historical mortgage benefit information of the output node corresponding to each response message. Then, the first block-out node can perform hash calculation on the target block to obtain a hash value of the target block, and send the hash value of the target block and the target historical mortgage interest information into a statistics module, wherein the statistics module can count the sum of the mortgage interests of all the block-out nodes, and can also count the sum of all the block-out nodes voting for a certain block-out node when judging the legitimacy of the block-out node. And in the preset time, when the statistics module judges that the mortgage limit in the target historical mortgage rights information of the hash value of the target block exceeds 2/3 of the mortgage limit in the mortgage rights information of all current output block nodes in the current output block round, the target block can be subjected to uplink processing.
Optionally, the common node may also obtain a voting message, and may perform statistics on the voting condition of the target block according to the foregoing method based on the statistics module, so as to determine whether to perform uplink processing on the target block.
It should be noted that, in the present application, under the consensus mechanism, especially under the PoS consensus mechanism, anonymous public promise information is constructed by using a ring signature, and each block-out node obtains a public promise information sorting list about all the block-out nodes on the premise of not revealing respective promise credentials, so that the block node can be determined according to the current block-out round and the public promise information sorting list. On one hand, only unique block-out nodes exist in the block-out process of each block-out round at the same time, and on the other hand, anonymous public promise information can hide the identity of the block-out nodes before the block-out nodes block-out, so that the activity of the whole blockchain is guaranteed. Therefore, the problem that a block chain consensus mechanism is easy to diverge is solved, and the safety of the block chain consensus mechanism against self-adaptive decay is improved.
Therefore, the scheme provided by the application achieves the aim of determining the block outlet sequence of at least one current block outlet node in the next block outlet round based on the ring signature, the public promise information and the mortgage rights and interests information, thereby realizing the technical effect of improving the safety of a formula mechanism and further solving the technical problem of low safety of a consensus mechanism caused by easy identification of block chain block outlet nodes in the prior art.
Example 2
In accordance with an embodiment of the present invention, there is provided an embodiment of a method of generating blocks in a blockchain, wherein FIG. 6 is a schematic diagram of an alternative apparatus for generating blocks in a blockchain, as shown in FIG. 6, including:
the obtaining module 601 is configured to obtain a target history block, where the target history block is a block in which target history data is recorded in a blockchain, the target history data represents a block outlet sequence corresponding to each block outlet node in a current block outlet round, and the block outlet round represents a round in which all block outlet nodes complete one block outlet;
a determining module 602, configured to determine, based on the target history block, public promise information and a ring signature corresponding to the public promise information, where the public promise information is used to characterize an identity of a current block-out node in a next block-out round;
a processing module 603, configured to broadcast public promise information, a ring signature, and a mortgage interest information to a last block-out node in a current block-out round, so that the last block-out node generates target data based on the public promise information, the ring signature, and the mortgage interest information, where the mortgage interest information characterizes an importance degree of the current block-out node in a next block-out round, and the target data characterizes a block-out sequence of the current at least one block-out node in the next block-out round;
A generating module 604, configured to determine a target rank of the current outbound block node in the outbound order based on the target data, so as to generate a target block at the target rank.
It should be noted that the above-mentioned obtaining module 601, determining module 602, processing module 603, and generating module 604 correspond to steps S101 to S104 in the above-mentioned embodiment, and the four modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to those disclosed in the above-mentioned embodiment 1.
Optionally, the determining module further includes: the first signature module is used for signing the target history block based on a preset public key to obtain a promised certificate; the calculation module is used for carrying out hash calculation on the promise certificate to obtain public promise information; and the first sub-determining module is used for determining the ring signature based on the target history block and the public promise information.
Optionally, the first sub-determining module further includes: the first sub-acquisition module is used for acquiring a target public key set, wherein the target public key set comprises public keys of all block-out nodes in the current block-out round; the second sub-determining module is used for determining the private key of the current block-out node; and the third sub-determining module is used for determining the ring signature based on the target history block, the public promise information, the target public key set and the private key.
Optionally, the last-bit block-out node is configured to verify the ring signature based on the target public key set, and generate target data based on public promise information and mortgage rights and interests information corresponding to the successfully verified ring signature.
Optionally, the target data at least includes target public promise information, target mortgage interest information and a block sequence number corresponding to each block node in the current at least one block node, where the generating module includes: the second sub-acquisition module is used for acquiring target public promise information corresponding to the block outlet serial number of the block outlet node in the target data; the comparison module is used for comparing the public promise information with the target public promise information; and the fourth sub-determining module is used for determining that the bit corresponding to the block outlet sequence number of the block outlet node to be taken as the target bit and determining that the block outlet node to be taken as the current block outlet node under the condition that the public promise information is the same as the target public promise information.
Optionally, the method of generating the blockout region further comprises: the first sub-generation module is used for generating a transaction message based on the target block, the promise certificate and the block-out serial number of the current block-out node; the first sub-processing module is used for broadcasting the transaction message to other block-out nodes so that the other block-out nodes verify the transaction message, wherein the other block-out nodes are nodes except the current block-out node in all current block-out nodes; and the second sub-processing module is used for broadcasting voting messages to other block-out nodes under the condition that all verification results show that the bit of the current block-out node is the target bit.
Optionally, the method of generating the blockout region further comprises: the second signature module is used for signing the target block to obtain a target signature; and the second sub-generation module is used for generating a voting message based on the target signature, the target block and the public promise information.
Optionally, the other block-out nodes include a first block-out node and at least one second block-out node; the first block-out node is used for verifying the voting message, generating a response message under the condition that the verification result corresponding to the voting message indicates that the identity of the current block-out node is the target identity, and acquiring the response message broadcasted by at least one second block-out node, wherein the response message at least comprises public promise information corresponding to the block-out node for generating the response message.
Optionally, the first output block node is further configured to determine target historical mortgage rights information of the output block node corresponding to each response packet based on the target historical data, and determine whether to perform uplink processing on the target block based on the target historical mortgage rights information.
Optionally, the apparatus for generating blocks in a blockchain further includes: a fifth sub-determining module, configured to determine a mortgage credit in the mortgage rights and interests information; the first updating module is used for updating the type of the node to be a block-out node under the condition that the mortgage limit is larger than or equal to a preset value; and the second updating module is used for updating the common node which is a node incapable of generating the block under the condition that the mortgage limit is smaller than the preset value.
Example 3
According to another aspect of embodiments of the present invention, there is also provided a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the above-described method of generating blocks in a blockchain when run.
Example 4
According to another aspect of an embodiment of the present invention, there is also provided an electronic device, wherein fig. 7 is a schematic diagram of an alternative electronic device according to an embodiment of the present invention, as shown in fig. 7, the electronic device including one or more processors; and a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for running the programs, wherein the programs are configured to perform the method of generating blocks in a blockchain described above when run.
Example 5
According to another aspect of embodiments of the present invention, there is also provided a computer program product comprising a computer program/instruction which, when executed by a processor, implements the method of generating blocks in a blockchain described above.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of units may be a logic function division, and there may be another division manner in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method of the various embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.
Claims (13)
1. A method of generating blocks in a blockchain, comprising:
obtaining a target historical block, wherein the target historical block is a block in which target historical data is recorded in a block chain, the target historical data represents a block outlet sequence corresponding to each block outlet node in a current block outlet round, and the block outlet round represents a round that all block outlet nodes finish one block outlet;
determining public promise information and a ring signature corresponding to the public promise information based on the target history block, wherein the public promise information is used for representing the identity of a current block-out node in the next block-out round;
broadcasting the public promise information, the ring signature and the mortgage interest information to last-bit block-out nodes in a current block-out round so that the last-bit block-out nodes generate target data based on the public promise information, the ring signature and the mortgage interest information, wherein the mortgage interest information characterizes the importance degree of the current block-out nodes in a next block-out round, and the target data characterizes the block-out sequence of at least one current block-out node in the next block-out round;
And determining a target rank of the current block-out node in the block-out sequence based on the target data so as to generate a target block at the target rank.
2. The method of claim 1, wherein determining public promise information and a ring signature corresponding to the public promise information based on the target history block comprises:
signing the target history block based on a preset public key to obtain a promised certificate;
carrying out hash calculation on the promise certificate to obtain the public promise information;
the ring signature is determined based on the target history block, the public commitment information.
3. The method of claim 2, wherein determining the ring signature based on the target history block, the public commitment information, comprises:
obtaining a target public key set, wherein the target public key set comprises public keys of all block-out nodes in the current block-out round;
determining a private key of the current block node;
the ring signature is determined based on the target history block, the public commitment information, the target public key set, and the private key.
4. The method of claim 3, wherein the step of,
The last-bit block-out node is used for verifying the ring signature based on the target public key set, and generating the target data based on public promise information and mortgage rights and interests information corresponding to the successfully verified ring signature.
5. The method of claim 2, wherein the target data includes at least target public commitment information, target mortgage interest information, and a chunk sequence number corresponding to each chunk node in the current at least one chunk node, wherein determining a target rank of the current chunk node in the chunk sequence based on the target data to generate a target chunk at the target rank comprises:
acquiring target public promise information corresponding to a block outlet serial number of a node to be block outlet in the target data;
comparing the public promise information with the target public promise information;
and under the condition that the public promise information is the same as the target public promise information, determining that the bit corresponding to the block outlet serial number of the block outlet node is the target bit, and determining that the block outlet node is the current block outlet node.
6. The method of claim 5, wherein after determining a target rank of the current outbound block node in the outbound order based on the target data, the method further comprises:
Generating a transaction message based on the target block, the promise certificate and the block-out serial number of the current block-out node;
broadcasting the transaction message to other block-out nodes so that the other block-out nodes verify the transaction message, wherein the other block-out nodes are nodes except the current block-out node in all current block-out nodes;
and broadcasting voting messages to other block-out nodes under the condition that all verification results represent that the bit of the current block-out node is the target bit.
7. The method of claim 6, wherein prior to broadcasting the voting message to the other out-of-block nodes, the method further comprises:
signing the target block to obtain a target signature;
and generating the voting message based on the target signature, the target block and the public promise information.
8. The method of claim 7, wherein the step of determining the position of the probe is performed,
the other block-out nodes comprise a first block-out node and at least one second block-out node; the first block-out node is used for verifying the voting message, generating a response message under the condition that the verification result corresponding to the voting message represents that the identity of the current block-out node is the target identity, and acquiring the response message broadcasted by the at least one second block-out node, wherein the response message at least comprises public promise information corresponding to the block-out node generating the response message.
9. The method of claim 8, wherein the step of determining the position of the first electrode is performed,
the first block outlet node is further configured to determine target historical mortgage rights information of a block outlet node corresponding to each response message based on the target historical data, and determine whether to perform uplink processing on the target block based on the target historical mortgage rights information.
10. The method according to claim 1, wherein the method further comprises:
determining a mortgage limit in the mortgage rights and interests information;
under the condition that the mortgage limit is larger than or equal to a preset value, updating the type of the node to be the block-out node;
and under the condition that the mortgage limit is smaller than the preset value, the type of the updated node is a common node, wherein the common node is a node which cannot generate a block.
11. An apparatus for generating blocks in a blockchain, comprising:
the system comprises an acquisition module, a block generation module and a block generation module, wherein the acquisition module is used for acquiring a target historical block, the target historical block is a block in which target historical data is recorded in a block chain, the target historical data represents a block generation sequence corresponding to each block generation node in the current block generation turn, and the block generation turn represents a turn that all block generation nodes finish one block generation;
The determining module is used for determining public promise information and a ring signature corresponding to the public promise information based on the target historical block, wherein the public promise information is used for representing the identity of a current block-out node in the next block-out round;
the processing module is used for broadcasting the public promise information, the ring signature and the mortgage interest information to last block outlet nodes in a current block outlet round so that the last block outlet nodes generate target data based on the public promise information, the ring signature and the mortgage interest information, wherein the mortgage interest information represents the importance degree of the current block outlet nodes in the next block outlet round, and the target data represents the block outlet sequence of at least one current block outlet node in the next block outlet round;
and the generation module is used for determining the target rank of the current block-out node in the block-out sequence based on the target data so as to generate a target block at the target rank.
12. A computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the method of generating blocks in a blockchain of any of claims 1 to 10 when run.
13. An electronic device, the electronic device comprising one or more processors; a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement a method for running a program, wherein the program is configured to perform the method of generating blocks in a blockchain of any of claims 1 to 10 when run.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210336000.3A CN114650145B (en) | 2022-03-31 | 2022-03-31 | Method and device for generating blocks in block chain and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210336000.3A CN114650145B (en) | 2022-03-31 | 2022-03-31 | Method and device for generating blocks in block chain and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114650145A CN114650145A (en) | 2022-06-21 |
CN114650145B true CN114650145B (en) | 2023-12-05 |
Family
ID=81996310
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210336000.3A Active CN114650145B (en) | 2022-03-31 | 2022-03-31 | Method and device for generating blocks in block chain and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114650145B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109785130A (en) * | 2018-12-17 | 2019-05-21 | 金蝶软件(中国)有限公司 | Block chain is known together method, apparatus, computer equipment and storage medium at random |
CN111930845A (en) * | 2020-08-12 | 2020-11-13 | 湖南宸瀚信息科技有限责任公司 | Block chain consensus method, system, terminal and storage medium |
CN112907369A (en) * | 2021-02-08 | 2021-06-04 | 网易(杭州)网络有限公司 | Block chain-based data consensus method and device, electronic equipment and storage medium |
WO2021233049A1 (en) * | 2020-05-20 | 2021-11-25 | 腾讯科技(深圳)有限公司 | Blockchain–based data processing method, apparatus, device, and readable storage medium |
-
2022
- 2022-03-31 CN CN202210336000.3A patent/CN114650145B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109785130A (en) * | 2018-12-17 | 2019-05-21 | 金蝶软件(中国)有限公司 | Block chain is known together method, apparatus, computer equipment and storage medium at random |
WO2021233049A1 (en) * | 2020-05-20 | 2021-11-25 | 腾讯科技(深圳)有限公司 | Blockchain–based data processing method, apparatus, device, and readable storage medium |
CN111930845A (en) * | 2020-08-12 | 2020-11-13 | 湖南宸瀚信息科技有限责任公司 | Block chain consensus method, system, terminal and storage medium |
CN112907369A (en) * | 2021-02-08 | 2021-06-04 | 网易(杭州)网络有限公司 | Block chain-based data consensus method and device, electronic equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
基于拜占庭容错的联盟链共识算法研究;孙海峰;《中国优秀硕士学位论文全文数据库 信息科技辑》(第第3期期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN114650145A (en) | 2022-06-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Iqbal et al. | Exploring sybil and double-spending risks in blockchain systems | |
CN109543075B (en) | Block generation method and system | |
Nguyen et al. | A survey about consensus algorithms used in blockchain. | |
US20200349054A1 (en) | Sidechain testing system for improving security and stability of smart contract | |
CN109034813B (en) | Representative node device election method and device, computer device and storage medium | |
CN109889382B (en) | Domain name information maintenance system based on block chain hybrid consensus | |
CN112437049B (en) | BFT-based block chain consensus method and device | |
CN109359978B (en) | Intelligent contract trading method and system based on block chain network | |
CN109447799B (en) | Intelligent contract trading method and system based on block chain network | |
CN110505217B (en) | Position privacy protection method based on game theory and block chain fusion | |
CN113014635A (en) | Node type division method and device of block chain system and block chain system | |
US20210374731A1 (en) | Systems and methods for consensus-based access control for smart contract functions | |
Jeon et al. | RMBC: Randomized mesh blockchain using DBFT consensus algorithm | |
CN111489143A (en) | Auditable encrypted digital currency supervision method based on alliance side chain | |
CN111970121A (en) | Voting method based on block chain technology | |
CN110933088B (en) | Decentralization verifiable hiding representing method and system based on block chain | |
Zhang et al. | Privacy-preserving reputation management for blockchain-based mobile crowdsensing | |
CN111865595A (en) | Block chain consensus method and device | |
CN114650145B (en) | Method and device for generating blocks in block chain and electronic equipment | |
CN112685750A (en) | Data processing method and device | |
CN109409899B (en) | Transaction verification method, device and system | |
CN112422534B (en) | Credit evaluation method and equipment for electronic certificate | |
KR102366638B1 (en) | Game client Proof of Attendance-based blockchain system and the block compensation consensus method using thereof | |
Katal et al. | Blockchain consensus algorithms: study and challenges | |
Shao et al. | Auditable Blockchain Rewriting in Permissioned Setting With Mandatory Revocability for IoT |
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 |