CN111147242A - Block generation method and device, electronic equipment and storage medium - Google Patents

Block generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111147242A
CN111147242A CN201911421045.5A CN201911421045A CN111147242A CN 111147242 A CN111147242 A CN 111147242A CN 201911421045 A CN201911421045 A CN 201911421045A CN 111147242 A CN111147242 A CN 111147242A
Authority
CN
China
Prior art keywords
block generation
random number
block
evidence
generation node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911421045.5A
Other languages
Chinese (zh)
Other versions
CN111147242B (en
Inventor
孙君意
肖伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201911421045.5A priority Critical patent/CN111147242B/en
Publication of CN111147242A publication Critical patent/CN111147242A/en
Application granted granted Critical
Publication of CN111147242B publication Critical patent/CN111147242B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a block generation method and device, electronic equipment and a storage medium, and relates to a block chain technology. Wherein, the method comprises the following steps: if block-out overtime of the block chain network is detected, generating a random number and evidence; sending random numbers and evidence to other candidate block generating nodes in the block chain network; verifying the random numbers and the evidences received from the other candidate block generation nodes, and filtering out the random numbers which fail to be verified; and selecting a target random number from the remaining random numbers, and using candidate block generation node information for generating the target random number as next block generation node information. According to the method and the device, the block generation node is determined in a random drawing mode without depending on clock synchronization of the block chain node, and the risk that the block chain network is attacked is reduced.

Description

Block generation method and device, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to computer technologies, in particular to a block chain technology, and in particular to a block generation method and apparatus, an electronic device, and a storage medium.
Background
The delegation of rights certification (DPOS) is a popular block chain consensus algorithm, and the basic flow is to select N super nodes by voting, and then the super nodes round off the flow of blocks.
However, since the tenure of each super node is generally divided according to time slices, the dependence on clock synchronization and network status is high, and when the clocks are not synchronized or the network has delay, a fork is easy to occur in the block generation process.
Disclosure of Invention
The embodiment of the application discloses a block generation method, a block generation device, electronic equipment and a storage medium, wherein on the basis of not depending on clock synchronization of block chain nodes, the block generation nodes are determined in a random drawing mode, so that the risk of attacking a block chain network is reduced, and the bifurcation phenomenon in the block generation process is avoided.
In a first aspect, an embodiment of the present application discloses a block generation method, which is performed by a candidate block generation node in a blockchain network, and the method includes:
if the block-out overtime of the block chain network is detected, generating a random number and evidence;
sending the random number and the evidence to other candidate block generating nodes in the block chain network;
verifying the random numbers and the evidences received from the other candidate block generation nodes, and filtering out the random numbers which fail to be verified;
and selecting a target random number from the remaining random numbers, and using candidate block generation node information for generating the target random number as next block generation node information.
Optionally, the selecting a target random number from the remaining random numbers includes:
and sequencing the rest random numbers, and selecting the random number with a fixed sequence number as the target random number.
Optionally, using the candidate block generation node information for generating the target random number as next block generation node information, includes:
sending target candidate block generation node information associated with the target random number to the other candidate block generation nodes;
selecting next block generation node information from the target candidate block generation node information and target candidate block generation node information received from the other candidate block generation nodes.
One embodiment in the above application has the following advantages or benefits: because the generation of the random numbers in each candidate block generation node has randomness and unpredictability, the fairness of determining the block generation nodes in a random drawing mode is ensured, the risk of malicious attack on a block chain network is reduced, and the clock synchronization of the block chain nodes is not required to be relied on in the block generation node determination process.
Optionally, the method further includes:
determining a time length value between the current time and the block-out time of the current block;
and if the time length value is greater than a time length threshold value, determining that the block-out timeout of the block chain network is detected.
Optionally, the generating the random number and the evidence includes:
the random number and evidence are generated based on a verifiable random number algorithm from the current tile ID, the next tile height, and the local key.
One embodiment in the above application has the following advantages or benefits: by using the verifiable random number algorithm, the verifiable random number and the evidence are simultaneously output for the generation node of any candidate block, and the reliability of the random number is improved.
Optionally, the checking the random numbers and the evidence received from the other candidate block generation nodes includes:
verifying evidence received from the other candidate patch generating nodes according to the current patch ID, the next patch height and keys of the other candidate patch generating nodes;
and if the evidence passes the verification, verifying the random numbers received from the other candidate block generation nodes according to the evidence received from the other candidate block generation nodes.
One embodiment in the above application has the following advantages or benefits: by checking the random number and the evidence, the safety of the block chain network and the fairness among different candidate block generation nodes are ensured.
Optionally, the selecting a target random number from the remaining random numbers includes:
and when detecting that the proportion value of the number of the received random numbers to the total number of the candidate block generation nodes in the block chain network is greater than a proportion threshold value, executing the target random number selection operation.
One embodiment in the above application has the following advantages or benefits: through setting of the proportion threshold value, reasonable verification of block overtime of the current block chain network is achieved.
Optionally, selecting next block generation node information from the target candidate block generation node information and the target candidate block generation node information received from the other candidate block generation nodes, includes:
and using the target candidate block generation node information and the target candidate block generation node information received from the other candidate block generation nodes, the target candidate block generation node information having the largest number of times of reception, as the next block generation node information.
One embodiment in the above application has the following advantages or benefits: by combining the random thought and the statistical thought, the safety and the fairness of the next block generation node are ensured.
In a second aspect, an embodiment of the present application further discloses a block generation apparatus configured at a candidate block generation node in a blockchain network, where the apparatus includes:
a random number and evidence generation module, configured to generate a random number and an evidence if it is detected that the block out of the block chain network is overtime;
a random number and evidence sending module, configured to send the random number and the evidence to other candidate block generation nodes in the block chain network;
the random number and evidence checking module is used for checking the random numbers and the evidence received from the other candidate block generating nodes and filtering out the random numbers which fail to check;
a node information sending module, configured to select a target random number from the remaining random numbers, and send target candidate block generation node information associated with the target random number to the other candidate block generation nodes;
and a node information selection module, configured to generate node information from the target candidate block, and select next block generation node information from the target candidate block generation node information received from the other candidate block generation nodes.
Optionally, the apparatus further comprises:
the time length determining module is used for determining a time length value between the current time and the block output time of the current block;
and the block-out overtime determining module is used for determining that the block-out overtime of the block chain network is detected if the time length value is greater than a time length threshold.
In a third aspect, an embodiment of the present application further discloses an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a block generation method according to any of the embodiments of the present application.
In a fourth aspect, this application further discloses a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the block generation method according to any one of the embodiments of the application.
According to the technical scheme of the embodiment of the application, when the block chain network is overtime, firstly, the verifiable random numbers and evidences are generated through the generation nodes of the candidate blocks, the random numbers and the evidences are exchanged, and the consistency of the random numbers among the generation nodes of the different candidate blocks is kept; then, a target random number is selected by each candidate block generation node, and candidate block generation node information for generating the target random number is determined as next block generation node information. Because the generation of the random number in each candidate block generation node has randomness, the fairness of determining the block generation node in a random drawing mode is ensured, and the unpredictability of the random number generation ensures that the next block generation node is unpredictable, thereby reducing the risk of malicious attack on the block chain network. Meanwhile, the scheme of the embodiment does not depend on clock synchronization among the nodes of the block chain, is beneficial to global deployment, has low deployment cost, and can avoid the phenomenon of block chain bifurcation easily caused by network delay when nodes are handed out by depending on clock synchronization; in the process of generating a new block, the scheme of the embodiment does not need most of block chain link points in the block chain network to perform multiple rounds of signature on the block, so that the block generation efficiency is improved. Other effects of the above-described alternative will be described below with reference to specific embodiments.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
fig. 1 is a flowchart of a block generation method disclosed according to an embodiment of the present application;
fig. 2 is a flowchart of another block generation method disclosed in an embodiment of the present application;
FIG. 3 is a schematic diagram of a random number and evidence generation method disclosed in accordance with an embodiment of the present application;
fig. 4 is a schematic structural diagram of a block generation apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of an electronic device disclosed according to an embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a flowchart of a method for generating a tile according to an embodiment of the present disclosure, which may be applied to a situation where a blockchain network exhibits a block timeout, and a tile generation node for generating a next tile is effectively determined. The method of this embodiment may be performed by a block generation apparatus, which may be implemented in software and/or hardware, and may be configured in a candidate block generation node in a blockchain network. The candidate block generation node refers to any node, such as a super node, in the block chain network, which has a block output capability. The candidate tile generation node may be deployed on any electronic device capable of carrying the blockchain node.
As shown in fig. 1, the block generating method disclosed in this embodiment may include:
s101, if the block-out overtime of the block chain network is detected, generating a random number and evidence.
In this embodiment, any candidate block generation node in the blockchain network may determine whether a new block is received within a set block-out time period, for example, 3 seconds, and detect whether a block timeout occurs in the current blockchain network, where if a new block is received within the set block-out time period, it indicates that the current blockchain network has not timed out; if no new block is received in the set block-out time period, the time-out of the current block chain network is indicated. Optionally, determining that the timeout occurs in the current blockchain network may include: determining a time length value between the current time and the block-out time of the current block, namely a time interval; if the time length value is greater than the time length threshold span, it is determined that the block exit timeout of the block chain network is detected, where the time length threshold may be adaptively set according to a block exit time period, and this embodiment is not particularly limited. For example, when the time when any candidate block generation node receives a block with the current block height H-1 is T, and when the local clock reaches T + span, a new block with the block height H is still not received, it may be determined that the block out time of the blockchain network is exceeded, and H may be any positive integer.
When any candidate block generation node detects that the block chain network is out of the block overtime, a random number and corresponding evidence information can be generated. The random number may be used for the candidate block generation node to perform a lottery to compete for the right to generate the next block, and the evidence may be used for other candidate block generation nodes to perform validity check on the corresponding random number. The method for generating the random number and the evidence in each candidate block generation node is the same, and the utilization of the method is agreed in advance. The generation method of the Random number and the evidence is not specifically limited in this embodiment, and may be implemented by any available method in the prior art, such as a Verifiable Random number algorithm (VRF).
And S102, sending the random number and the evidence to other candidate block generating nodes in the block chain network.
That is, after any candidate block generation node generates its own random number and evidence, it needs to transmit the random number and the evidence to the blockchain network, and the transmission mode may be broadcast, so as to implement random number exchange between different candidate block generation nodes.
S103, checking the random numbers and the evidences received from the other candidate block generation nodes, and filtering out the random numbers which fail to be checked.
In order to ensure the security of the block chain network and the fairness among different candidate block generation nodes, after any candidate block generation node obtains the random numbers and evidences of other candidate block generation nodes, validity check needs to be performed, the random numbers passing the check can participate in the subsequent target random number selection process, and the random numbers failing the check are filtered. In the process of verifying the random numbers and the evidence, as long as any one party fails to verify, the corresponding random numbers belong to the random numbers which fail to verify and need to be filtered. The verification of the random number can be realized by verifying whether the random number conforms to the agreed format, whether the source of the random number is trusted, and the like, and similarly, the verification of the evidence can also be realized by verifying whether the evidence conforms to the agreed format, whether the source of the evidence is trusted, whether the evidence contains the pre-agreed node information, and the like. On the basis of ensuring that each candidate block generation node can effectively check the validity of the acquired random number and evidence, the present embodiment does not limit the specific checking method. And after the evidence is verified to be legal, the validity of the corresponding random number can be verified by using the evidence.
And S104, selecting a target random number from the rest random numbers, and taking candidate block generation node information for generating the target random number as next block generation node information.
If the random number which fails to be verified exists, after the random number is filtered, any candidate block generation node may select a target random number based on the random number which succeeds in verification and the random number generated by itself, that is, the remaining random numbers. The target random number may be determined according to a preset random number selection policy, which is not specifically limited in this embodiment, for example, the target random number may be a maximum value or an intermediate value among the remaining random numbers, or may be a value selected according to a sequence number after sorting the remaining random numbers, for example, sorting the remaining random numbers, and selecting a random number with a fixed sequence number as the target random number, where the fixed sequence number may be a predetermined value. After the target random number is selected by any candidate block generation node, the candidate block generation node information for generating the target random number may be used as the next block generation node information.
Optionally, using the candidate block generation node information for generating the target random number as the next block generation node information includes:
sending target candidate block generation node information associated with the target random number to other candidate block generation nodes;
the next block generation node information is selected from the target candidate block generation node information and the target candidate block generation node information received from the other candidate block generation nodes.
After the target random number is selected by any candidate block generation node, the information of the candidate block generation node associated with the target random number, that is, the information of the target candidate block generation node is transmitted to the blockchain network, so that the target random number exchange among different candidate block generation nodes and the exchange of the corresponding target candidate block generation node information can be realized. The selection of the target random number and the propagation to the blockchain network correspond to the random number-based drawing process of each candidate block generation node. The target candidate block generation node information may be any information that can be used to distinguish node objects, and may be, for example, a node address or a node identifier.
It should be noted here that when acquiring the random number and the evidence of another candidate block generation node from the blockchain network, an arbitrary candidate block generation node may acquire information of the other candidate block generation node, such as a node address or a node identifier, at the same time, that is, there is a correspondence relationship among the candidate block generation node, the random number, and the evidence, and uplink stores the three according to the correspondence relationship.
Optionally, selecting a target random number from the remaining random numbers includes: and when detecting that the received random number accounts for a proportion value of the total number of candidate block generation nodes in the block chain network and is greater than a proportion threshold value, executing target random number selection operation. For example, after any candidate tile generation node has received the random number transmitted by a candidate tile generation node 2/3 in the blockchain network, where the ratio value 2/3 exceeds a preset ratio threshold, which indicates that most candidate tile generation nodes in the blockchain network consider that the blockchain network has a block timeout, the selection operation of the target random number is performed, so as to determine the node for generating the next tile by means of random drawing. Through setting of the proportion threshold value, reasonable verification of block overtime of the current block chain network is achieved. The proportional threshold value can be adaptively set according to the deployment condition of the blockchain network.
For any candidate block generation node, the target random number selected by the candidate block generation node corresponds to one candidate block generation node information, target candidate block generation node information associated with the target random number selected by another candidate block generation node may be acquired from the blockchain network, and the target candidate block generation node information may be screened according to the number of times of receiving the node information, so as to determine information of a candidate block generation node used for generating a next block, that is, next block generation node information. For example, if the candidate tile generating nodes of 2/3 in the blockchain network all confirm that a target random number was drawn by a candidate tile generating node, then the node has the right to generate the next tile. By combining the random thought and the statistical thought, the safety and the fairness of the next block generation node are ensured.
According to the technical scheme of the embodiment, when the block chain network is overtime, firstly, the verifiable random numbers and evidences are generated through the generation nodes of the candidate blocks, and the random numbers and the evidences are exchanged to keep the consistency of the random numbers among the generation nodes of the different candidate blocks; and then selecting a target random number through each candidate block generation node, exchanging the target random numbers, keeping the consistency of the target random numbers among different candidate block generation nodes, and finally determining the next block generation node information based on the candidate block generation node information associated with the target random numbers. Because the generation of the random number in each candidate block generation node has randomness, the fairness of determining the block generation node in a random drawing mode is ensured, and the unpredictability of the random number generation ensures that the next block generation node is unpredictable, thereby reducing the risk of malicious attack on the block chain network. Meanwhile, the scheme of the embodiment does not depend on clock synchronization among the nodes of the block chain, is beneficial to global deployment, has low deployment cost, and can avoid the phenomenon of block chain bifurcation easily caused by network delay when nodes are handed out by depending on clock synchronization; in the process of generating a new block, the scheme of the embodiment does not need most of block chain link points in the block chain network to perform multiple rounds of signature on the block, so that the block generation efficiency is improved.
Fig. 2 is a flowchart of another block generation method disclosed in an embodiment of the present application, which is further optimized and expanded based on the above technical solution, and can be combined with the above optional embodiments. As shown in fig. 2, the method of this embodiment may include:
s201, if the block out time of the block chain network is detected, based on a verifiable random number algorithm, generating a random number and evidence according to the current block ID, the next block height and the local secret key.
Fig. 3 shows, as an example, a schematic diagram of random number and evidence generation. A Verifiable Random number algorithm (VRF) may simultaneously obtain two outputs of a Random number and evidence based on a current input, i.e., "message body.
For example, the process of generating the random number R and the Proof using verifiable random number algorithm may be expressed as: proof, R ═ VRF _ gen (m, private _ key),
VRF _ gen is used to represent a function in a verifiable random number algorithm, and private _ key is used to represent a local key of a local candidate block generation node, which may be a node private key; m may be used to indicate other input information, such as current tile ID and next tile height.
The verifiable random number algorithm is characterized in that: when the 'message text' is input unchanged, the random number output by the message text is also unchanged, namely uniqueness is realized; random numbers generated by signers with different private keys are different, and the value distribution is random. Thus, these characteristics can be used for random "drawing". Specifically, since the private key of the candidate block generation node is not changeable, and the random number is generated by different candidate super nodes using the same parameters, i.e., the current block ID and the next block height, the local random number and the local evidence are not changeable. And, the random number and the evidence can be verified, improving the reliability of the random number.
In this embodiment, any candidate tile generation node has its own key pair, including a public key and a private key. The key pair may be generated by the candidate patch generation node itself using an encryption algorithm, or may be generated for it by a third party authentication platform. The private key may be stored locally; the public key can be stored in uplink or in a third-party authentication platform, so that other candidate block generation nodes can acquire the public key as required.
S202, random numbers and evidences are sent to other candidate block generating nodes in the block chain network.
S203, checking the evidence received from the other candidate block generation nodes according to the current block ID, the next block height and the keys of the other candidate block generation nodes.
The key of the candidate block generation node used in the verification process corresponds to the key of the candidate block generation node used in the random number and evidence generation process, for example, if the random number and evidence generation process uses the private key of the candidate block generation node, the verification process needs to use the public key of the candidate block generation node for verification.
S204, if the evidence passes the verification, verifying the random numbers received from the generation nodes of the other candidate blocks according to the evidence received from the generation nodes of the other candidate blocks, and filtering the random numbers which fail to be verified.
For example, the verification process for the random number R and the Proof may be expressed as:
VRF_verify(m,public_key,proof==true,
VRF_P2H(proof)==R,
VRF _ verify is used to indicate a function for verifying the evidence, VRF _ P2H is used to indicate a function for verifying the random number by using the evidence, public _ key is used to indicate a public key of a candidate block generation node associated with the evidence to be verified, and m may be used to indicate other input information, for example, information such as a current block ID and a next block height.
Specifically, in the evidence verification process, taking the local candidate block generation node as an example, when the random number and the evidence of the other candidate block generation node Q are obtained, the public key of the other candidate block generation node Q may be obtained from the block chain network based on the information of the other candidate block generation node Q, such as the node identifier or the node address, or the required public key may be obtained from the third party authentication platform, and then the evidence of the other candidate block generation node Q is verified in combination with the current block ID and the next block height; and after the evidence passes the verification, the corresponding random number is verified by using the evidence. If the evidence is verified unsuccessfully, the corresponding random number is not required to be verified, and the random number can be directly considered to be illegal and directly filtered.
S205, select a target random number from the remaining random numbers, and send target candidate block generation node information associated with the target random number to other candidate block generation nodes.
S206, selecting the next block generation node information from the target candidate block generation node information and the target candidate block generation node information received from the other candidate block generation nodes.
According to the technical scheme of the embodiment, when the block chain network is overtime, firstly, verifiable random numbers and evidences are generated by each candidate block generation node by using a verifiable random number algorithm, and are exchanged, so that the consistency of the random numbers among different candidate block generation nodes is maintained; then, selecting a target random number through each candidate block generation node, exchanging the target random numbers, keeping the consistency of the target random numbers among different candidate block generation nodes, finally determining the next block generation node information based on the candidate block generation node information associated with the target random numbers, and determining the block generation nodes in a random drawing mode on the basis of clock synchronization independent of block chain nodes, so that the risk of attacking a block chain network is reduced, and meanwhile, the phenomenon of block chain bifurcation easily caused by network delay when nodes are handed out by relying on clock synchronization is avoided; in addition, the scheme of the embodiment solves the problem of common identification bifurcation of DPOS by introducing a VRF technology, and has higher implementation efficiency; the verifiable random number algorithm is utilized to output the verifiable random number and the evidence at the same time, so that the reliability of the random number is improved.
Fig. 4 is a schematic structural diagram of a tile generation apparatus according to an embodiment of the present disclosure, which may be applied to a situation where a blockchain network exhibits block timeout and effectively determines a tile generation node for generating a next tile. The apparatus of this embodiment may be implemented in software and/or hardware, and may be configured in a candidate block generation node in a blockchain network. The candidate block generation node refers to any node, such as a super node, in the block chain network, which has a block output capability. The candidate tile generation node may be deployed on any electronic device capable of carrying the blockchain node.
As shown in fig. 4, the block generation apparatus 300 disclosed in this embodiment may include a random number and evidence generation module 310, a random number and evidence sending module 320, a random number and evidence checking module 330, and a next block generation node determination module 340, where:
a random number and evidence generating module 310, configured to generate a random number and an evidence if it is detected that the block out of the block chain network is overtime;
a random number and evidence sending module 320, configured to send a random number and evidence to other candidate block generating nodes in the block chain network;
a random number and evidence checking module 330, configured to check the random numbers and the evidence received from the other candidate block generation nodes, and filter out random numbers that fail to be checked;
a next block generation node determining module 340, configured to select a target random number from the remaining random numbers, and use candidate block generation node information for generating the target random number as next block generation node information.
Optionally, the next block generation node determining module 340 is specifically configured to:
and sequencing the rest random numbers, and selecting the random number with a fixed sequence number as a target random number.
Optionally, the next block generation node determining module 340 includes:
a target random number selection unit for selecting a target random number from the remaining random numbers;
a node information sending unit, configured to send target candidate block generation node information associated with the target random number to other candidate block generation nodes;
a next block generation node information determination unit operable to select next block generation node information from the target candidate block generation node information and target candidate block generation node information received from the other candidate block generation nodes.
Optionally, the apparatus disclosed in this embodiment further includes:
the time length determining module is used for determining a time length value between the current time and the block output time of the current block;
and the block-out overtime determining module is used for determining that the block-out overtime of the block chain network is detected if the time length value is greater than the time length threshold.
Optionally, the random number and evidence generating module 310 is specifically configured to:
and if the block out time of the block chain network is detected, generating a random number and evidence according to the current block ID, the next block height and the local key based on a verifiable random number algorithm.
Optionally, the random number and evidence checking module 330 includes:
the evidence checking unit is used for checking the evidence received from the generation nodes of other candidate blocks according to the current block ID, the height of the next block and the keys of the generation nodes of other candidate blocks;
the random number verification unit is used for verifying the random numbers received from the generation nodes of the other candidate blocks according to the evidences received from the generation nodes of the other candidate blocks if the evidence verification is passed;
and the random number filtering unit is used for filtering the random numbers which fail to check.
Optionally, the next block generation node determining module 340 is specifically configured to:
and when detecting that the received random number accounts for a proportion value of the total number of candidate block generation nodes in the block chain network and is greater than a proportion threshold value, executing target random number selection operation.
Optionally, the next block generation node information determining unit is specifically configured to:
and using the target candidate block generation node information and the target candidate block generation node information with the largest receiving times in the target candidate block generation node information received from other candidate block generation nodes as the next block generation node information.
The block generation apparatus 300 disclosed in the embodiment of the present application can execute any block generation method disclosed in the embodiment of the present application, and has functional modules and beneficial effects corresponding to the execution method. Reference may be made to the description of any method embodiment of the present application for details not explicitly described in this embodiment.
According to an embodiment of the present application, an electronic device and a readable storage medium are also provided.
As shown in fig. 5, fig. 5 is a block diagram of an electronic device for implementing the block generation method in the embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of embodiments of the present application described and/or claimed herein. Typically, the electronic device disclosed in this embodiment may be a computing device capable of carrying a blockchain node.
As shown in fig. 5, the electronic apparatus includes: one or more processors 401, memory 402, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display Graphical information for a Graphical User Interface (GUI) on an external input/output device, such as a display device coupled to the Interface. In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations, e.g., as a server array, a group of blade servers, or a multi-processor system. In fig. 5, one processor 401 is taken as an example.
The memory 402 is a non-transitory computer readable storage medium provided by the embodiments of the present application. The memory stores instructions executable by at least one processor, so that the at least one processor executes the block generation method provided by the embodiment of the application. The non-transitory computer-readable storage medium of the embodiments of the present application stores computer instructions for causing a computer to execute the block generation method provided by the embodiments of the present application.
The memory 402, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the block generation method in the embodiment of the present application, for example, the random number and evidence generation module 310, the random number and evidence transmission module 320, the random number and evidence verification module 330, and the next block generation node determination module 340 shown in fig. 4. The processor 401 executes various functional applications of the server and data processing by running non-transitory software programs, instructions, and modules stored in the memory 402, that is, implements the block generation method in the above-described method embodiment.
The memory 402 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the electronic device of the tile generation method, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 402 may optionally include a memory remotely located from the processor 401, and such remote memory may be connected via a network to an electronic device for implementing the block generation method of the present embodiment. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device for implementing the block generation method in this embodiment may further include: an input device 403 and an output device 404. The processor 401, the memory 402, the input device 403 and the output device 404 may be connected by a bus or other means, and fig. 5 illustrates an example of a connection by a bus.
The input device 403 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus for implementing the block generating method of the present embodiment, such as an input device of a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or the like. The output device 404 may include a display device, an auxiliary lighting device such as a Light Emitting Diode (LED), a tactile feedback device, and the like; the tactile feedback device is, for example, a vibration motor or the like. The Display device may include, but is not limited to, a Liquid Crystal Display (LCD), an LED Display, and a plasma Display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, Integrated circuitry, Application Specific Integrated Circuits (ASICs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs, also known as programs, software applications, or code, include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or Device for providing machine instructions and/or data to a Programmable processor, such as a magnetic disk, optical disk, memory, Programmable Logic Device (PLD), including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device for displaying information to a user, for example, a Cathode Ray Tube (CRT) or an LCD monitor; and a keyboard and a pointing device, such as a mouse or a trackball, by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback, e.g., visual feedback, auditory feedback, or tactile feedback; and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front-end component, e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here, or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
According to the technical scheme of the embodiment of the application, when the block chain network is overtime, firstly, the verifiable random numbers and evidences are generated through the generation nodes of the candidate blocks, the random numbers and the evidences are exchanged, and the consistency of the random numbers among the generation nodes of the different candidate blocks is kept; and then selecting a target random number through each candidate block generation node, exchanging the target random numbers, keeping the consistency of the target random numbers among different candidate block generation nodes, and finally determining the next block generation node information based on the candidate block generation node information associated with the target random numbers. Because the generation of the random number in each candidate block generation node has randomness, the fairness of determining the block generation node in a random drawing mode is ensured, and the unpredictability of the random number generation ensures that the next block generation node is unpredictable, thereby reducing the risk of malicious attack on the block chain network. Meanwhile, the scheme of the embodiment does not depend on clock synchronization among the nodes of the block chain, is beneficial to global deployment, has low deployment cost, and can avoid the phenomenon of block chain bifurcation easily caused by network delay when nodes are handed out by depending on clock synchronization; in the process of generating a new block, the scheme of the embodiment does not need most of block chain link points in the block chain network to perform multiple rounds of signature on the block, so that the block generation efficiency is improved.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present application can be achieved, and the present invention is not limited herein.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (12)

1. A method of block generation performed by a candidate block generation node in a blockchain network, the method comprising:
if the block-out overtime of the block chain network is detected, generating a random number and evidence;
sending the random number and the evidence to other candidate block generating nodes in the block chain network;
verifying the random numbers and the evidences received from the other candidate block generation nodes, and filtering out the random numbers which fail to be verified;
and selecting a target random number from the remaining random numbers, and using candidate block generation node information for generating the target random number as next block generation node information.
2. The method of claim 1, wherein selecting the target random number from the remaining random numbers comprises:
and sequencing the rest random numbers, and selecting the random number with a fixed sequence number as the target random number.
3. The method according to claim 1, wherein using candidate block generation node information for generating the target random number as next block generation node information comprises:
sending target candidate block generation node information associated with the target random number to the other candidate block generation nodes;
selecting next block generation node information from the target candidate block generation node information and target candidate block generation node information received from the other candidate block generation nodes.
4. The method of claim 1, further comprising:
determining a time length value between the current time and the block-out time of the current block;
and if the time length value is greater than a time length threshold value, determining that the block-out timeout of the block chain network is detected.
5. The method of claim 1, wherein the generating a random number and an evidence comprises:
the random number and evidence are generated based on a verifiable random number algorithm from the current tile ID, the next tile height, and the local key.
6. The method of claim 5, wherein checking the random numbers and the evidence received from the other candidate tile generation nodes comprises:
verifying evidence received from the other candidate patch generating nodes according to the current patch ID, the next patch height and keys of the other candidate patch generating nodes;
and if the evidence passes the verification, verifying the random numbers received from the other candidate block generation nodes according to the evidence received from the other candidate block generation nodes.
7. The method of claim 1, wherein selecting the target random number from the remaining random numbers comprises:
and when detecting that the proportion value of the number of the received random numbers to the total number of the candidate block generation nodes in the block chain network is greater than a proportion threshold value, executing the target random number selection operation.
8. The method of claim 3, wherein selecting next block generation node information from the target candidate block generation node information and target candidate block generation node information received from the other candidate block generation nodes comprises:
and using the target candidate block generation node information and the target candidate block generation node information received from the other candidate block generation nodes, the target candidate block generation node information having the largest number of times of reception, as the next block generation node information.
9. An apparatus for block generation configured at a candidate block generation node in a blockchain network, the apparatus comprising:
a random number and evidence generation module, configured to generate a random number and an evidence if it is detected that the block out of the block chain network is overtime;
a random number and evidence sending module, configured to send the random number and the evidence to other candidate block generation nodes in the block chain network;
the random number and evidence checking module is used for checking the random numbers and the evidence received from the other candidate block generating nodes and filtering out the random numbers which fail to check;
and the next block generation node determining module is used for selecting a target random number from the rest random numbers and taking candidate block generation node information for generating the target random number as next block generation node information.
10. The apparatus of claim 9, further comprising:
the time length determining module is used for determining a time length value between the current time and the block output time of the current block;
and the block-out overtime determining module is used for determining that the block-out overtime of the block chain network is detected if the time length value is greater than a time length threshold.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the block generation method of any one of claims 1-8.
12. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the block generating method of any one of claims 1 to 8.
CN201911421045.5A 2019-12-31 2019-12-31 Block generation method, device, electronic equipment and storage medium Active CN111147242B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911421045.5A CN111147242B (en) 2019-12-31 2019-12-31 Block generation method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911421045.5A CN111147242B (en) 2019-12-31 2019-12-31 Block generation method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111147242A true CN111147242A (en) 2020-05-12
CN111147242B CN111147242B (en) 2023-10-17

Family

ID=70523114

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911421045.5A Active CN111147242B (en) 2019-12-31 2019-12-31 Block generation method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111147242B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111640020A (en) * 2020-05-22 2020-09-08 百度在线网络技术(北京)有限公司 Transaction request processing method, device, equipment and medium in block chain
CN114281887A (en) * 2021-04-07 2022-04-05 暗链科技(深圳)有限公司 Data storage method based on block distributed block chain and electronic equipment
CN117726343A (en) * 2024-02-06 2024-03-19 中国信息通信研究院 Method, device, equipment and medium for supervising execution of intelligent contracts in block chain

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110022231A (en) * 2019-03-26 2019-07-16 广州供电局有限公司 Block chain common recognition election method
CN110599160A (en) * 2018-06-12 2019-12-20 韩国电子通信研究院 Method and apparatus for selecting distributed consensus nodes based on random number attestation
CN110599173A (en) * 2019-09-20 2019-12-20 腾讯科技(深圳)有限公司 Block chain consensus node determination method, device, equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110599160A (en) * 2018-06-12 2019-12-20 韩国电子通信研究院 Method and apparatus for selecting distributed consensus nodes based on random number attestation
CN110022231A (en) * 2019-03-26 2019-07-16 广州供电局有限公司 Block chain common recognition election method
CN110599173A (en) * 2019-09-20 2019-12-20 腾讯科技(深圳)有限公司 Block chain consensus node determination method, device, equipment and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111640020A (en) * 2020-05-22 2020-09-08 百度在线网络技术(北京)有限公司 Transaction request processing method, device, equipment and medium in block chain
CN111640020B (en) * 2020-05-22 2023-09-19 百度在线网络技术(北京)有限公司 Transaction request processing method, device, equipment and medium in blockchain
CN114281887A (en) * 2021-04-07 2022-04-05 暗链科技(深圳)有限公司 Data storage method based on block distributed block chain and electronic equipment
CN117726343A (en) * 2024-02-06 2024-03-19 中国信息通信研究院 Method, device, equipment and medium for supervising execution of intelligent contracts in block chain

Also Published As

Publication number Publication date
CN111147242B (en) 2023-10-17

Similar Documents

Publication Publication Date Title
Lei et al. Groupchain: Towards a scalable public blockchain in fog computing of IoT services computing
CN111147242A (en) Block generation method and device, electronic equipment and storage medium
CN111460429B (en) Task processing method, device, equipment and medium based on trusted execution environment
CN111741026B (en) Cross-chain transaction request processing method, device, equipment and storage medium
CN111769958B (en) Block chain cross-chain processing method, device, equipment and storage medium
CN111934889B (en) Key generation method, signature and signature verification method, device, equipment and medium
CN110545541B (en) Method, device, equipment, terminal and medium for defending attack behaviors
CN110535970B (en) Evidence storing and processing method, device, equipment and medium of judicial chain
CN110674217B (en) Block chain data processing method, device, equipment and medium
CN108092984B (en) Authorization method, device and equipment for application client
CN111737365B (en) Storage certificate processing method, device, equipment and storage medium
CN104426835B (en) Login detection method, server, login detection device and system
CN110889124B (en) Information sharing method and device, electronic equipment and storage medium
CN112583867B (en) Sharing method and device of intelligent household electrical appliance, electronic equipment and medium
CN111131317A (en) Data processing method, device, equipment and medium based on block chain
CN110909372A (en) Data processing method, device, equipment and medium
CN111741015A (en) Operation processing method, device, equipment and medium in block chain network
CN112511505A (en) Authentication system, method, device, equipment and medium
CN111343177B (en) Method, device, equipment and medium for supervising lightweight node
CN111741012B (en) Authorization signature generation method, node management method, device, equipment and medium
CN110536283B (en) Terminal identifier acquisition method, device, electronic equipment and medium
CN112987942A (en) Method, device and system for inputting information by keyboard, electronic equipment and storage medium
CN111737534A (en) File processing method, device and equipment
CN113379421B (en) Information processing and block chain network composition method and device based on block chain
CN111371557B (en) Block chain data processing method and device, electronic equipment and medium

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