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

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

Info

Publication number
CN111147242B
CN111147242B CN201911421045.5A CN201911421045A CN111147242B CN 111147242 B CN111147242 B CN 111147242B CN 201911421045 A CN201911421045 A CN 201911421045A CN 111147242 B CN111147242 B CN 111147242B
Authority
CN
China
Prior art keywords
random number
candidate block
block generation
block
target
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
Application number
CN201911421045.5A
Other languages
Chinese (zh)
Other versions
CN111147242A (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

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

Abstract

The embodiment of the application discloses a block generation method, a device, electronic equipment and a storage medium, and relates to the block chain technology. Wherein the method comprises the following steps: if the block-out timeout of the block chain network is detected, generating a random number and evidence; sending random numbers and evidence to other candidate block generation nodes in the blockchain network; checking the random numbers and the evidences received from other candidate block generation nodes, and filtering the random numbers failing to check; and selecting a target random number from the rest random numbers, and taking the candidate block generation node information for generating the target random number as the next block generation node information. According to the embodiment of the application, the block generation node is determined in a random drawing mode without depending on clock synchronization of the block chain node, so that the risk of attack of the block chain network is reduced.

Description

Block generation method, device, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to computer technology, in particular to blockchain technology, and particularly relates to a block generation method, a device, electronic equipment and a storage medium.
Background
Delegation share proof (Delegate proof of Stake, DPOS) is a popular blockchain consensus algorithm whose basic flow is to choose N supernodes by voting and then stream blocks from the supernode wheel.
However, since the tenninal period of each super node is generally divided according to time slices, the dependence on clock synchronization and network state is high, and when clock synchronization or network delay exists, bifurcation easily occurs in the block generation process.
Disclosure of Invention
The embodiment of the application discloses a block generation method, a device, electronic equipment and a storage medium, which are used for determining block generation nodes in a random drawing mode on the basis of independent clock synchronization of block chain nodes, so that the risk of block chain network attack 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, the method including:
if the block-out timeout of the block chain network is detected, generating a random number and evidence;
sending the random number and evidence to other candidate block generation nodes in the blockchain network;
checking the random numbers and the evidences received from the other candidate block generation nodes, and filtering the random numbers failing to check;
and 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.
Optionally, the selecting the target random number from the remaining random numbers includes:
and sequencing the rest random numbers, and selecting the random numbers with fixed sequence numbers as the target random numbers.
Optionally, the generating node information of the candidate block for generating the target random number is used as the generating node information of the next block, including:
transmitting target candidate block generation node information associated with the target random number to the 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.
One embodiment of the above application has the following advantages or benefits: the generation of random numbers in each candidate block generation node has randomness and unpredictability, so that fairness of the block generation nodes is ensured to be determined in a random drawing mode, the risk of malicious attack of a block chain network is reduced, and clock synchronization of the block chain nodes is not needed to be relied on in the block generation node determination process.
Optionally, the method further comprises:
determining a duration value between the current time and the block-out time of the current block;
And if the duration value is greater than the duration threshold value, determining that the block-out timeout of the blockchain network is detected.
Optionally, the generating the random number and the evidence includes:
based on a verifiable random number algorithm, the random number and proof are generated from the current block ID, the next block height, and the local key.
One embodiment of the above application has the following advantages or benefits: and by using a verifiable random number algorithm, generating nodes for any candidate block and simultaneously outputting verifiable random numbers and evidences, the reliability of the random numbers is improved.
Optionally, verifying the random number and the evidence received from the other candidate block generating node includes:
verifying evidence received from the other candidate block generating nodes according to the current block ID, the next block height and the keys of the other candidate block generating nodes;
and if the evidence verification is passed, verifying the random numbers received from the other candidate block generating nodes according to the evidence received from the other candidate block generating nodes.
One embodiment of the above application has the following advantages or benefits: by checking the random number and the evidence, the safety of the blockchain network and fairness among different candidate block generation nodes are ensured.
Optionally, the selecting the target random number from the remaining random numbers includes:
and executing the target random number selection operation 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 blockchain network is larger than a proportion threshold value.
One embodiment of the above application has the following advantages or benefits: by setting the proportional threshold, reasonable verification of the current blockchain network block out timeout is realized.
Optionally, 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 includes:
and using the target candidate block generation node information with the largest receiving times as the next block generation node information in the target candidate block generation node information and the target candidate block generation node information received from the other candidate block generation nodes.
One embodiment of the above application has the following advantages or benefits: by combining the random idea and the statistical idea, the security and fairness of determining the next block generation node are ensured.
In a second aspect, an embodiment of the present application further discloses a block generating apparatus configured to a candidate block generating node in a blockchain network, where the apparatus includes:
the random number and evidence generation module is used for generating a random number and evidence if the block-out timeout of the blockchain network is detected;
the random number and evidence sending module is used for sending the random number and evidence to other candidate block generating nodes in the blockchain network;
the random number and evidence verification module is used for verifying the random number and evidence received from the other candidate block generation nodes and filtering the random number failing to verify;
the node information sending module is used for selecting a target random number from the rest random numbers and sending target candidate block generation node information associated with the target random number to the other candidate block generation nodes;
and the node information selection module is used for 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.
Optionally, the apparatus further includes:
the time length determining module is used for determining a time length value between the current time and the block outlet time of the current block;
And the block-out timeout determining module is used for determining that the block-out timeout of the blockchain network is detected if the duration value is greater than the duration threshold value.
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 liquid crystal display device comprises a liquid crystal display device,
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 one of the embodiments of the present application.
In a fourth aspect, embodiments of the present application further disclose a non-transitory computer readable storage medium storing computer instructions for causing a computer to perform a block generation method according to any of the embodiments of the present application.
According to the technical scheme of the embodiment of the application, when the blockchain network goes out of the block overtime, firstly, verifiable random numbers and evidences are generated through each candidate block generating node, and the random numbers and the evidences are exchanged, so that the consistency of the random numbers among different candidate block generating nodes is maintained; and selecting a target random number through each candidate block generation node, and determining candidate block generation node information for generating the target random number as next block generation node information. Because the random number generation in each candidate block generation node has randomness, fairness of the block generation node is ensured to be determined in a random drawing mode, and unpredictability of the random number generation is ensured, so that the next block generation node is unpredictable, and the risk of malicious attack of a block chain network is reduced. Meanwhile, the scheme of the embodiment does not depend on clock synchronization among the block chain nodes, is favorable for globalization deployment, has lower deployment cost, and can avoid the phenomenon that when nodes cross blocks depending on clock synchronization, the block chain is easily branched due to network delay; in the process of generating a new block, most of block chain nodes in the block chain network are not required to sign the block for multiple rounds, so that the block generation efficiency is improved. Other effects of the above alternative will be described below in connection with specific embodiments.
Drawings
The drawings are included to provide a better understanding of the present application and are not to be construed as limiting the application. Wherein:
fig. 1 is a flowchart of a block generation method according to an embodiment of the present application;
FIG. 2 is a flow chart of another block generation method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a method of random number and evidence generation disclosed in accordance with an embodiment of the present application;
fig. 4 is a schematic structural diagram of a block generating apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of an electronic device disclosed in accordance with an embodiment of the application.
Detailed Description
Exemplary embodiments of the present application will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present application are included to facilitate understanding, and are to be considered merely exemplary. 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 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 block generating method according to an embodiment of the present application, where the embodiment may be applied to a case where a blockchain network exhibits a block timeout, and a block generating node for generating a next block is effectively determined. The method of the present embodiment may be performed by a block generating apparatus, which may be implemented in software and/or hardware, and may be configured as a candidate block generating node in a blockchain network. Candidate block generating nodes refer to any node in the blockchain network that has block out capability, such as supernodes. The candidate block generation nodes may be deployed on any electronic device capable of carrying blockchain nodes.
As shown in fig. 1, the block generating method disclosed in this embodiment may include:
s101, if the block out timeout of the block chain network is detected, generating a random number and evidence.
In this embodiment, any candidate block generating 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 is shown in the current blockchain network, and if the 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 within the set block-out time period, the current blockchain network is indicated to have time-out. Optionally, determining that the current blockchain network has timed out may include: determining a duration value between the current time and the block-out time of the current block, namely an instant interval; if the duration value is greater than the duration threshold span, determining that the block-out timeout of the blockchain network is detected, where the duration threshold can be adaptively set according to the block-out time period, and the embodiment is not specifically limited. For example, when the time for any candidate block generating node to receive the block with the current block height of H-1 is T and when the local clock reaches t+span, a new block with the block height of H is not yet received, it may be determined that the blockchain network has a block timeout, and H may be any positive integer.
Any candidate block generating node can generate a random number and corresponding evidence information when detecting the block-out timeout of the blockchain network. The random number may be used for the candidate block generation node to draw a lottery, to contend for the authority to generate the next block, evidence may be used for other candidate block generation nodes to verify the validity of the corresponding random number. The method for generating random numbers and evidences in each candidate block generation node is the same, and consensus is reached on the utilization of the method in advance. The method for generating the random number and the evidence is not particularly limited, and the method may be implemented by any method available in the prior art, for example, a random number algorithm (Verifiable Random Function, VRF) may be verified.
S102, sending random numbers and evidence to other candidate block generation nodes in the blockchain network.
That is, after any candidate block generating node generates its own random number and evidence, it is necessary to transmit the random number and evidence to the blockchain network, and the transmission mode may be broadcasting, so as to implement random number exchange between different candidate block generating nodes.
And S103, checking the random numbers and the evidences received from other candidate block generation nodes, and filtering out the random numbers failing to check.
In order to ensure the safety of the blockchain network and the fairness among different candidate block generation nodes, after random candidate block generation nodes acquire random numbers and evidence of other candidate block generation nodes, validity verification is needed, the random numbers passing verification can participate in the subsequent target random number selection process, and the random numbers failing verification can be filtered. In the process of checking the random number and the evidence, as long as any one party fails to check, the corresponding random number belongs to the random number which fails to check and needs to be filtered. The verification of the random number can be realized by verifying whether the random number accords with the agreed format, whether the random number source is credible and the like, and similarly, the verification of the evidence can also be realized by verifying whether the evidence accords with the agreed format, whether the evidence source is credible, whether the evidence contains pre-agreed node information and the like. On the basis of ensuring that each candidate block generation node can effectively verify the validity of the acquired random number and evidence, the specific verification method is not limited in the embodiment. And after the evidence verification is legal, the validity of the corresponding random number can be verified by utilizing the evidence.
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 with the verification failure exists, after the random number is filtered, any candidate block generating node can select a target random number based on the random number with the verification success and the random number generated by the node, namely the residual random number. The target random number may be determined according to a preset random number selection policy, and the embodiment is not limited specifically, for example, the target random number may be a maximum value or an intermediate value in the remaining random numbers, or may be a value selected according to a sequence number after the remaining random numbers are ordered, for example, the remaining random numbers are ordered, a random number with a fixed sequence number is selected as the target random number, and the fixed sequence number may be a value agreed in advance. After the random candidate block generation node selects the target random number, candidate block generation node information for generating the target random number may be used as next block generation node information.
Optionally, the generating node information of the candidate block for generating the target random number is used as the generating node information of the next block, including:
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 among the target candidate block generation node information received from the other candidate block generation nodes.
After the random candidate block generating node selects the target random number, transmitting information of the candidate block generating node associated with the target random number, namely target candidate block generating node information, to a blockchain network, so that target random number exchange among different candidate block generating nodes and exchange of corresponding target candidate block generating node information can be realized. The process of selecting the target random number and propagating the target random number to the blockchain network is equivalent to a 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, for example, may be a node address or a node identification.
When the random number and the evidence of the other candidate block generation nodes are acquired from the blockchain network, the random number and the evidence of the other candidate block generation nodes can be acquired simultaneously, for example, the node address or the node identifier and the like of the other candidate block generation nodes, that is, the candidate block generation nodes, the random number and the evidence have a corresponding relationship, and the three are stored in a uplink according to the corresponding relationship.
Optionally, selecting the target random number from the remaining random numbers includes: and when the proportion value of the number of the received random numbers to the total number of the candidate block generating nodes in the blockchain network is detected to be larger than the proportion threshold value, performing target random number selection operation. For example, any candidate block generating node has received the random number transmitted by 2/3 candidate block generating nodes in the blockchain network, the ratio value 2/3 exceeds a preset ratio threshold value, which means that most candidate block generating nodes in the blockchain network consider that the blockchain network has a block out timeout, and then a selection operation of the target random number is executed, so that the node for generating the next block is determined in a random lottery mode. By setting the proportional threshold, reasonable verification of the current blockchain network block out timeout is realized. The scaling threshold may be adaptively set according to the deployment of the blockchain network.
For any candidate block generating node, the target random number selected by the candidate block generating node corresponds to one candidate block generating node information, the target candidate block generating node information associated with the target random number selected by other candidate block generating nodes can be obtained from the blockchain network, the target candidate block generating node information can be screened according to the receiving times of the node information, and therefore information of the candidate block generating node for generating the next block, namely the next block generating node information, can be determined, for example, the target candidate block generating node information with the largest receiving times can be used as the next block generating node information. For example, if 2/3 of the candidate block generation nodes in the blockchain network all confirm that a particular candidate block generation node has drawn the target random number, then that node has the authority to generate the next block. By combining the random idea and the statistical idea, the security and fairness of determining the next block generation node are ensured.
According to the technical scheme of the embodiment, when the blockchain network goes out of a block overtime, firstly, verifiable random numbers and evidences are generated through each candidate block generation node, and the random numbers and the evidences are exchanged, so that the consistency of the random numbers among different candidate block generation nodes is maintained; and 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 random number generation in each candidate block generation node has randomness, fairness of the block generation node is ensured to be determined in a random drawing mode, and unpredictability of the random number generation is ensured, so that the next block generation node is unpredictable, and the risk of malicious attack of a block chain network is reduced. Meanwhile, the scheme of the embodiment does not depend on clock synchronization among the block chain nodes, is favorable for globalization deployment, has lower deployment cost, and can avoid the phenomenon that when nodes cross blocks depending on clock synchronization, the block chain is easily branched due to network delay; in the process of generating a new block, most of block chain nodes in the block chain network are not required to sign the block for multiple rounds, so that the block generation efficiency is improved.
Fig. 2 is a flowchart of another block generating method according to an embodiment of the present application, which is further optimized and expanded based on the above technical solution, and may be combined with the above various alternative embodiments. As shown in fig. 2, the method of this embodiment may include:
and S201, if the block chain network out-of-block timeout 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.
Fig. 3 shows, by way of example, a schematic diagram of random number and evidence generation. A verifiable random number algorithm (Verifiable Random Function, VRF) may be based on a current input, i.e. "message body", resulting in both a random number and a proof output.
By way of example, the process of generating the random number R and Proof using a verifiable random number algorithm may be expressed as: proof, r=vrf_gen (m, private_key),
the VRF_gen is used for representing a function in a verifiable random number algorithm, and the private_key is used for representing a local key of a local candidate block generation node, which can be a node private key; m may be used to represent other input information, such as current block ID and next block height.
The verifiable random number algorithm is characterized in that: when the input 'message text' is unchanged, the output random number is unchanged, namely the uniqueness is achieved; the random numbers produced by signers with different private keys are also different, and the value distribution is random. Thus, these characteristics can be used for random "drawing" s. Specifically, since the private key of the candidate block generation node is not changeable, different candidate supernodes generate random numbers by adopting the same parameters, namely the current block ID and the next block height, and therefore, the local random numbers and the local evidence are not changeable. And, random numbers and evidence can be verified, improving the reliability of random numbers.
In this embodiment, any candidate block generation node has its own key pair, including a public key and a private key. The key pair may be generated by the candidate block 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 a uplink manner or can be stored by a third party authentication platform, so that other candidate block generating nodes can acquire the public key according to requirements.
S202, sending random numbers and evidence to other candidate block generation nodes in the blockchain network.
And S203, checking the evidence received from other candidate block generating nodes according to the current block ID, the next block height and the keys of other candidate block generating nodes.
The key of the candidate block generating node used in the verification process corresponds to the key of the candidate block generating node used in the random number and evidence generating process, for example, the random number and evidence generating process uses the private key of the candidate block generating node, and the verification process needs to use the public key of the candidate block generating node for verification.
And S204, if the evidence verification passes, verifying the random numbers received from other candidate block generating nodes according to the evidence received from other candidate block generating nodes, and filtering out the random numbers failing to verify.
Illustratively, the verification process for the random number R and Proof may be expressed as:
VRF_verify(m,public_key,proof==true,
VRF_P2H(proof)==R,
the vrf_verify is used to represent a function for verifying evidence, the vrf_p2h is used to represent a function for verifying a random number by using evidence, the public_key is used to represent a public key of a candidate block generation node associated with evidence to be verified, and m may be used to represent other input information, for example, information such as a current block ID and a next block height.
Specifically, taking a local candidate block generation node as an example in the evidence verification process, when the random number and the evidence of other candidate block generation nodes Q are obtained, the public key of the other candidate block generation nodes Q can be obtained from a blockchain network or the required public key can be obtained from a third party authentication platform based on the information of the other candidate block generation nodes Q, such as node identification or node address, and then the evidence of the other candidate block generation nodes Q can be verified by combining the current block ID and the next block height; after the evidence verification is passed, the corresponding random number is verified by using the evidence. If the evidence verification fails, the corresponding random number is not required to be verified, and the random number can be directly considered to be illegal and filtered.
S205, selecting a target random number from the rest random numbers, and sending target candidate block generation node information associated with the target random number to other candidate block generation nodes.
S206, selecting next block generation node information from target candidate block generation node information received from other candidate block generation nodes.
According to the technical scheme of the embodiment, when the blockchain network goes out of a block overtime, firstly, verifiable random numbers and evidences are generated through each candidate block generating node by using a verifiable random number algorithm, and the random numbers and the evidences are exchanged, so that the consistency of the random numbers among different candidate block generating nodes is maintained; selecting a target random number through each candidate block generation node, exchanging the target random number, keeping the consistency of the target random numbers among different candidate block generation nodes, determining the next block generation node information based on the candidate block generation node information associated with the target random number, determining the block generation node in a random drawing mode on the basis of clock synchronization independent of block chain nodes, reducing the risk of block chain network attack, and avoiding the phenomenon of block chain bifurcation easily caused by network delay when node crossing blocks are carried out depending on clock synchronization; in addition, the problem of DPOS common bifurcation is solved by introducing VRF technology, and the implementation efficiency is high; and the verifiable random number algorithm is utilized to output the verifiable random number and evidence at the same time, so that the reliability of the random number is improved.
Fig. 4 is a schematic structural diagram of a block generating apparatus according to an embodiment of the present application, where the embodiment may be applied to a case where a blockchain network exhibits a block timeout, and a block generating node for generating a next block is effectively determined. The apparatus of this embodiment may be implemented in software and/or hardware, and may be configured as a candidate block generation node in a blockchain network. Candidate block generating nodes refer to any node in the blockchain network that has block out capability, such as supernodes. The candidate block generation nodes may be deployed on any electronic device capable of carrying blockchain nodes.
As shown in fig. 4, the block generating apparatus 300 disclosed in the present embodiment may include a random number and evidence generating module 310, a random number and evidence transmitting module 320, a random number and evidence verifying module 330, and a next block generating node determining module 340, wherein:
a random number and evidence generation module 310, configured to generate a random number and evidence if a blockout timeout of the blockchain network is detected;
a random number and evidence sending module 320, configured to send a random number and evidence to other candidate block generating nodes in the blockchain network;
a random number and evidence verification module 330, configured to verify the random number and evidence received from other candidate block generating nodes, and filter out the random number that fails the verification;
The next block generating node determining module 340 is configured to select a target random number from the remaining random numbers, and use candidate block generating node information for generating the target random number as next block generating node information.
Optionally, the next block generating node determining module 340 is specifically configured to:
and sequencing the rest random numbers, and selecting the random numbers with fixed sequence numbers as target random numbers.
Optionally, the next block generating 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 transmitting unit for transmitting target candidate block generation node information associated with the target random number to other candidate block generation nodes;
and a next block generation node information determination unit configured to select next block generation node information from among target candidate block generation node information received from 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 outlet time of the current block;
and the block-out timeout determining module is used for determining that the block-out timeout of the blockchain network is detected if the duration value is greater than the duration threshold value.
Optionally, the random number and evidence generation module 310 is specifically configured to:
if the blockchain network block timeout 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 proof verification module 330 includes:
the evidence verification unit is used for verifying the evidence received from the other candidate block generation nodes according to the current block ID, the next block height and the key of the other candidate block generation nodes;
the random number verification unit is used for verifying the random numbers received from the other candidate block generation nodes according to the evidence received from the other candidate block generation nodes if the evidence verification passes;
and the random number filtering unit is used for filtering the random number failing to check.
Optionally, the next block generating node determining module 340 is specifically configured to:
and when the proportion value of the number of the received random numbers to the total number of the candidate block generating nodes in the blockchain network is detected to be larger than the proportion threshold value, performing target random number selection operation.
Optionally, the next block generation node information determining unit is specifically configured to:
and the target candidate block generating node information with the largest receiving times is used as the next block generating node information from the target candidate block generating node information and the target candidate block generating node information received from other candidate block generating nodes.
The block generating apparatus 300 disclosed in the embodiment of the present application can execute any block generating method disclosed in the embodiment of the present application, and has the corresponding functional modules and beneficial effects of the executing method. Reference is made to the description of any method embodiment of the application for details not described in this embodiment.
According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.
As shown in fig. 5, fig. 5 is a block diagram of an electronic device for implementing a block generation method in an 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 telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the embodiments of the application described and/or claimed herein. Typically, the electronic device disclosed in this embodiment may be a computing device capable of carrying blockchain nodes.
As shown in fig. 5, the electronic device includes: one or more processors 401, memory 402, and interfaces for connecting the components, including a high-speed interface and a low-speed interface. 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 executing within the electronic device, including instructions stored in or on memory to display graphical information of a graphical user interface (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, if desired, along with multiple memories and multiple memories. Also, multiple electronic devices may be connected, each providing a portion of the necessary operations, e.g., as a server array, a set of blade servers, or a multiprocessor system. One processor 401 is illustrated in fig. 5.
Memory 402 is a non-transitory computer readable storage medium provided by embodiments of the present application. The memory stores instructions executable by at least one processor to cause the at least one processor to perform the block generation method provided by the embodiments of the present application. The non-transitory computer-readable storage medium of the embodiment of the present application stores computer instructions for causing a computer to execute the block generation method provided by the embodiment of the present application.
The memory 402 is used as a non-transitory computer readable storage medium for storing 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, i.e., implements the block generating method in the above-described method embodiments, by running non-transitory software programs, instructions, and modules stored in the memory 402.
Memory 402 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created according to the use of the electronic device of the block generation method, and the like. In addition, 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, memory 402 may optionally include memory remotely located with respect to processor 401, which may be connected via a network to the electronic device used to implement 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, memory 402, input device 403, and output device 404 may be connected by a bus or otherwise, for example in fig. 5.
The input device 403 may receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic device used to implement the patch generation method of the present embodiment, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointer stick, one or more mouse buttons, a track ball, a joystick, and the like. The output means 404 may include a display device, auxiliary lighting means, such as light emitting diodes (Light Emitting Diode, LEDs), tactile feedback means, and the like; haptic feedback devices such as vibration motors and the like. The display device may include, but is not limited to, a liquid crystal display (Liquid Crystal Display, LCD), an LED display, and a plasma display. In some implementations, the display device may be a touch screen.
Various implementations of the systems and techniques described here can be implemented in digital electronic circuitry, integrated circuitry, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
These computing programs, also referred to as programs, software applications, or code, include machine instructions for a programmable processor, and may be implemented in a high-level procedural and/or object-oriented programming language, and/or in assembly/machine language. 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, e.g., magnetic discs, optical disks, memory, programmable logic devices (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 pointing device, such as a mouse or 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 may 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 input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background 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 background, middleware, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include: local area network (Local Area Network, LAN), wide area network (Wide Area Network, WAN), the internet and blockchain networks.
The computer system may include a client and a server. The client and server are typically 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 blockchain network goes out of the block overtime, firstly, verifiable random numbers and evidences are generated through each candidate block generating node, and the random numbers and the evidences are exchanged, so that the consistency of the random numbers among different candidate block generating nodes is maintained; and 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 random number generation in each candidate block generation node has randomness, fairness of the block generation node is ensured to be determined in a random drawing mode, and unpredictability of the random number generation is ensured, so that the next block generation node is unpredictable, and the risk of malicious attack of a block chain network is reduced. Meanwhile, the scheme of the embodiment does not depend on clock synchronization among the block chain nodes, is favorable for globalization deployment, has lower deployment cost, and can avoid the phenomenon that when nodes cross blocks depending on clock synchronization, the block chain is easily branched due to network delay; in the process of generating a new block, most of block chain nodes in the block chain network are not required to sign the block for multiple rounds, so that the block generation efficiency is improved.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present application may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution disclosed in the present application can be achieved, and are not limited herein.
The above embodiments do not limit the scope of the present application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application should be included in the scope of the present application.

Claims (9)

1. A block generation method performed by a candidate block generation node in a blockchain network, the method comprising:
if the block-out timeout 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;
sending the random number and evidence to other candidate block generation nodes in the blockchain network;
Verifying evidence received from the other candidate block generating nodes according to the current block ID, the next block height and the keys of the other candidate block generating nodes;
if the evidence verification is passed, verifying the random numbers received from the other candidate block generating nodes according to the evidence received from the other candidate block generating nodes, and filtering the random numbers failing to verify; wherein the key of the candidate block generation node used by the verification corresponds to the key of the candidate block generation node used by the generated random number and evidence;
selecting a target random number from the rest random numbers, and 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;
wherein the selecting a target random number from the remaining random numbers includes:
and if the candidate block generating node receives the random number transmitted by the candidate block generating node exceeding the preset proportion threshold in the blockchain network, judging that the blockchain network shows block timeout, and executing the selection operation of the target random number.
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 numbers with fixed sequence numbers as the target random numbers.
3. The method according to claim 1, wherein the method further comprises:
determining a duration value between the current time and the block-out time of the current block;
and if the duration value is greater than the duration threshold value, determining that the block-out timeout of the blockchain network is detected.
4. The method of claim 1, wherein selecting the target random number from the remaining random numbers comprises:
and executing the target random number selection operation 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 blockchain network is larger than a proportion threshold value.
5. The method of claim 1, 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 with the largest receiving times as the next block generation node information in the target candidate block generation node information and the target candidate block generation node information received from the other candidate block generation nodes.
6. A block generation apparatus, wherein candidate block generation nodes are arranged in a blockchain network, the apparatus comprising:
the random number and evidence generation module is specifically used for 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 if the block-out timeout of the block chain network is detected;
the random number and evidence sending module is used for sending the random number and evidence to other candidate block generating nodes in the blockchain network;
the random number and evidence verification module is used for verifying the random number and evidence received from the other candidate block generation nodes and filtering the random number failing to verify;
a target random number selection unit for selecting a target random number from the remaining random numbers;
a node information transmitting unit for transmitting target candidate block generation node information associated with the target random number to other candidate block generation nodes;
a next block generation node information determining unit configured to select next block generation node information from among target candidate block generation node information received from other candidate block generation nodes;
Wherein the selecting a target random number from the remaining random numbers includes:
the candidate block generating node receives the random number transmitted by the candidate block generating node exceeding a preset proportion threshold in the blockchain network, judges that the blockchain network shows block timeout, and executes the selection operation of the target random number;
the evidence verification unit is used for verifying the evidence received from the other candidate block generation nodes according to the current block ID, the next block height and the key of the other candidate block generation nodes;
the random number verification unit is used for verifying the random number received from the other candidate block generation nodes according to the evidence received from the other candidate block generation nodes if the evidence verification passes; and the key of the candidate block generation node used by the verification corresponds to the key of the candidate block generation node used by the generated random number and evidence.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the time length determining module is used for determining a time length value between the current time and the block outlet time of the current block;
and the block-out timeout determining module is used for determining that the block-out timeout of the blockchain network is detected if the duration value is greater than the duration threshold value.
8. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
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-5.
9. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the block generation method of any one of claims 1-5.
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 CN111147242A (en) 2020-05-12
CN111147242B true 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)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111640020B (en) * 2020-05-22 2023-09-19 百度在线网络技术(北京)有限公司 Transaction request processing method, device, equipment and medium in blockchain
CN114281887B (en) * 2021-04-07 2022-08-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

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11646879B2 (en) * 2018-06-12 2023-05-09 Electronics And Telecommunications Research Institute Method and apparatus for selecting distributed consensus node based on proof of nonce
CN110022231B (en) * 2019-03-26 2022-02-11 广东电网有限责任公司广州供电局 Block chain consensus promotion method
CN110599173B (en) * 2019-09-20 2021-08-17 腾讯科技(深圳)有限公司 Block chain consensus node determination method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN111147242A (en) 2020-05-12

Similar Documents

Publication Publication Date Title
CN111147242B (en) Block generation method, device, electronic equipment and storage medium
CN111769958B (en) Block chain cross-chain processing method, device, equipment and storage medium
CN110601849B (en) Trusted timestamp adding method and device and storage medium
CN111934889B (en) Key generation method, signature and signature verification method, device, equipment and medium
CN110535970B (en) Evidence storing and processing method, device, equipment and medium of judicial chain
CN111563743B (en) Block chain transfer processing method, device, equipment and medium
CN112583867B (en) Sharing method and device of intelligent household electrical appliance, electronic equipment and medium
CN110400217B (en) Rule change processing method and device for intelligent contract
CN111260474B (en) Asset transaction method, device, equipment, system and storage medium of cross-blockchain
CN112116474B (en) Verification method and device for electronic contract, electronic equipment and storage medium
CN110545541A (en) Method, device, equipment, terminal and medium for defending attack behavior
CN110264172B (en) Transaction processing method and device based on blockchain
CN103634419B (en) The long-range control method of terminal and terminal
JP7317084B2 (en) REMOTE VERIFICATION METHOD, DEVICE, DEVICE, SYSTEM AND MEDIUM OF TRUSTED ENVIRONMENT
CN111737365A (en) Storage certificate processing method, device, equipment and storage medium
CN110958250B (en) Port monitoring method and device and electronic equipment
CN103684792A (en) Safety authentication method for OAM (Operation, Administration and Maintenance) and OAM message sending/receiving device
CN112989400A (en) Privacy transaction processing method and device, electronic equipment and medium
CN112311597A (en) Message pushing method and device
CN113379421B (en) Information processing and block chain network composition method and device based on block chain
CN113935069B (en) Data verification method, device and equipment based on block chain and storage medium
CN111371557B (en) Block chain data processing method and device, electronic equipment and medium
CN114553548A (en) Communication method, device, equipment and storage medium
CN103856529A (en) Method, device and system for locking screen
CN112417326A (en) URL conversion method and device, electronic equipment and storage 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