WO2021093244A1 - 随机数生成方法、区块链节点、系统及介质 - Google Patents

随机数生成方法、区块链节点、系统及介质 Download PDF

Info

Publication number
WO2021093244A1
WO2021093244A1 PCT/CN2020/080433 CN2020080433W WO2021093244A1 WO 2021093244 A1 WO2021093244 A1 WO 2021093244A1 CN 2020080433 W CN2020080433 W CN 2020080433W WO 2021093244 A1 WO2021093244 A1 WO 2021093244A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
signature
nodes
bsk
block
Prior art date
Application number
PCT/CN2020/080433
Other languages
English (en)
French (fr)
Inventor
仵小勇
Original Assignee
深圳市网心科技有限公司
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 深圳市网心科技有限公司 filed Critical 深圳市网心科技有限公司
Publication of WO2021093244A1 publication Critical patent/WO2021093244A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management

Definitions

  • the present invention relates to the field of blockchain technology, in particular to a random number generation method, a blockchain node, a system and a medium.
  • Random numbers are used in many aspects of blockchain technology solutions, such as: blockchain-based games, lottery Dapps (Decentralized Applications), and some blocks that use random numbers as the basis for selecting blocks Chain scheme and so on. A good random number should be unpredictable, uncontrollable and notarable.
  • the generated random number either only has some of the above-mentioned characteristics, or has a large overhead and is relatively complicated to use.
  • the main purpose of the present invention is to provide a random number generation method, blockchain node, system and medium, which can solve the problem of random number generation, and the generated random number is unpredictable and uncontrollable, and can be fairly recognized by all parties.
  • the present invention provides a random number generation method, which is applied to a blockchain node.
  • the method includes:
  • the blockchain node determines that N nodes including itself participate in the consensus, and obtains the code of each node;
  • the blockchain node calculates N values corresponding to the code of each node according to its own M private key segments, sends the calculated values to other nodes that meet the corresponding codes, and receives the values sent by other nodes;
  • the first signature of the blockchain node is synthesized according to the value stored on the blockchain node corresponding to its own code, and the first signature of the blockchain node is constructed according to the first signature of the blockchain node.
  • the block chain node treats the prepare vote of the consensus block;
  • the block chain node constructs a unique public key by using the j-th public key segment of each block chain node participating in the consensus, where j is a natural number less than or equal to M;
  • the blockchain node uses the prepare votes of the M nodes to construct a second signature
  • the blockchain node determines the second signature as a random number.
  • the block chain node calculates N values corresponding to the code of each node according to its own M private key fragments, and sends the calculated values to other nodes that meet the corresponding codes, including:
  • the blockchain node constructs a (M-1)-order polynomial with M terms, the coefficients of the polynomial are sequentially M private key segments of the blockchain node, and the code of each node is sequentially used as the Input variable values of the polynomial into the polynomial to obtain N values of the blockchain node;
  • the blockchain node determines the code for calculating each value, and sends each value to the node corresponding to the determined code according to the determined code.
  • the synthesizing the first signature of the blockchain node according to the value corresponding to its own code stored on the blockchain node includes:
  • the hash value of the block to be consensus is signed to obtain the first signature of the blockchain node.
  • the block chain node constructing the second signature using prepare voting of M nodes includes:
  • the block chain node uses the first signature included in the prepare vote of the M nodes to construct an equation set consisting of M equations, and the second signature is obtained by solving the second signature.
  • the second signature is the j-th segment private of each block chain node participating in the consensus.
  • the signature of the hash value of the consensus block after the accumulation of the key fragments.
  • the method further includes:
  • the blockchain node obtains the execution result of the block, and determines the commit identifier in the commit phase
  • the blockchain node constructs a commit vote for the blockchain node according to the execution result, the random number, and the commit identifier
  • the blockchain node determines that the block can be submitted.
  • the method further includes:
  • the blockchain node determines that the block withdrawal has failed
  • the blockchain node obtains the generated new random number, and performs block extraction according to the new random number.
  • the present invention provides a random number generation method, which is applied to a blockchain system, and the method includes:
  • the first signature of each node is synthesized according to the value stored on each node corresponding to its own code, and the prepare vote for each node to treat the consensus block is constructed according to the first signature of each node ;
  • the second signature passes the verification, the second signature is determined as a random number.
  • the calculating N values corresponding to the code of each node according to the M private key segments of each node, and sending the calculated values to the nodes that comply with the corresponding code respectively includes:
  • each value is sent to the node corresponding to the determined code.
  • said synthesizing the first signature of each node according to the value corresponding to its own code stored on each node includes:
  • the hash value of the block to be consensus is signed to obtain the first signature of each node.
  • the constructing the second signature using prepare voting of M nodes includes:
  • the second signature is the accumulation of the j-th private key fragment of each blockchain node participating in the consensus.
  • the method further includes:
  • the block is submitted.
  • the method further includes:
  • the block is extracted according to the new random number.
  • the present invention further provides a blockchain node, the blockchain node includes:
  • Storage device storing at least one instruction
  • the processing device executes the instructions stored in the storage device to implement the random number generation method.
  • the present invention further provides a blockchain system, which includes:
  • Memory storing at least one instruction
  • the processor executes the instructions stored in the memory to implement the random number generation method.
  • the present invention further provides a random number generation device, which includes:
  • the determination unit is used to determine the N nodes participating in the consensus in the blockchain system and the code of each node;
  • the sending unit is configured to calculate N values corresponding to the code of each node according to the M private key segments of each node and send the calculated values to the nodes that comply with the corresponding code respectively;
  • the construction unit is also used to synthesize the first signature of each node according to the value stored on each node corresponding to its own code when there is a block requiring consensus, and construct each node according to the first signature of each node The node prepares voting for the consensus block;
  • the construction unit is also used to construct a unique public key using the j-th segment of the public key segment of each blockchain node participating in the consensus, where j is a natural number less than or equal to M;
  • the construction unit is also used to construct a second signature by using the prepare votes of the M nodes when the number of nodes whose prepare votes have passed verification reaches M;
  • a verification unit configured to verify the second signature by using the unique public key
  • the determining unit is further configured to determine the second signature as a random number when the second signature passes verification.
  • the sending unit is specifically configured to:
  • each value is sent to the node corresponding to the determined code.
  • the construction unit synthesizing the first signature of each node according to the value corresponding to its own code stored on each node includes:
  • the hash value of the block to be consensus is signed to obtain the first signature of each node.
  • the construction unit using the prepare voting of M nodes to construct the second signature includes:
  • the second signature is the accumulation of the j-th private key fragment of each blockchain node participating in the consensus.
  • the device further includes:
  • the execution unit is used to execute the block to obtain the execution result
  • the determining unit is also used to determine the commit identifier in the commit phase
  • the construction unit is further configured to construct a commit vote for each node according to the execution result, the random number, and the commit identifier;
  • the submission unit is configured to submit the block when the nodes whose commit votes are verified are greater than the preset ratio.
  • the device further includes:
  • the determining unit is further configured to determine that the block extraction fails when the number of nodes that have passed the prepare vote for verification has not reached M, and/or the number of nodes that have passed the commit vote for verification has not reached M within a preset time;
  • the block extraction unit is used to extract blocks according to the new random number.
  • the present invention can generate random numbers in combination with a verifiable key sharing mechanism and a preset signature algorithm on a blockchain system, and has the characteristics of decentralization.
  • the random number is a unique private key pair area constructed by some nodes.
  • the hash value of the block is generated by threshold signature, so that the random number has uncontrollable and unpredictable characteristics including the block proposer, and the use of the preset signature algorithm ensures that the random number can be verified by all nodes , To ensure its public and verifiable characteristics.
  • the information interaction process using the preset signature algorithm is integrated into the prepare voting phase of the Byzantine fault-tolerant algorithm, which saves interaction time.
  • the random number can be directly applied to the currently generated block Therefore, the real-time availability of random numbers is also guaranteed.
  • FIG. 1 is a schematic flowchart of an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of another embodiment of the present invention.
  • FIG. 3 is a schematic diagram of the internal structure of a blockchain system disclosed in an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of the structure of a blockchain node disclosed in an embodiment of the present invention.
  • Fig. 5 is a schematic diagram of functional modules of the random number generating device of the present invention.
  • first, second, third, “fourth”, etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are only used Describe the purpose, but cannot be understood as indicating or implying its relative importance or implicitly indicating the quantity of the indicated technical features. Therefore, the features defined with “first” and “second” may explicitly or implicitly include at least one of the features. It does not have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in a sequence other than the content illustrated or described herein.
  • the invention provides a random number generation method.
  • FIG. 1 it is a schematic flowchart of an embodiment of the present invention. According to different needs, the sequence of the steps in the flow chart can be changed, and some steps can be omitted.
  • the random number generation method is applied to a blockchain system composed of one or more blockchain nodes.
  • the blockchain node is a type that can automatically perform numerical calculations and/or according to pre-set or stored instructions.
  • the hardware equipment of the blockchain node includes, but is not limited to, a microprocessor, an application specific integrated circuit (ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), and digital processing Digital Signal Processor (DSP), embedded devices, etc.
  • ASIC application specific integrated circuit
  • FPGA programmable gate array
  • DSP digital processing Digital Signal Processor
  • the blockchain node can be any electronic product that can interact with users with humans, such as personal computers, tablet computers, smart phones, personal digital assistants (Personal Digital Assistant, PDA), game consoles, and interactive networks. Television (Internet Protocol Television, IPTV), smart wearable devices, etc.
  • PDA Personal Digital Assistant
  • IPTV Internet Protocol Television
  • smart wearable devices etc.
  • the blockchain node may also include network equipment and/or user equipment.
  • the network device includes, but is not limited to, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on cloud computing.
  • the network where the blockchain node is located includes but is not limited to the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (Virtual Private Network, VPN), etc.
  • VPN Virtual Private Network
  • the method includes:
  • the blockchain node determines N nodes including itself to participate in the consensus, and obtains the code of each node.
  • the system where the blockchain node is located adopts the PBFT (Practical Byzantine Fault Tolerance, Practical Byzantine Fault Tolerance) consensus algorithm.
  • PBFT Practical Byzantine Fault Tolerance
  • the codes of N nodes can be 1, 2, 3...N, assuming that there are 4 nodes A, B, C, and D, the codes are 1, 2, 3, and 4 respectively.
  • Each public-private key segment pair includes a public key segment and a private key segment, where all public key segments are disclosed to other nodes in the blockchain system after construction.
  • the 3 public key fragments of node A can be expressed as bPK A1 , bPK A2 and bPK A3 , and the 3 private key fragments of node A are bSK A1 , bSK A2 and bSK A3 respectively .
  • S12 The blockchain node calculates N values corresponding to the code of each node according to its own M private key segments, sends the calculated values to other nodes that meet the corresponding codes, and receives the values sent by other nodes .
  • substitutes x 1, 2, 3, 4 as variable values into the polynomial, and calculates F A (1), F A (2), F A (3) and F A (4) as the nodes respectively.
  • F A (1) bSK A1 + bSK A2 + bSK A3
  • F A (2) bSK A1 + 2bSK A2 + 4bSK A3
  • F A (3) bSK A1 + 3bSK A2 + 9bSK A3
  • F a (4) bSK A1 + 4bSK A2 + 16bSK A3; further, node a F. a (2) the secret to a node B corresponding to the number 2, the F a (3) the secret to a corresponding number node C 3, and F. a (4) to a secret number 4 corresponds to the node D, i.e. the node a to retain only the value F a (1).
  • the blockchain system performs the same operation on node B, node C, and node D.
  • F B (1) bSK B1 +bSK B2 +bSK B3
  • F C (1) bSK C1 +bSK C2 +bSK C3
  • F D (1) bSK D1 + bSK D2 + bSK D3
  • the node B has F A (2), F B (2), F C (2), and F D (2)
  • the node D has F A (4), F B (4), F C (4) and F D (4).
  • the blockchain node uses its pre-created first private key to sign the prepare vote, and then broadcasts the signature and prepare vote to other nodes participating in the consensus. After receiving the signature and prepare vote, other nodes use the blockchain The first public key published by the node in advance is verified.
  • the blockchain node can create a first public-private key pair in advance for use in the PBFT consensus process.
  • the first public-private key pair includes the first private key and the first public key, which can be asymmetric in the prior art.
  • the key generation algorithm will not be repeated here.
  • the proposed node generates a consensus block, and sends the consensus block to other nodes for consensus.
  • a blockchain node may obtain the hash value of the block to be agreed upon, and accumulate the stored N values, and then sign the hash value of the block to be agreed upon to obtain the first signature.
  • the hash value of the block to be consensus obtained is BlockHash
  • the block chain system constructing a prepare vote for each node to treat the consensus block according to the first signature of each node includes:
  • the blockchain system constructs a prepare vote for each node based on the first signature of each node, the hash value of the block, and the prepare identifier in the prepare phase.
  • the prepare identifier is used to indicate that it is currently in the prepare stage.
  • the prepare vote of each node may be expressed as (Sig F, i, BlockHash, prepare identification), and the prepare vote of the node A may be expressed as (Sig F, 1, BlockHash, prepare identification).
  • S14 Send prepare votes to other blockchain nodes participating in the consensus, and receive prepare votes sent by other blockchain nodes.
  • the blockchain node constructs a unique public key by using the j-th public key segment of each blockchain node participating in the consensus, where j is a natural number less than or equal to M.
  • the blockchain node can extract a segment from the public key segment of each node to create a unique public key.
  • the blockchain node uses the first signature Sig F,i included in the prepare voting of M nodes to construct the second signature.
  • the detailed construction process is as follows:
  • the blockchain nodes transform Sig F,1 , Sig F,2 , Sig F,3 , and Sig F,4:
  • Sig F,3 (bSK A1 +bSKB 1 +bSK C1 +bSK D1 )*BlockHash+3(bSK A2 +bSKB 2 +bSK C2 +bSK D2 )*BlockHash+9(bSK A3 +bSKB 3 + bSK C3 +bSK D3 )*BlockHash;
  • Sig F,4 (bSK A1 +bSKB 1 +bSK C1 +bSK D1 )*BlockHash+4(bSK A2 +bSKB 2 +bSK C2 +bSK D2 )*BlockHash+16(bSK A3 +bSKB 3 +bSK C3 +bSK D3 )*BlockHash;
  • the second signature can be solved by using 3 of Sig F,1 , Sig F,2 , Sig F,3 , and Sig F,4.
  • the second signature can be verified.
  • the present invention can generate random numbers in combination with a verifiable key sharing mechanism and a preset signature algorithm on a blockchain system, and has the characteristics of decentralization.
  • the random number is a unique private key pair area constructed by some nodes.
  • the hash value of the block is generated by threshold signature, so that the random number has uncontrollable and unpredictable characteristics including the block proposer, and the use of the preset signature algorithm ensures that the random number can be verified by all nodes , To ensure its public and verifiable characteristics.
  • the information interaction process using the preset signature algorithm is integrated into the prepare voting phase of the Byzantine fault-tolerant algorithm, which saves interaction time.
  • the random number can be directly applied to the currently generated block Therefore, the real-time availability of random numbers is also guaranteed.
  • the above method is applied to the block chain node, and the block chain node belongs to one of the many nodes in the block chain system. Therefore, the following will be applied to the block chain system in the embodiment The method is described in detail.
  • FIG. 2 is a schematic flowchart of another embodiment of the present invention. According to different needs, the sequence of the steps in the flow chart can be changed, and some steps can be omitted.
  • S20 Determine N nodes participating in the consensus in the blockchain system and the code of each node.
  • the current random number generation schemes mainly include the following:
  • the block hash value comes from a set of uncertain transactions from multiple parties, and the block timestamp is the uncertain block generation time. These factors are random to a certain extent. However, the block generation is proposed by a certain node, so the node can influence these factors to a certain extent. For example, when packaging transactions, selectively packaging so that the final hash value is close to the value that is beneficial to oneself, the generated random number is not uncontrollable.
  • VRF algorithm Verifiable Random Functions
  • RANDAO algorithm Verifiable Delay Function, verifiable delay function
  • VRF algorithm when using the VRF algorithm to generate random numbers, multiple nodes usually perform VRF calculations separately, and then perform certain processing and selection on the VRF calculation results of multiple nodes to obtain the final random number.
  • the distributed feature of the blockchain makes it necessary to process the VRF calculation results of multiple nodes in a leader role. The leader can choose the VRF calculation results that are beneficial to him, thereby controlling the random number to a certain extent. The generation.
  • this case proposes a method that combines the Verified Secret Share (VSS) and the BLS threshold signature algorithm (BLS threshold sig) to generate random numbers. Because the above algorithms can be used Partial derivation of the whole, therefore, the blockchain system must first determine the N nodes participating in the consensus in the blockchain system and the code of each node.
  • VSS Verified Secret Share
  • BLS threshold sig BLS threshold signature algorithm
  • the N nodes participate in the PBFT (Practical Byzantine Fault Tolerance, Practical Byzantine Fault Tolerance) consensus process.
  • PBFT Practical Byzantine Fault Tolerance
  • this consensus algorithm when more than 2/3 of the nodes reach a consensus, the entire system Reach an agreement.
  • the PBFT consensus process includes the following three stages:
  • the code of each node can be sequentially: 1-N, where N is an integer greater than zero.
  • S21 Construct M public and private key fragment pairs of each node itself based on the verifiable key sharing mechanism.
  • M is an integer
  • M roundup (preset ratio*N).
  • the preset ratio may include 2/3, etc., to comply with the PBFT consensus algorithm.
  • the above configuration method is combined with the PBFT consensus algorithm.
  • the blockchain system based on a verifiable key sharing mechanism, constructing M public and private key fragment pairs of each node itself includes:
  • the blockchain system is based on a verifiable key sharing mechanism, and uses an elliptic curve algorithm to construct M public and private key fragment pairs of each node itself.
  • the characteristics of the PBFT consensus and the elliptic curve algorithm can be well combined. Since the elliptic curve algorithm has bilinear mapping characteristics, the PBFT consensus process also reaches a consensus after receiving votes from nodes exceeding the preset ratio. Therefore, combined with a verifiable key sharing mechanism, it is possible to construct the overall unique public key and unique private key respectively by using only some of the constructed public key fragments and private key fragments.
  • the blockchain system can also construct a set of public and private key pairs pPk/pSK to implement the PBFT consensus process.
  • the blockchain system may construct the group of public and private key pairs through an asymmetric encryption algorithm, and the group of public and private key pairs are verifiable.
  • S22 Calculate N values corresponding to the code of each node according to the M private key segments of each node, and send the calculated values to the nodes that conform to the corresponding codes, respectively.
  • the blockchain system calculates N values corresponding to the code of each node according to the M private key segments of each node, and sends the calculated values to the corresponding codes.
  • the nodes include:
  • the blockchain system constructs a (M-1)-order polynomial with M terms, and the coefficients of the polynomial are the M private key segments of the node in turn, and the code of each node is used as the The variable value of the polynomial is input into the polynomial, and N values of the node are obtained. Further, the blockchain system determines the code for calculating each value, and sends each value to the company according to the determined code. Describe the node corresponding to the determined code.
  • the blockchain system performs the same operation on node B, node C, and node D.
  • F B (1) bSK B1 +bSK B2 +bSK B3
  • F C (1) bSK C1 +bSK C2 +bSK C3
  • F D (1) bSK D1 + bSK D2 + bSK D3
  • the node B has F A (2), F B (2), F C (2), and F D (2)
  • the node D has F A (4), F B (4), F C (4) and F D (4).
  • each node after calculating the N values corresponding to the code of each node based on the M private key fragments of each node, if the node changes at this time, each node is reconstructed according to the new node. The number of nodes.
  • the block chain system synthesizing the first signature of each node according to the value stored on each node and corresponding to its own code includes:
  • the blockchain system obtains the hash value of the block to be agreed upon, and further accumulates the N values stored by each node and then signs the hash value of the block to be agreed upon to obtain the first signature of each node .
  • the cumulative sum of the values on the node A is: F A (1) + F B (1) + F C (1) + F D (1)
  • the obtained block The hash value of is BlockHash
  • the block chain system constructing a prepare vote for each node to treat the consensus block according to the first signature of each node includes:
  • the blockchain system constructs a prepare vote for each node based on the first signature of each node, the hash value of the block, and the prepare identifier in the prepare phase.
  • the prepare identifier is used to indicate that it is currently in the prepare stage.
  • the prepare vote of the node A can be expressed as (Sig F, i , BlockHash, prepare identifier).
  • j is a natural number less than or equal to M.
  • the blockchain system can extract the first private key fragment and the first public key fragment of each node.
  • the N private key segments may be the first private key segment bSK A1 of the node A and the first private key segment bSK B1 of the node B.
  • the second public key fragment and the third public key fragment of each node can also be extracted to construct a unique public key.
  • the set of private key fragments used when constructing the second signature in the subsequent steps is the same as The public key fragment contained in the unique public key can correspond.
  • the blockchain system uses the public and private key corresponding to each node to sign each prepare vote with the private key pSK in pPk/pSK, and each The prepare vote is broadcast to other nodes, and then the public key pPk in the public-private key pair corresponding to each node is used to verify each prepare vote.
  • the constructed public key or public key fragments are published for verification.
  • the blockchain system using the prepare voting of M nodes to construct the second signature includes:
  • the block chain system uses the first signature included in the prepare vote of the M nodes to construct an equation set consisting of M equations, and the second signature is obtained by solving the second signature.
  • the second signature is the jth of each block chain node participating in the consensus.
  • the signature of the hash value of the consensus block after the accumulation of the private key fragments.
  • the blockchain nodes transform Sig F,1 , Sig F,2 , Sig F,3 , and Sig F,4:
  • Sig F,3 (bSK A1 +bSKB 1 +bSK C1 +bSK D1 )*BlockHash+3(bSK A2 +bSKB 2 +bSK C2 +bSK D2 )*BlockHash+9(bSK A3 +bSKB 3 + bSK C3 +bSK D3 )*BlockHash;
  • Sig F,4 (bSK A1 +bSKB 1 +bSK C1 +bSK D1 )*BlockHash+4(bSK A2 +bSKB 2 +bSK C2 +bSK D2 ) *BlockHash+16(bSK A3 +bSKB 3 +bSK C3 +bSK D3 )*BlockHash;
  • the second signature can be solved by using 3 of Sig F,1 , Sig F,2 , Sig F,3 , and Sig F,4.
  • the random number is equivalent to the threshold signature generated by the unique private key constructed by some nodes on the hash value of the block, so that the random number has uncontrollable and unpredictable characteristics including the block proposer.
  • the use of the BLS threshold signature algorithm ensures that the random number can be verified by all nodes, ensuring its public verifiable characteristics.
  • the information interaction process using the BLS threshold signature algorithm is integrated into the prepare voting phase of the Byzantine fault-tolerant algorithm, saving interaction time. Because it is implemented on the blockchain, it also has the characteristics of decentralization.
  • the blockchain system may use the unique public key to verify the second signature.
  • each blockchain node in the blockchain system can verify the second signature. If the second signature is correct, then each blockchain node can successfully verify the first signature. Two signatures.
  • the second signature when the second signature passes verification, it indicates that the second signature satisfies verifiability and can be determined as the random number.
  • the method further includes:
  • the blockchain system executes the block to obtain the execution result, and further determines the commit identifier in the commit phase.
  • the blockchain system constructs the commit identifier for each node according to the execution result, the random number, and the commit identifier. Commit voting, when the nodes whose commit voting is verified are greater than the preset ratio, the blockchain system submits the block.
  • the next stage can be directly entered, ensuring the real-time availability of the random number.
  • the method further includes:
  • the blockchain system determines that the block extraction has failed. Further, the zone The block chain system generates a new random number, and performs block extraction according to the new random number.
  • the block when it is determined that the block extraction fails, the block can be retrieved in time to avoid affecting the normal execution of the task of the blockchain system.
  • the present invention can generate random numbers in combination with a verifiable key sharing mechanism and a preset signature algorithm on a blockchain system, and has the characteristics of decentralization.
  • the random number is a unique private key pair area constructed by some nodes.
  • the hash value of the block is generated by threshold signature, so that the random number has uncontrollable and unpredictable characteristics including the block proposer, and the use of the preset signature algorithm ensures that the random number can be verified by all nodes , To ensure its public and verifiable characteristics.
  • the information interaction process using the preset signature algorithm is integrated into the prepare voting phase of the Byzantine fault-tolerant algorithm, which saves interaction time.
  • the random number can be directly applied to the currently generated block Therefore, the real-time availability of random numbers is also guaranteed.
  • the blockchain system 1 may be a node constituting a content distribution network or a blockchain network.
  • the blockchain system 1 may include a memory 12, a processor 13, and a bus, and may also include a computer program stored in the memory 12 and running on the processor 13, such as a random number generating program.
  • the blockchain system 1 can be either a bus-type structure or a satellite. Structure, the blockchain system 1 may also include more or less other hardware or software than shown in the figure, or different component arrangements. For example, the blockchain system 1 may also include input and output devices, network connections Into the equipment, etc.
  • the memory 12 includes at least one type of readable storage medium, the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. .
  • the memory 12 may be an internal storage unit of the blockchain system 1 in some embodiments, such as a mobile hard disk of the blockchain system 1.
  • the memory 12 may also be an external storage device of the blockchain system 1, such as a plug-in mobile hard disk, a smart media card (SMC), and a secure digital ( Secure Digital, SD card, Flash Card, etc.
  • the memory 12 may also include both an internal storage unit of the blockchain system 1 and an external storage device.
  • the memory 12 can be used not only to store application software and various types of data installed in the blockchain system 1, such as codes of a random number generation program, etc., but also to temporarily store data that has been output or will be output.
  • the processor 13 may be composed of integrated circuits in some embodiments, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same function or different functions, including one or more central processing units. Combinations of central processing unit (CPU), microprocessor, digital processing chip, graphics processor, and various control chips.
  • the processor 13 is the control core (Control Unit) of the blockchain system 1. It uses various interfaces and lines to connect the various components of the entire blockchain system 1, and runs or executes programs stored in the memory 12 or Modules (for example, execute random number generation programs, etc.), and call data stored in the memory 12 to execute various functions of the blockchain system 1 and process data.
  • the processor 13 executes the operating system of the blockchain system 1 and various installed applications.
  • the processor 13 executes the application program to implement the steps in the foregoing embodiments of the random number generation method, such as steps S20, S21, S22, S23, S24, S25, S26, and S27 shown in FIG. 2.
  • the first signature of each node is synthesized according to the value stored on each node corresponding to its own code, and the prepare vote for each node to treat the consensus block is constructed according to the first signature of each node ;
  • the second signature passes the verification, the second signature is determined as a random number.
  • the computer program may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 12 and executed by the processor 13 to complete this invention.
  • the one or more modules/units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the blockchain system 1.
  • the computer program may be divided into a determination unit 110, a construction unit 111, a sending unit 112, a verification unit 114, an execution unit 115, a submission unit 116, a generation unit 117, and a block extraction unit 118.
  • the above-mentioned integrated unit implemented in the form of a software function module may be stored in a computer readable storage medium.
  • the above-mentioned software function module is stored in a storage medium and includes several instructions to make a computer device (which may be a personal computer, a computer device, or a network device, etc.) or a processor execute the method described in each embodiment of the present invention part.
  • the integrated modules/units of the blockchain system 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing related hardware devices through a computer program.
  • the computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, it can implement the steps of the foregoing method embodiments.
  • the computer program includes computer program code
  • the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory) .
  • the bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one arrow is used to indicate in FIG. 3, but it does not mean that there is only one bus or one type of bus.
  • the bus is configured to implement connection and communication between the memory 12 and at least one processor 13 and the like.
  • the blockchain system 1 may also include a power source (such as a battery) for supplying power to various components.
  • the power source may be logically connected to the at least one processor 13 through a power management device, thereby managing power
  • the device implements functions such as charge management, discharge management, and power consumption management.
  • the power supply may also include any components such as one or more DC or AC power supplies, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators.
  • the blockchain system 1 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
  • the blockchain system 1 may also include a network interface.
  • the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the The blockchain system 1 establishes a communication connection with other blockchain systems.
  • the blockchain system 1 may also include a user interface
  • the user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface, wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
  • the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the blockchain system 1 and to display a visualized user interface.
  • FIG. 3 only shows the blockchain system 1 with components 12-13. Those skilled in the art can understand that the structure shown in FIG. 3 does not constitute a limitation on the blockchain system 1, and may include ratios Fewer or more parts are shown, or some parts are combined, or different parts are arranged.
  • the memory 12 in the blockchain system 1 stores multiple instructions to implement a random number generation method, and the processor 13 can execute the multiple instructions to achieve:
  • the first signature of each node is synthesized according to the value stored on each node corresponding to its own code, and the prepare vote for each node to treat the consensus block is constructed according to the first signature of each node ;
  • the second signature passes the verification, the second signature is determined as a random number.
  • the blockchain node 2 may include a storage device 22, a processing device 23, and a bus, and may also include a computer program stored in the storage device 22 and running on the processing device 23, such as a random number generation program.
  • the storage device 22 includes at least one type of readable storage medium, which can be used to store application software and various types of data installed on the blockchain node 2, such as the code of a random number generation program.
  • the processing device 23 is the control core (Control Unit) of the blockchain node 2. It uses various interfaces and lines to connect the various components of the entire blockchain node 2 and runs or executes programs stored in the storage device 22. Or a module (for example, execute a random number generation program, etc.), and call the data stored in the storage device 22 to perform various functions of the blockchain node 2 and process data.
  • Control Unit Control Unit
  • blockchain node 2 is only an example, and other existing or future electronic products that can be adapted to the present invention should also be included in the scope of protection of the present invention and included by reference Here.
  • the random number generation device 11 includes a determination unit 110, a construction unit 111, a sending unit 112, a verification unit 114, an execution unit 115, a submission unit 116, a generation unit 117, and a block extraction unit 118.
  • the module/unit referred to in the present invention refers to a series of computer program segments that can be executed by the processor 13 and can complete fixed functions, and are stored in the memory 12. In this embodiment, the functions of each module/unit will be described in detail in subsequent embodiments.
  • the determining unit 110 determines the N nodes participating in the consensus in the blockchain system and the code of each node.
  • the current random number generation schemes mainly include the following:
  • the block hash value comes from a set of uncertain transactions from multiple parties, and the block timestamp is the uncertain block generation time. These factors are random to a certain extent. However, the block generation is proposed by a certain node, so the node can influence these factors to a certain extent. For example, when packaging transactions, selectively packaging so that the final hash value is close to the value that is beneficial to oneself, the generated random number is not uncontrollable.
  • VRF algorithm Verifiable Random Functions
  • RANDAO algorithm Verifiable Delay Function, verifiable delay function
  • VRF algorithm when using the VRF algorithm to generate random numbers, multiple nodes usually perform VRF calculations separately, and then perform certain processing and selection on the VRF calculation results of multiple nodes to obtain the final random number.
  • the distributed feature of the blockchain makes it necessary to process the VRF calculation results of multiple nodes in a leader role. The leader can choose the VRF calculation results that are beneficial to him, thereby controlling the random number to a certain extent. The generation.
  • this case proposes a method that combines verifiable secret sharing (VSS) and BLS threshold signature algorithm (BLS threshold sig) to generate random numbers. Because the above algorithms can Partially derives the whole. Therefore, the determining unit 110 must first determine the N nodes participating in the consensus in the blockchain system and the code of each node.
  • VSS verifiable secret sharing
  • BLS threshold sig BLS threshold signature algorithm
  • the N nodes participate in the PBFT (Practical Byzantine Fault Tolerance, Practical Byzantine Fault Tolerance) consensus process.
  • PBFT Practical Byzantine Fault Tolerance
  • this consensus algorithm when more than 2/3 of the nodes reach a consensus, the entire system Reach an agreement.
  • the PBFT consensus process includes the following three stages:
  • the code of each node can be sequentially: 1-N, where N is an integer greater than zero.
  • the construction unit 111 constructs M public and private key fragment pairs of each node itself based on the verifiable key sharing mechanism.
  • M is an integer
  • M roundup (preset ratio*N).
  • the preset ratio may include 2/3, etc., to comply with the PBFT consensus algorithm.
  • the above configuration method is combined with the PBFT consensus algorithm.
  • the construction unit 111 based on a verifiable key sharing mechanism to construct M public and private key fragment pairs of each node itself includes:
  • the construction unit 111 is based on a verifiable key sharing mechanism and uses an elliptic curve algorithm to construct M public and private key fragment pairs of each node itself.
  • the characteristics of the PBFT consensus and the elliptic curve algorithm can be well combined. Since the elliptic curve algorithm has bilinear mapping characteristics, the PBFT consensus process also reaches a consensus after receiving votes from nodes exceeding the preset ratio. Therefore, combined with a verifiable key sharing mechanism, it is possible to construct the overall unique public key and unique private key respectively by using only some of the constructed public key fragments and private key fragments.
  • the construction unit 111 can also construct a set of public and private key pairs pPk/pSK for implementing the PBFT consensus process.
  • the construction unit 111 may construct the group of public-private key pairs through an asymmetric encryption algorithm, and the group of public-private key pairs are verifiable.
  • the sending unit 112 calculates N values corresponding to the code of each node according to the M private key segments of each node, and sends the calculated values to the nodes that conform to the corresponding codes, respectively.
  • the sending unit 112 calculates N values corresponding to the code of each node according to the M private key fragments of each node, and sends the calculated values to the code corresponding to the corresponding code.
  • the nodes include:
  • the sending unit 112 constructs a polynomial of order (M-1) with M terms, the coefficients of the polynomial are sequentially M private key segments of the node, and the code of each node is sequentially used as the The variable value of the polynomial is input into the polynomial to obtain N values of the node. Further, the sending unit 112 determines the code for calculating each value, and sends each value to the determined code according to the determined code. The node corresponding to the code.
  • the sending unit 112 performs the same operation on the node B, the node C, and the node D.
  • F B (1) bSK B1 +bSK B2 +bSK B3
  • F C (1) bSK C1 +bSK C2 +bSK C3
  • F D (1) bSK D1 + bSK D2 + bSK D3
  • the node B has F A (2), F B (2), F C (2), and F D (2)
  • the node D has F A (4), F B (4), F C (4) and F D (4).
  • each node after calculating the N values corresponding to the code of each node based on the M private key fragments of each node, if the node changes at this time, each node is reconstructed according to the new node. The number of nodes.
  • the construction unit 111 synthesizes the first signature of each node according to the value stored on each node corresponding to its own code, and constructs the consensus for each node according to the first signature of each node The prepare vote of the block.
  • the construction unit 111 synthesizes the first signature of each node according to the value corresponding to its own code stored on each node, including:
  • the construction unit 111 obtains the hash value of the block to be agreed upon, and further accumulates the N values stored by each node and then signs the hash value of the block to be agreed upon to obtain the first signature of each node.
  • the cumulative sum of the values on the node A is: F A (1) + F B (1) + F C (1) + F D (1)
  • the obtained block The hash value of is BlockHash
  • the constructing unit 111 constructing a prepare vote for each node to be a consensus block according to the first signature of each node includes:
  • the constructing unit 111 constructs a prepare vote for each node using the first signature of each node, the hash value of the block, and the prepare identifier of the prepare phase.
  • the prepare identifier is used to indicate that it is currently in the prepare stage.
  • the prepare vote of the node A can be expressed as (Sig F, i , BlockHash, prepare identifier).
  • the construction unit 111 constructs a unique public key by using the j-th public key segment of each blockchain node participating in the consensus.
  • j is a natural number less than or equal to M.
  • the construction unit 111 may extract the first private key fragment and the first public key fragment of each node.
  • the N private key segments may be the first private key segment bSK A1 of the node A and the first private key segment bSK B1 of the node B.
  • the second public key fragment and the third public key fragment of each node can also be extracted to construct a unique public key.
  • the set of private key fragments used when constructing the second signature in the subsequent steps is the same as The public key fragment contained in the unique public key can correspond.
  • the constructing unit 111 uses the public and private key corresponding to each node to sign each prepare vote with the private key pSK in pPk/pSK, and each prepare vote is signed. The vote is broadcast to other nodes, and then the public key pPk in the public-private key pair corresponding to each node is used to verify each prepare vote.
  • the constructed public key or public key fragments are published for verification.
  • the construction unit 111 uses the prepare votes of the M nodes to construct the second signature.
  • the constructing unit 111 constructing the second signature using prepare voting of M nodes includes:
  • the construction unit 111 uses the first signature included in the prepare voting of the M nodes to construct an equation set consisting of M equations, and the second signature is obtained by solving the second signature.
  • the second signature is the jth segment of each blockchain node participating in the consensus.
  • the blockchain nodes transform Sig F,1 , Sig F,2 , Sig F,3 , and Sig F,4:
  • Sig F,3 (bSK A1 +bSKB 1 +bSK C1 +bSK D1 )*BlockHash+3(bSK A2 +bSKB 2 +bSK C2 +bSK D2 )*BlockHash+9(bSK A3 +bSKB 3 + bSK C3 +bSK D3 )*BlockHash;
  • Sig F,4 (bSK A1 +bSKB 1 +bSK C1 +bSK D1 )*BlockHash+4(bSK A2 +bSKB 2 +bSK C2 +bSK D2 )*BlockHash+16(bSK A3 +bSKB 3 +bSK C3 +bSK D3 )*BlockHash;
  • the second signature can be solved by using 3 of Sig F,1 , Sig F,2 , Sig F,3 , and Sig F,4.
  • the random number is equivalent to the threshold signature generated by the unique private key constructed by some nodes on the hash value of the block, so that the random number has uncontrollable and unpredictable characteristics including the block proposer.
  • the use of the BLS threshold signature algorithm ensures that the random number can be verified by all nodes, ensuring its public verifiable characteristics.
  • the information interaction process using the BLS threshold signature algorithm is integrated into the prepare voting phase of the Byzantine fault-tolerant algorithm, saving interaction time. Because it is implemented on the blockchain, it also has the characteristics of decentralization.
  • the verification unit 114 uses the unique public key to verify the second signature.
  • the verification unit 114 may use the unique public key to verify the second signature.
  • each blockchain node in the blockchain system can verify the second signature. If the second signature is correct, then each blockchain node can successfully verify the first signature. Two signatures.
  • the execution unit 115 determines the second signature as a random number.
  • the second signature when the second signature passes verification, it indicates that the second signature satisfies verifiability and can be determined as the random number.
  • the method further includes:
  • the execution unit 115 executes the block to obtain the execution result, the determination unit 110 determines the commit identifier in the commit phase, and the construction unit 111 constructs each block according to the execution result, the random number, and the commit identifier.
  • the commit vote of the node, when the node whose commit vote is verified is greater than the preset ratio, the submission unit 116 submits the block.
  • the next stage can be directly entered, ensuring the real-time availability of the random number.
  • the method further includes:
  • the determining unit 110 determines that the block extraction fails, and further, the generating unit 117 generates For a new random number, the block extraction unit 118 extracts blocks according to the new random number.
  • the block when it is determined that the block extraction fails, the block can be retrieved in time to avoid affecting the normal execution of the task of the blockchain system.
  • the present invention can generate random numbers in combination with a verifiable key sharing mechanism and a preset signature algorithm on a blockchain system, and has the characteristics of decentralization.
  • the random number is a unique private key pair area constructed by some nodes.
  • the hash value of the block is generated by threshold signature, so that the random number has uncontrollable and unpredictable characteristics including the block proposer, and the use of the preset signature algorithm ensures that the random number can be verified by all nodes , To ensure its public and verifiable characteristics.
  • the information interaction process using the preset signature algorithm is integrated into the prepare voting phase of the Byzantine fault-tolerant algorithm, which saves interaction time.
  • the random number can be directly applied to the currently generated block Therefore, the real-time availability of random numbers is also guaranteed.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website site, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
  • wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium, (for example, a floppy disk, a mobile hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state mobile hard disk (SSD)).
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of a hardware device or a software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , Including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Finance (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

本发明提供了一种随机数生成方法、区块链节点、系统及介质。所述方法包括:基于可验证密钥共享机制构建参与共识的N个节点中每个节点的M个公私钥片段对;计算对应于每个节点的编码的N个数值并发送至符合对应编码的节点;当有区块需要共识时,合成每个节点的第一签名并构建每个节点的prepare投票;利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥;当prepare投票通过验证的节点达到M个时,利用M个节点的prepare投票构建第二签名;验证所述第二签名以确定为随机数。本发明能够结合可验证密钥共享机制及预设签名算法生成随机数,所述随机数具备去中心化、不可控、不可预测、可验证及实时可用性。

Description

随机数生成方法、区块链节点、系统及介质
本申请要求于2019年11月14日提交中国专利局,申请号为201911115674.5、发明名称为“随机数生成方法、区块链节点、系统及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及区块链技术领域,尤其涉及随机数生成方法、区块链节点、系统及介质。
背景技术
随机数的生成是区块链领域内一个非常重要的技术问题。随机数被用于区块链技术方案的很多方面,例如:基于区块链的游戏、抽奖类Dapp(Decentralized Application,去中心化应用程序),以及一些使用随机数作为选取出块依据的区块链方案等。一个好的随机数应该具有不可预测、不可控且可公证的特性。
现有技术方案中,生成的随机数或者仅具有上述的部分特性,或者开销较大,使用相对复杂。
发明内容
本发明的主要目的在于提供随机数生成方法、区块链节点、系统及介质,能够解决随机数生成的问题,且生成的随机数不可预测、不可控制,还能够被各方公正认可。
为实现上述目的,本发明提供一种随机数生成方法,应用于区块链节点所述方法包括:
所述区块链节点确定包括自身在内的N个节点参与共识,并获取每个节点的编码;
基于可验证密钥共享机制,所述区块链节点构建自身的M个公私钥片段对,其中,M、N均为整数,且M=roundup(预设比例*N);
所述区块链节点根据自身的M个私钥片段计算对应于每个节点的编码的N个数值,将计算的数值分别发送至符合对应编码的其他节点,并接收其他节点发送的数值;
当有区块需要共识时,根据所述区块链节点上保存的与自身编码对应的数值合成所述区块链节点的第一签名,并根据所述区块链节点的第一签名构建所述区块链节点对待共识区块的prepare投票;
将prepare投票发送至参与共识的其它区块链节点,以及接收其它区块链节点发送的prepare投票;
所述区块链节点利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥,其中j为小于或等于M的自然数;
当在所述N个节点中,prepare投票通过验证的节点达到M个时,所述区块链节点利用M个节点的prepare投票构建第二签名;
当采用所述唯一公钥验证所述第二签名,且所述第二签名通过验证时,所述区块链节点将所述第二签名确定为随机数。
优选地,所述区块链节点根据自身的M个私钥片段计算对应于每个节点的编码的N个数值,将计算的数值分别发送至符合对应编码的其他节点包括:
所述区块链节点构建具有M项的(M-1)阶多项式,所述多项式的系数依次为所述区块链节点的M个私钥片段,并将每个节点的编码依次作为所述多项式的变量值输入至所述多项式中,得到所述区块链节点的N个数值;
所述区块链节点确定计算每个数值的编码,并根据确定的编码将每个数值发送至与所 述确定的编码相对应的节点。
优选地,所述根据所述区块链节点上保存的与自身编码对应的数值合成所述区块链节点的第一签名包括:
获取待共识区块的哈希值;
将其保存的N个数值累加后对所述待共识区块的哈希值进行签名,得到所述区块链节点的第一签名。
优选地,所述区块链节点利用M个节点的prepare投票构建第二签名包括:
区块链节点利用M个节点的prepare投票中包括的第一签名构建M个方程组成的方程组,求解得到第二签名,第二签名为每个参与共识的区块链节点的第j段私钥片段累加后对待共识区块的哈希值的签名。
优选地,所述方法还包括:
所述区块链节点获取所述区块的执行结果,并确定commit阶段的commit标识;
所述区块链节点根据所述执行结果、所述随机数及所述commit标识构建所述区块链节点的commit投票;
当在所述N个节点中,commit投票通过验证的节点大于所述预设比例时,所述区块链节点确定所述区块能够提交。
优选地,所述方法还包括:
当在预设时间内,prepare投票通过验证的节点没有达到M个,及/或commit投票通过验证的节点没有达到M个时,所述区块链节点确定提块失败;
所述区块链节点获取生成的新随机数,并根据所述新随机数进行提块。
为实现上述目的,本发明提供一种随机数生成方法,应用于区块链系统,所述方法包括:
确定区块链系统中参与共识的N个节点及每个节点的编码;
基于可验证密钥共享机制,构建每个节点自身的M个公私钥片段对,其中,M、N均为整数,且M=roundup(预设比例*N);
根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值并将计算的数值分别发送至符合对应编码的节点;
当有区块需要共识时,根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名,并根据每个节点的第一签名构建每个节点对待共识区块的prepare投票;
利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥,其中j为小于或等于M的自然数;
当prepare投票通过验证的节点达到M个时,利用M个节点的prepare投票构建第二签名;
采用所述唯一公钥验证所述第二签名;
当所述第二签名通过验证时,将所述第二签名确定为随机数。
优选地,所述根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值,并将计算的数值分别发送至符合对应编码的节点包括:
对于每个节点,构建具有M项的(M-1)阶多项式,所述多项式的系数依次为该节点的M个私钥片段,并将每个节点的编码依次作为所述多项式的变量值输入至所述多项式中,得到该节点的N个数值;
确定计算每个数值的编码;
根据确定的编码将每个数值发送至与所述确定的编码相对应的节点。
优选地,所述根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名包括:
获取待共识区块的哈希值;
将每个节点保存的N个数值累加后对所述待共识区块的哈希值进行签名,得到每个节点的第一签名。
优选地,所述利用M个节点的prepare投票构建第二签名包括:
利用M个节点的prepare投票中包括的第一签名构建M个方程组成的方程组,求解得到第二签名,第二签名为每个参与共识的区块链节点的第j段私钥片段累加后对待共识区块的哈希值的签名。
优选地,所述方法还包括:
执行所述区块,得到执行结果;
确定commit阶段的commit标识;
根据所述执行结果、所述随机数及所述commit标识构建每个节点的commit投票;
当commit投票通过验证的节点大于所述预设比例时,提交所述区块。
优选地,所述方法还包括:
当在预设时间内,prepare投票通过验证的节点没有达到M个,及/或commit投票通过验证的节点没有达到M个时,确定提块失败;
生成新随机数;
根据所述新随机数进行提块。
为实现上述目的,本发明进一步提供一种区块链节点,所述区块链节点包括:
存储设备,存储至少一个指令;及
处理设备,执行所述存储设备中存储的指令以实现所述随机数生成方法。
为实现上述目的,本发明进一步提供一种区块链系统,所述区块链系统包括:
存储器,存储至少一个指令;及
处理器,执行所述存储器中存储的指令以实现所述随机数生成方法。
为实现上述目的,本发明进一步提供一种随机数生成装置,所述装置包括:
确定单元,用于确定区块链系统中参与共识的N个节点及每个节点的编码;
构建单元,用于基于可验证密钥共享机制,构建每个节点自身的M个公私钥片段对,其中,M、N均为整数,且M=roundup(预设比例*N);
发送单元,用于根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值并将计算的数值分别发送至符合对应编码的节点;
所述构建单元,还用于当有区块需要共识时,根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名,并根据每个节点的第一签名构建每个节点对待共识区块的prepare投票;
所述构建单元,还用于利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥,其中j为小于或等于M的自然数;
所述构建单元,还用于,用于当prepare投票通过验证的节点达到M个时,利用M个节点的prepare投票构建第二签名;
验证单元,用于采用所述唯一公钥验证所述第二签名;
所述确定单元,还用于当所述第二签名通过验证时,将所述第二签名确定为随机数。
优选地,所述发送单元具体用于:
对于每个节点,构建具有M项的(M-1)阶多项式,所述多项式的系数依次为该节点的M个私钥片段,并将每个节点的编码依次作为所述多项式的变量值输入至所述多项式中,得到该节点的N个数值;
确定计算每个数值的编码;
根据确定的编码将每个数值发送至与所述确定的编码相对应的节点。
优选地,所述构建单元根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名包括:
获取待共识区块的哈希值;
将每个节点保存的N个数值累加后对所述待共识区块的哈希值进行签名,得到每个节点的第一签名。
优选地,所述构建单元,利用M个节点的prepare投票构建第二签名包括:
利用M个节点的prepare投票中包括的第一签名构建M个方程组成的方程组,求解得到第二签名,第二签名为每个参与共识的区块链节点的第j段私钥片段累加后对待共识区块的哈希值的签名。
优选地,所述装置还包括:
执行单元,用于执行所述区块,得到执行结果;
所述确定单元,还用于确定commit阶段的commit标识;
所述构建单元,还用于根据所述执行结果、所述随机数及所述commit标识构建每个节点的commit投票;
提交单元,用于当commit投票通过验证的节点大于所述预设比例时,提交所述区块。
优选地,所述装置还包括:
所述确定单元,还用于当在预设时间内,prepare投票通过验证的节点没有达到M个,及/或commit投票通过验证的节点没有达到M个时,确定提块失败;
生成单元,用于生成新随机数;
提块单元,用于根据所述新随机数进行提块。
综上所述,本发明能够在区块链系统上结合可验证密钥共享机制及预设签名算法生成随机数,具备去中心化的特性,该随机数由部分节点构建的唯一私钥对区块的哈希值进行阈值签名而生成,使得该随机数具有包含区块提议者在内的不可控且不可预测的特性,并且预设签名算法的使用确保了该随机数可被所有节点验证通过,确保了其公开可验证特性,同时,利用预设签名算法的信息交互过程被融合至拜占庭容错算法的prepare投票阶段,节省了交互时间,该随机数可以直接被应用于当前所生成的区块,因此也保证了随机数的实时可用性。
附图说明
图1为本发明一实施例的流程示意图;
图2为本发明另一实施例的流程示意图;
图3为本发明一实施例揭露的区块链系统的内部结构示意图;
图4为本发明一实施例揭露的区块链节点的结构示意图;
图5为本发明随机数生成装置的功能模块示意图。
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示 或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。
本发明提供一种随机数生成方法。
参照图1,为本发明一实施例的流程示意图。根据不同的需求,该流程示意图中步骤的顺序可以改变,某些步骤可以省略。
所述随机数生成方法应用于一个或者多个区块链节点组成的区块链系统中,所述区块链节点是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,所述区块链节点的硬件设备包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。
所述区块链节点可以是任何一种可与用户进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、个人数字助理(Personal Digital Assistant,PDA)、游戏机、交互式网络电视(Internet Protocol Television,IPTV)、智能式穿戴式设备等。
所述区块链节点还可以包括网络设备和/或用户设备。其中,所述网络设备包括,但不限于单个网络服务器、多个网络服务器组成的服务器组或基于云计算(Cloud Computing)的由大量主机或网络服务器构成的云。
所述区块链节点所处的网络包括但不限于互联网、广域网、城域网、局域网、虚拟专用网络(Virtual Private Network,VPN)等。
在一实施例中,该方法包括:
S10,所述区块链节点确定包括自身在内的N个节点参与共识,并获取每个节点的编码。
本实施例中,区块链节点所在系统采用PBFT(Practical Byzantine Fault Tolerance,实用拜占庭容错算法)共识算法,具体可参考本发明其它实施例的描述。
举例来说,N个节点的编码可以为1,2,3……N,假设有4个节点A、B、C、D时,编码分别为1、2、3、4。
S11,基于可验证密钥共享机制,所述区块链节点构建自身的M个公私钥片段对,其中,M、N均为整数,且M=roundup(预设比例*N)。
每个公私钥片段对包括一个公钥片段和一个私钥片段,其中,所有的公钥片段在构建之后向区块链系统中的其它节点公开。
例如:当N=4时,M=3,节点A的3个公钥片段可以表示为bPK A1、bPK A2及bPK A3,节点A的3个私钥片段分别为bSK A1、bSK A2及bSK A3
S12,所述区块链节点根据自身的M个私钥片段计算对应于每个节点的编码的N个数值,将计算的数值分别发送至符合对应编码的其他节点,并接收其他节点发送的数值。
同样以N=4,M=3为例,区块链节点A构建一个3项2阶多项式,记作F(x)=r 1+r 2*x+r 3*x 2,所述节点A的3个私钥片段分别为bSK A1、bSK A2及bSK A3,则所述节点A的多项式为:F A(x)=bSK A1+bSK A2*x+bSK A3*x 2,所述区块链系统将x=1、2、3、4依次作为变量值代入该多项式,分别计算获得F A(1)、F A(2)、F A(3)及F A(4)作为所述节点A的4个数值,F A(1)=bSK A1+bSK A2+bSK A3,F A(2)=bSK A1+2bSK A2+4bSK A3,F A(3)=bSK A1+ 3bSK A2+9bSK A3,F A(4)=bSK A1+4bSK A2+16bSK A3;进一步地,节点A将F A(2)秘密发送给对应于编号2的B节点,将F A(3)秘密发送给对应于编号3的C节点,并将F A(4)秘密发送给对应于编号4的D节点,即所述节点A只保留数值F A(1)。
同理,所述区块链系统对节点B、节点C、节点D执行同样的操作。最后,所述节点A拥有F A(1)=bSK A1+bSK A2+bSK A3、F B(1)=bSK B1+bSK B2+bSK B3、F C(1)=bSK C1+bSK C2+bSK C3及F D(1)=bSK D1+bSK D2+bSK D3,所述节点B拥有F A(2)、F B(2)、F C(2)及F D(2),所述节点C拥有F A(3)、F B(3)、F C(3)及F D(3),且所述节点D拥有F A(4)、F B(4)、F C(4)及F D(4)。
在本发明的至少一个实施例中,在根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值后,此时如果参与共识的节点发生变化,则根据新的节点重新构建每个节点的数值。
S13,当有区块需要共识时,根据所述区块链节点上保存的与自身编码对应的数值合成所述区块链节点的第一签名,并根据所述区块链节点的第一签名构建所述区块链节点对待共识区块的prepare投票。
优选地,区块链节点使用其预先创建的第一私钥对prepare投票进行签名后,将签名与prepare投票一起广播至参与共识的其它节点,其它节点接收签名与prepare投票后,利用区块链节点预先公开的第一公钥进行验证。
需要说明的是,区块链节点可以预先创建第一公私钥对,用于PBFT共识过程,第一公私钥对即包括第一私钥和第一公钥,可以采用现有技术中的非对称密钥生成算法,在此不再赘述。
具体的,提议节点生成待共识区块,并将待共识区块发送到其它节点进行共识。
举例来说,区块链节点可以获取待共识区块的哈希值,并将其保存的N个数值累加后对待共识区块的哈希值进行签名,得到第一签名。
例如:对于所述节点A,获取的待共识区块的哈希值为BlockHash,则所述节点A的第一签名为:Sig F,1=(F A(1)+F B(1)+F C(1)+F D(1))*BlockHash。
在本发明的至少一个实施例中,所述区块链系统根据每个节点的第一签名构建每个节点对待共识区块的prepare投票包括:
所述区块链系统以每个节点的第一签名、所述区块的哈希值及prepare阶段的prepare标识构建每个节点的prepare投票。
其中,所述prepare标识用于表示当前处于prepare阶段。
例如:各节点的prepare投票可以表示为(Sig F,i,BlockHash,prepare标识),其中所述节点A的prepare投票可以表示为(Sig F,1,BlockHash,prepare标识)。
S14,将prepare投票发送至参与共识的其它区块链节点,以及接收其它区块链节点发送的prepare投票。
基于PBFT共识机制,参与共识的所有区块链节点都具有投票的权利。
S15,所述区块链节点利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥,其中j为小于或等于M的自然数。
因为每个节点的公钥片段都是公开的,所以区块链节点可以从每个节点的公钥片段中提取一段来创建唯一公钥,优选的,可以提取每个节点的首段公钥片段来构建唯一公钥,即唯一公钥为:BPK=bPK A1+bPK B1+bPK C1+bPK D1
当然,也可以提取每个节点的第二段公钥片段或第三段公钥片段来构建唯一公钥,后续步骤中在构建第二签名时采用的私钥片段集合与唯一公钥中包含的公钥片段对应即可。
S16,当在所述N个节点中,prepare投票通过验证的节点达到M个时,所述区块链节点利用M个节点的prepare投票构建第二签名。
具体的,区块链节点利用M个节点的prepare投票中包括的第一签名Sig F,i构建第二签名,详细构建过程如下:
假设四个节点都通过了prepare投票,区块链节点对Sig F,1、Sig F,2、Sig F,3、Sig F,4进行变形:
Sig F,1=(F A(1)+F B(1)+F C(1)+F D(1))*BlockHash=((bSK A1+bSK A2+bSK A3)+(bSKB 1+bSK B2+bSK B3)+(bSK C1+bSK C2+bSK C3)+(bSK D1+bSK D2+bSK D3))*BlockHash=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
Sig F,2=(F A(2)+F B(2)+F C(2)+F D(2))*BlockHash=(bSK A1+2bSK A2+4bSK A3)+(bSK B1+2bSK B2+4bSK B3)+(bSK C1+2bSK C2+4bSK C3)+(bSK D1+2bSK D2+4bSK D3)=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+2(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+4(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
依次类推得到,Sig F,3=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+3(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+9(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
Sig F,4=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+4(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+16(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
则通过上述方程组可以解出(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash,即为第二签名SIG BSK=(bSK A1+bSK B1+bSK C1+bSK D1)*BlockHash。
当然实际上,利用Sig F,1、Sig F,2、Sig F,3、Sig F,4的其中3个即可解出第二签名。
S17,当采用所述唯一公钥验证所述第二签名,且所述第二签名通过验证时,所述区块链节点将所述第二签名确定为随机数。
因为第二签名中包含的私钥片段与唯一公钥中的公钥片段对应,所以能够验签所述第二签名。
综上所述,本发明能够在区块链系统上结合可验证密钥共享机制及预设签名算法生成随机数,具备去中心化的特性,该随机数由部分节点构建的唯一私钥对区块的哈希值进行阈值签名而生成,使得该随机数具有包含区块提议者在内的不可控且不可预测的特性,并且预设签名算法的使用确保了该随机数可被所有节点验证通过,确保了其公开可验证特性,同时,利用预设签名算法的信息交互过程被融合至拜占庭容错算法的prepare投票阶段,节省了交互时间,该随机数可以直接被应用于当前所生成的区块,因此也保证了随机数的实时可用性。
上述方法应用于所述区块链节点,而所述区块链节点属于所述区块链系统中众多节点中的一个,因此,下面将以应用于所述区块链系统的实施例对该方法进行详细说明。
参照图2,为本发明另一实施例的流程示意图。根据不同的需求,该流程示意图中步骤的顺序可以改变,某些步骤可以省略。
S20,确定区块链系统中参与共识的N个节点及每个节点的编码。
目前的随机数生成方案主要包括以下几种:
(1)使用链上带有随机属性的因子作为随机数来源,如区块Hash(哈希)值,区块时间戳等。
区块哈希值来自多方不确定的交易集合,区块时间戳为不确定的区块生成时间,这些因子在一定程度上具有随机性。然而区块生成由某个节点提议完成,因此该节点在一定程度上能够影响这些因子。比如在打包交易时,有选择性地打包使得最终哈希值接近对自已有利的值,则生成的随机数不具备不可控性。
(2)使用来自链下的随机信息,如气象数据、地震监测信息等。
来自链下自然界的数据具有真随机、不可预测及完全不可控的特征。然而链下数据传入链上需要一个可行的中间服务来进行,而这种中间服务通常是中心化的,其违背了区块链可验证的去中心化思想。
(3)在链上使用一定的算法生成随机数,例如:VRF算法(Verifiable Random Functions,可验证的随机函数)、RANDAO算法、VDF(Verifiable Delay Function,可验证延迟函数)等。
然而,使用VRF算法生成随机数时,通常由多个节点各自做VRF运算,再对多个节点的VRF运算结果进行一定的处理及选择,得到最终的随机数。区块链的分布式特征使得在对多个节点的VRF运算结果进行处理时,需要在一个leader角色上进行,该leader能够选择对自己有利的VRF运算结果,从而在一定程度上控制了随机数的生成。
在使用RANDA算法生成随机数时,需要多个参与者首先发布自己私有信息的承诺,之后所有参与者公布该承诺对应的信息,再对所有的信息进行异或操作得到最终的随机数。该种方式方案使得最后一个公布信息的参与者可以优先计算出其他参与者的信息结果,再根据计算的结果选择是否公布自己的信息,从而在一定程度上控制了随机数的生成。
在使用VDF算法生成随机数时,随机数的生成需要在多方披露完各自信息后,再进行较长一段时间的计算,该段时间远大于披露信息所需的时间。这样参与者将不能在未披露自己的信息之前计算出最终结果,进而得到一个可公证的、不可预测且不可控制的随机数,然而该段时间的计算使得该随机数获取不够实时,通常情况下,在一个区块上请求的随机数将在后面的某个区块才可获取,因此该方案不适用于那些需要根据随机数立即得出结果的任务,比如即时开奖类游戏Dapp(Decentralized Application,去中心化应用程序)。
鉴于上述几个方案各自存在的缺陷,本案提出了一种结合可验证密钥共享机制(Verified Secret Share,VSS)及BLS阈值签名算法(BLS threshold sig)生成随机数的方法,由于上述算法能够以部分推导整体,因此所述区块链系统首先要确定区块链系统中参与共识的N个节点及每个节点的编码。
在本发明的至少一个实施例中,所述N个节点参与PBFT(Practical Byzantine Fault Tolerance,实用拜占庭容错算法)共识过程,在该共识算法中,当超过2/3的节点达成共识时,整个系统达成一致。
具体地,所述PBFT共识过程包括以下三个阶段:
(1)re-prepare阶段:由leader节点打包区块并分发给其他节点。
(2)Prepare阶段:其他节点收到区块后,验证区块并进行投票,在收到超过2/3节点的投票后,进入下一阶段。
(3)Commit阶段:进行投票,在收到超过2/3节点的投票后,确认区块。
在本发明的至少一个实施例中,每个节点的编码可以依次为:1-N,其中,N为大于0的整数。
S21,基于可验证密钥共享机制构建每个节点自身的M个公私钥片段对。
其中,M为整数,且M=roundup(预设比例*N)。所述预设比例可以包括2/3等,以符合PBFT共识算法。
例如:当N等于4时,M等于3。
上述配置方式与PBFT共识算法相结合,由于在PBFT共识算法中,当收到超过所述预设比例的节点的投票后,则确认达成共识,因此,本案中配置M=roundup(预设比例*N),进而能够使本案融合至PBFT共识算法中。
在本发明的至少一个实施例中,所述区块链系统基于可验证密钥共享机制,构建每个节点自身的M个公私钥片段对包括:
所述区块链系统基于可验证密钥共享机制,并采用椭圆曲线算法构建每个节点自身的 M个公私钥片段对。
在上述实施例中,能够很好的结合PBFT共识及椭圆曲线算法的特性。由于椭圆曲线算法具有双线性映射特性,PBFT共识过程也是在收到超过所述预设比例的节点的投票后达成共识。因此,结合了可验证密钥共享机制,能够在后续只利用构建的公钥片段及私钥片段中的部分片段分别构建出整体的唯一公钥及唯一私钥。
在本发明的至少一个实施例中,所述区块链系统还可以构建一组公私钥对pPk/pSK,用于实现PBFT共识过程。
具体地,所述区块链系统可以通过非对称加密算法构建该组公私钥对,该组公私钥对具有可验证性。
S22,根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值并将计算的数值分别发送至符合对应编码的节点。
在本发明的至少一个实施例中,所述区块链系统根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值,并将计算的数值分别发送至符合对应编码的节点包括:
对于每个节点,所述区块链系统构建具有M项的(M-1)阶多项式,所述多项式的系数依次为该节点的M个私钥片段,并将每个节点的编码依次作为所述多项式的变量值输入至所述多项式中,得到该节点的N个数值,进一步地,所述区块链系统确定计算每个数值的编码,并根据确定的编码将每个数值发送至与所述确定的编码相对应的节点。
例如:当有4个节点A、B、C、D时,M=roundup(预设比例*N)=3,四个节点的编号分别为1、2、3、4。对于节点A,所述区块链系统构建一个3项2阶多项式,记作F(x)=r 1+r 2*x+r 3*x 2,所述节点A的3个私钥片段分别为bSK A1、bSK A2及bSK A3,则所述节点A的多项式为:F A(x)=bSK A1+bSK A2*x+bSK A3*x 2,所述区块链系统将x=1、2、3、4依次作为变量值代入该多项式,分别计算获得F A(1)、F A(2)、F A(3)及F A(4)作为所述节点A的4个数值,F A(1)=bSK A1+bSK A2+bSK A3,F A(2)=bSK A1+2bSK A2+4bSK A3,F A(3)=bSK A1+3bSK A2+9bSK A3;进一步地,所述区块链系统将F A(2)秘密发送给对应于编号2的B节点,将F A(3)秘密发送给对应于编号3的C节点,并将F A(4)秘密发送给对应于编号4的D节点,即所述节点A只保留数值F A(1)。
同理,所述区块链系统对节点B、节点C、节点D执行同样的操作。最后,所述节点A拥有F A(1)=bSK A1+bSK A2+bSK A3、F B(1)=bSK B1+bSK B2+bSK B3、F C(1)=bSK C1+bSK C2+bSK C3及F D(1)=bSK D1+bSK D2+bSK D3,所述节点B拥有F A(2)、F B(2)、F C(2)及F D(2),所述节点C拥有F A(3)、F B(3)、F C(3)及F D(3),且所述节点D拥有F A(4)、F B(4)、F C(4)及F D(4)。
在本发明的至少一个实施例中,在根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值后,此时如果节点发生变化,则根据新的节点重新构建每个节点的数值。
S23,当有区块需要共识时,根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名,并根据每个节点的第一签名构建每个节点对待共识区块的prepare投票。
在本发明的至少一个实施例中,所述区块链系统根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名包括:
所述区块链系统获取待共识区块的哈希值,进一步将每个节点保存的N个数值累加后对所述待共识区块的哈希值进行签名,得到每个节点的第一签名。
例如:对于所述节点A,所述节点A上的数值的累加和为:F A(1)+F B(1)+F C(1)+F D(1),获取的所述区块的哈希值为BlockHash,则所述节点A的第一签名为:Sig F,1=(F A(1)+F B(1)+F C(1)+F D(1))*BlockHash。
在本发明的至少一个实施例中,所述区块链系统根据每个节点的第一签名构建每个节 点对待共识区块的prepare投票包括:
所述区块链系统以每个节点的第一签名、所述区块的哈希值及prepare阶段的prepare标识构建每个节点的prepare投票。
其中,所述prepare标识用于表示当前处于prepare阶段。
例如:所述节点A的prepare投票可以表示为(Sig F,i,BlockHash,prepare标识)。
S24,利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥。
其中,j为小于或等于M的自然数。
具体地,所述区块链系统可以提取每个节点的首个私钥片段及首个公钥片段。
例如:当所述节点A为生成所述区块的节点时,N个私钥片段可以分别为所述节点A的首个私钥片段bSK A1、所述节点B的首个私钥片段bSK B1、所述节点C的首个私钥片段bSK C1、所述节点D的首个私钥片段bSK D1,所述唯一公钥可以表示为:BPK=bPK A1+bPK B1+bPK C1+bPK D1,其中,bPK A1表示所述节点A的首个公钥片段,bPK B1表示所述节点B的首个公钥片段,bPK C1表示所述节点C的首个公钥片段,且bPK D1表示所述节点D的首个公钥片段。
当然,在其他实施例中,也可以提取每个节点的第二段公钥片段、第三段公钥片段来构建唯一公钥,后续步骤中在构建第二签名时采用的私钥片段集合与唯一公钥中包含的公钥片段对应即可。
进一步地,所述区块链系统在构建了每个节点的prepare投票后,利用与每个节点对应的公私钥对pPk/pSK中的私钥pSK对每个prepare投票进行签名,并将每个prepare投票广播至其他节点,后续则以与每个节点对应的公私钥对中的公钥pPk验证每个prepare投票。
在本发明的至少一个实施例中,所构建的公钥或者公钥片段都是被公布的,以供验证使用。
S25,当prepare投票通过验证的节点达到M个时,利用M个节点的prepare投票构建第二签名。
在本发明的至少一个实施例中,所述区块链系统利用M个节点的prepare投票构建第二签名包括:
所述区块链系统利用M个节点的prepare投票中包括的第一签名构建M个方程组成的方程组,求解得到第二签名,第二签名为每个参与共识的区块链节点的第j段私钥片段累加后对待共识区块的哈希值的签名。
详细构建过程如下:
假设四个节点都通过了prepare投票,区块链节点对Sig F,1、Sig F,2、Sig F,3、Sig F,4进行变形:
Sig F,1=(F A(1)+F B(1)+F C(1)+F D(1))*BlockHash=((bSK A1+bSK A2+bSK A3)+(bSKB 1+bSK B2+bSK B3)+(bSK C1+bSK C2+bSK C3)+(bSK D1+bSK D2+bSK D3))*BlockHash=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
Sig F,2=(F A(2)+F B(2)+F C(2)+F D(2))*BlockHash=(bSK A1+2bSK A2+4bSK A3)+(bSK B1+2bSK B2+4bSK B3)+(bSK C1+2bSK C2+4bSK C3)+(bSK D1+2bSK D2+4bSK D3)=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+2(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+4(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
依次类推得到,Sig F,3=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+3(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+9(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
Sig F,4=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+4(bSK A2+bSKB 2+bSK C2+bSK D2) *BlockHash+16(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
则通过上述方程组可以解出(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash,即为第二签名SIG BSK=(bSK A1+bSK B1+bSK C1+bSK D1)*BlockHash。
当然实际上,利用Sig F,1、Sig F,2、Sig F,3、Sig F,4的其中3个即可解出第二签名。
可以理解的是,随机数相当于由部分节点构建的唯一私钥对区块的哈希值进行阈值签名而生成,使得该随机数具有包含区块提议者在内的不可控且不可预测的特性,并且BLS阈值签名算法的使用确保了该随机数可被所有节点验证通过,确保了其公开可验证特性。并且,同时,利用BLS阈值签名算法的信息交互过程被融合至拜占庭容错算法的prepare投票阶段,节省了交互时间。由于在区块链上实现,还具备去中心化的特性。
S26,采用所述唯一公钥验证所述第二签名。
在本发明的至少一个实施例中,由于所述第二签名是根据所述唯一私钥生成,因此,所述区块链系统可以采用所述唯一公钥验证所述第二签名。
具体地,所述区块链系统中的每个区块链节点都可以验证所述第二签名,如果所述第二签名是正确的,那么每个区块链节点都可以成功验证所述第二签名。
S27,当所述第二签名通过验证时,将所述第二签名确定为随机数。
在本发明的至少一个实施例中,当所述第二签名通过验证时,说明所述第二签名满足可验证性,可以被确定为所述随机数。
在本发明的至少一个实施例中,所述方法还包括:
所述区块链系统执行所述区块,得到执行结果,进一步确定commit阶段的commit标识,所述区块链系统根据所述执行结果、所述随机数及所述commit标识构建每个节点的commit投票,当commit投票通过验证的节点大于所述预设比例时,所述区块链系统提交所述区块。
通过上述实施方式,能够在构建了所述随机数后,直接进入下一阶段,确保了所述随机数的实时可用性。
在本发明的至少一个实施例中,所述方法还包括:
当在预设时间内,prepare投票通过验证的节点没有达到M个,及/或commit投票通过验证的节点没有达到M个时,所述区块链系统确定提块失败,进一步地,所述区块链系统生成新随机数,并根据所述新随机数进行提块。
通过上述实施方式,当确定提块失败时,可以及时重新提块,避免影响区块链系统正常执行任务。
综上所述,本发明能够在区块链系统上结合可验证密钥共享机制及预设签名算法生成随机数,具备去中心化的特性,该随机数由部分节点构建的唯一私钥对区块的哈希值进行阈值签名而生成,使得该随机数具有包含区块提议者在内的不可控且不可预测的特性,并且预设签名算法的使用确保了该随机数可被所有节点验证通过,确保了其公开可验证特性,同时,利用预设签名算法的信息交互过程被融合至拜占庭容错算法的prepare投票阶段,节省了交互时间,该随机数可以直接被应用于当前所生成的区块,因此也保证了随机数的实时可用性。
参见图3,在本实施例中,所述区块链系统1可以是组成内容分发网络或者区块链网络的节点。
所述区块链系统1可以包括存储器12、处理器13和总线,还可以包括存储在所述存储器12中并可在所述处理器13上运行的计算机程序,例如随机数生成程序。
本领域技术人员可以理解,所述示意图仅仅是区块链系统1的示例,并不构成对区块链系统1的限定,所述区块链系统1既可以是总线型结构,也可以是星形结构,所述区块 链系统1还可以包括比图示更多或更少的其他硬件或者软件,或者不同的部件布置,例如所述区块链系统1还可以包括输入输出设备、网络接入设备等。
需要说明的是,所述区块链系统1仅为举例,其他现有的或今后可能出现的电子产品如可适应于本发明,也应包含在本发明的保护范围以内,并以引用方式包含于此。
其中,存储器12至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器12在一些实施例中可以是区块链系统1的内部存储单元,例如该区块链系统1的移动硬盘。存储器12在另一些实施例中也可以是区块链系统1的外部存储设备,例如区块链系统1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(Secure Digital,SD)卡、闪存卡(Flash Card)等。进一步地,存储器12还可以既包括区块链系统1的内部存储单元也包括外部存储设备。存储器12不仅可以用于存储安装于区块链系统1的应用软件及各类数据,例如随机数生成程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器13在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。处理器13是所述区块链系统1的控制核心(Control Unit),利用各种接口和线路连接整个区块链系统1的各个部件,通过运行或执行存储在所述存储器12内的程序或者模块(例如执行随机数生成程序等),以及调用存储在所述存储器12内的数据,以执行区块链系统1的各种功能和处理数据。
所述处理器13执行所述区块链系统1的操作系统以及安装的各类应用程序。所述处理器13执行所述应用程序以实现上述各个随机数生成方法实施例中的步骤,例如图2所示的步骤S20、S21、S22、S23、S24、S25、S26、S27。
或者,所述处理器13执行所述计算机程序时实现上述各装置实施例中各模块/单元的功能,例如:
确定区块链系统中参与共识的N个节点及每个节点的编码;
基于可验证密钥共享机制,构建每个节点自身的M个公私钥片段对,其中,M、N均为整数,且M=roundup(预设比例*N);
根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值并将计算的数值分别发送至符合对应编码的节点;
当有区块需要共识时,根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名,并根据每个节点的第一签名构建每个节点对待共识区块的prepare投票;
利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥,其中j为小于或等于M的自然数;
当prepare投票通过验证的节点达到M个时,利用M个节点的prepare投票构建第二签名;
采用所述唯一公钥验证所述第二签名;
当所述第二签名通过验证时,将所述第二签名确定为随机数。
示例性的,所述计算机程序可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器12中,并由所述处理器13执行,以完成本发明。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序在所述区块链系统1中的执行过程。例如,所述计算机程序可以被分割成确定单元110、构建单元111、发送单元112、验证单元114、执行单元115、提交单元116、生成单元117以及提块单元118。
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、计算机设备,或者网络设备等)或处理器(processor)执行本发明各个实施例所述方法的部分。
所述区块链系统1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指示相关的硬件设备来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。
其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,在图3中仅用一根箭头表示,但并不表示仅有一根总线或一种类型的总线。所述总线被设置为实现所述存储器12以及至少一个处理器13等之间的连接通信。
尽管未示出,所述区块链系统1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器13逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述区块链系统1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
进一步地,所述区块链系统1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该区块链系统1与其他区块链系统之间建立通信连接。
可选地,该区块链系统1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在区块链系统1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
图3仅示出了具有组件12-13的区块链系统1,本领域技术人员可以理解的是,图3示出的结构并不构成对所述区块链系统1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
结合图2,所述区块链系统1中的所述存储器12存储多个指令以实现一种随机数生成方法,所述处理器13可执行所述多个指令从而实现:
确定区块链系统中参与共识的N个节点及每个节点的编码;
基于可验证密钥共享机制,构建每个节点自身的M个公私钥片段对,其中,M、N均为整数,且M=roundup(预设比例*N);
根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值并将计算的数值分别发送至符合对应编码的节点;
当有区块需要共识时,根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名,并根据每个节点的第一签名构建每个节点对待共识区块的prepare投票;
利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥,其中j为小于或等于M的自然数;
当prepare投票通过验证的节点达到M个时,利用M个节点的prepare投票构建第二签名;
采用所述唯一公钥验证所述第二签名;
当所述第二签名通过验证时,将所述第二签名确定为随机数。
具体地,所述处理器13对上述指令的具体实现方法可参考图2对应实施例中相关步骤的描述,在此不赘述。
参加图4,为本发明一实施例揭露的区块链节点的结构示意图。所述区块链节点2可以包括存储设备22、处理设备23和总线,还可以包括存储在所述存储设备22中并可在所述处理设备23上运行的计算机程序,例如随机数生成程序。
其中,存储设备22至少包括一种类型的可读存储介质,可以用于存储安装于区块链节点2的应用软件及各类数据,例如随机数生成程序的代码等。
处理设备23是所述区块链节点2的控制核心(Control Unit),利用各种接口和线路连接整个区块链节点2的各个部件,通过运行或执行存储在所述存储设备22内的程序或者模块(例如执行随机数生成程序等),以及调用存储在所述存储设备22内的数据,以执行区块链节点2的各种功能和处理数据。
需要说明的是,所述区块链节点2仅为举例,其他现有的或今后可能出现的电子产品如可适应于本发明,也应包含在本发明的保护范围以内,并以引用方式包含于此。
参照图5,为本发明随机数生成装置的功能模块示意图。所述随机数生成装置11包括确定单元110、构建单元111、发送单元112、验证单元114、执行单元115、提交单元116、生成单元117以及提块单元118。本发明所称的模块/单元是指一种能够被处理器13所执行,并且能够完成固定功能的一系列计算机程序段,其存储在存储器12中。在本实施例中,关于各模块/单元的功能将在后续的实施例中详述。
确定单元110确定区块链系统中参与共识的N个节点及每个节点的编码。
目前的随机数生成方案主要包括以下几种:
(1)使用链上带有随机属性的因子作为随机数来源,如区块Hash(哈希)值,区块时间戳等。
区块哈希值来自多方不确定的交易集合,区块时间戳为不确定的区块生成时间,这些因子在一定程度上具有随机性。然而区块生成由某个节点提议完成,因此该节点在一定程度上能够影响这些因子。比如在打包交易时,有选择性地打包使得最终哈希值接近对自已有利的值,则生成的随机数不具备不可控性。
(2)使用来自链下的随机信息,如气象数据、地震监测信息等。
来自链下自然界的数据具有真随机、不可预测及完全不可控的特征。然而链下数据传入链上需要一个可行的中间服务来进行,而这种中间服务通常是中心化的,其违背了区块链可验证的去中心化思想。
(3)在链上使用一定的算法生成随机数,例如:VRF算法(Verifiable Random Functions,可验证的随机函数)、RANDAO算法、VDF(Verifiable Delay Function,可验证延迟函数)等。
然而,使用VRF算法生成随机数时,通常由多个节点各自做VRF运算,再对多个节点的VRF运算结果进行一定的处理及选择,得到最终的随机数。区块链的分布式特征使得 在对多个节点的VRF运算结果进行处理时,需要在一个leader角色上进行,该leader能够选择对自己有利的VRF运算结果,从而在一定程度上控制了随机数的生成。
在使用RANDA算法生成随机数时,需要多个参与者首先发布自己私有信息的承诺,之后所有参与者公布该承诺对应的信息,再对所有的信息进行异或操作得到最终的随机数。该种方式方案使得最后一个公布信息的参与者可以优先计算出其他参与者的信息结果,再根据计算的结果选择是否公布自己的信息,从而在一定程度上控制了随机数的生成。
在使用VDF算法生成随机数时,随机数的生成需要在多方披露完各自信息后,再进行较长一段时间的计算,该段时间远大于披露信息所需的时间。这样参与者将不能在未披露自己的信息之前计算出最终结果,进而得到一个可公证的、不可预测且不可控制的随机数,然而该段时间的计算使得该随机数获取不够实时,通常情况下,在一个区块上请求的随机数将在后面的某个区块才可获取,因此该方案不适用于那些需要根据随机数立即得出结果的任务,比如即时开奖类游戏Dapp(Decentralized Application,去中心化应用程序)。
鉴于上述几个方案各自存在的缺陷,本案提出了一种结合可验证密钥共享机制(verifiable secret sharing,VSS)及BLS阈值签名算法(BLS threshold sig)生成随机数的方法,由于上述算法能够以部分推导整体,因此所述确定单元110首先要确定区块链系统中参与共识的N个节点及每个节点的编码。
在本发明的至少一个实施例中,所述N个节点参与PBFT(Practical Byzantine Fault Tolerance,实用拜占庭容错算法)共识过程,在该共识算法中,当超过2/3的节点达成共识时,整个系统达成一致。
具体地,所述PBFT共识过程包括以下三个阶段:
(1)re-prepare阶段:由leader节点打包区块并分发给其他节点。
(2)Prepare阶段:其他节点收到区块后,验证区块并进行投票,在收到超过2/3节点的投票后,进入下一阶段。
(3)Commit阶段:进行投票,在收到超过2/3节点的投票后,确认区块。
在本发明的至少一个实施例中,每个节点的编码可以依次为:1-N,其中,N为大于0的整数。
构建单元111基于可验证密钥共享机制,构建每个节点自身的M个公私钥片段对。
其中,M为整数,且M=roundup(预设比例*N)。所述预设比例可以包括2/3等,以符合PBFT共识算法。
例如:当N等于4时,M等于3。
上述配置方式与PBFT共识算法相结合,由于在PBFT共识算法中,当收到超过所述预设比例的节点的投票后,则确认达成共识,因此,本案中配置M=roundup(预设比例*N),进而能够使本案融合至PBFT共识算法中。
在本发明的至少一个实施例中,所述构建单元111基于可验证密钥共享机制,构建每个节点自身的M个公私钥片段对包括:
所述构建单元111基于可验证密钥共享机制,并采用椭圆曲线算法构建每个节点自身的M个公私钥片段对。
在上述实施例中,能够很好的结合PBFT共识及椭圆曲线算法的特性。由于椭圆曲线算法具有双线性映射特性,PBFT共识过程也是在收到超过所述预设比例的节点的投票后达成共识。因此,结合了可验证密钥共享机制,能够在后续只利用构建的公钥片段及私钥片段中的部分片段分别构建出整体的唯一公钥及唯一私钥。
在本发明的至少一个实施例中,所述构建单元111还可以构建一组公私钥对pPk/pSK,用于实现PBFT共识过程。
具体地,所述构建单元111可以通过非对称加密算法构建该组公私钥对,该组公私钥 对具有可验证性。
发送单元112根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值并将计算的数值分别发送至符合对应编码的节点。
在本发明的至少一个实施例中,所述发送单元112根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值,并将计算的数值分别发送至符合对应编码的节点包括:
对于每个节点,所述发送单元112构建具有M项的(M-1)阶多项式,所述多项式的系数依次为该节点的M个私钥片段,并将每个节点的编码依次作为所述多项式的变量值输入至所述多项式中,得到该节点的N个数值,进一步地,所述发送单元112确定计算每个数值的编码,并根据确定的编码将每个数值发送至与所述确定的编码相对应的节点。
例如:当有4个节点A、B、C、D时,M=roundup(预设比例*N)=3,四个节点的编号分别为1、2、3、4。对于节点A,所述发送单元112构建一个3项2阶多项式,记作F(x)=r 1+r 2*x+r 3*x 2,所述节点A的3个私钥片段分别为bSK A1、bSK A2及bSK A3,则所述节点A的多项式为:F A(x)=bSK A1+bSK A2*x+bSK A3*x 2,所述发送单元112将x=1、2、3、4依次作为变量值代入该多项式,分别计算获得F A(1)、F A(2)、F A(3)及F A(4)作为所述节点A的4个数值,F A(1)=bSK A1+bSK A2+bSK A3,F A(2)=bSK A1+2bSK A2+4bSK A3,F A(3)=bSK A1+3bSK A2+9bSK A3;进一步地,所述发送单元112将F A(2)秘密发送给对应于编号2的B节点,将F A(3)秘密发送给对应于编号3的C节点,并将F A(4)秘密发送给对应于编号4的D节点,即所述节点A只保留数值F A(1)。
同理,所述发送单元112对节点B、节点C、节点D执行同样的操作。最后,所述节点A拥有F A(1)=bSK A1+bSK A2+bSK A3、F B(1)=bSK B1+bSK B2+bSK B3、F C(1)=bSK C1+bSK C2+bSK C3及F D(1)=bSK D1+bSK D2+bSK D3,所述节点B拥有F A(2)、F B(2)、F C(2)及F D(2),所述节点C拥有F A(3)、F B(3)、F C(3)及F D(3),且所述节点D拥有F A(4)、F B(4)、F C(4)及F D(4)。
在本发明的至少一个实施例中,在根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值后,此时如果节点发生变化,则根据新的节点重新构建每个节点的数值。
当有区块需要共识时,所述构建单元111根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名,并根据每个节点的第一签名构建每个节点对待共识区块的prepare投票。
在本发明的至少一个实施例中,所述构建单元111根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名包括:
所述构建单元111获取待共识区块的哈希值,进一步将每个节点保存的N个数值累加后对所述待共识区块的哈希值进行签名,得到每个节点的第一签名。
例如:对于所述节点A,所述节点A上的数值的累加和为:F A(1)+F B(1)+F C(1)+F D(1),获取的所述区块的哈希值为BlockHash,则所述节点A的第一签名为:Sig F,1=(F A(1)+F B(1)+F C(1)+F D(1))*BlockHash。
在本发明的至少一个实施例中,所述构建单元111根据每个节点的第一签名构建每个节点对待共识区块的prepare投票包括:
所述构建单元111以每个节点的第一签名、所述区块的哈希值及prepare阶段的prepare标识构建每个节点的prepare投票。
其中,所述prepare标识用于表示当前处于prepare阶段。
例如:所述节点A的prepare投票可以表示为(Sig F,i,BlockHash,prepare标识)。
所述构建单元111利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥。
其中,j为小于或等于M的自然数。
具体地,所述构建单元111可以提取每个节点的首个私钥片段及首个公钥片段。
例如:当所述节点A为生成所述区块的节点时,N个私钥片段可以分别为所述节点A的首个私钥片段bSK A1、所述节点B的首个私钥片段bSK B1、所述节点C的首个私钥片段bSK C1、所述节点D的首个私钥片段bSK D1,所述唯一公钥可以表示为:BPK=bPK A1+bPK B1+bPK C1+bPK D1,其中,bPK A1表示所述节点A的首个公钥片段,bPK B1表示所述节点B的首个公钥片段,bPK C1表示所述节点C的首个公钥片段,且bPK D1表示所述节点D的首个公钥片段。
当然,在其他实施例中,也可以提取每个节点的第二段公钥片段、第三段公钥片段来构建唯一公钥,后续步骤中在构建第二签名时采用的私钥片段集合与唯一公钥中包含的公钥片段对应即可。
进一步地,所述构建单元111在构建了每个节点的prepare投票后,利用与每个节点对应的公私钥对pPk/pSK中的私钥pSK对每个prepare投票进行签名,并将每个prepare投票广播至其他节点,后续则以与每个节点对应的公私钥对中的公钥pPk验证每个prepare投票。
在本发明的至少一个实施例中,所构建的公钥或者公钥片段都是被公布的,以供验证使用。
当prepare投票通过验证的节点达到M个时,所述构建单元111利用M个节点的prepare投票构建第二签名。
在本发明的至少一个实施例中,所述构建单元111利用M个节点的prepare投票构建第二签名包括:
所述构建单元111利用M个节点的prepare投票中包括的第一签名构建M个方程组成的方程组,求解得到第二签名,第二签名为每个参与共识的区块链节点的第j段私钥片段累加后对待共识区块的哈希值的签名。
详细构建过程如下:
假设四个节点都通过了prepare投票,区块链节点对Sig F,1、Sig F,2、Sig F,3、Sig F,4进行变形:
Sig F,1=(F A(1)+F B(1)+F C(1)+F D(1))*BlockHash=((bSK A1+bSK A2+bSK A3)+(bSKB 1+bSK B2+bSK B3)+(bSK C1+bSK C2+bSK C3)+(bSK D1+bSK D2+bSK D3))*BlockHash=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
Sig F,2=(F A(2)+F B(2)+F C(2)+F D(2))*BlockHash=(bSK A1+2bSK A2+4bSK A3)+(bSK B1+2bSK B2+4bSK B3)+(bSK C1+2bSK C2+4bSK C3)+(bSK D1+2bSK D2+4bSK D3)=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+2(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+4(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
依次类推得到,Sig F,3=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+3(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+9(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
Sig F,4=(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash+4(bSK A2+bSKB 2+bSK C2+bSK D2)*BlockHash+16(bSK A3+bSKB 3+bSK C3+bSK D3)*BlockHash;
则通过上述方程组可以解出(bSK A1+bSKB 1+bSK C1+bSK D1)*BlockHash,即为第二签名SIG BSK=(bSK A1+bSK B1+bSK C1+bSK D1)*BlockHash。
当然实际上,利用Sig F,1、Sig F,2、Sig F,3、Sig F,4的其中3个即可解出第二签名。
可以理解的是,随机数相当于由部分节点构建的唯一私钥对区块的哈希值进行阈值签名而生成,使得该随机数具有包含区块提议者在内的不可控且不可预测的特性,并且BLS 阈值签名算法的使用确保了该随机数可被所有节点验证通过,确保了其公开可验证特性。并且,同时,利用BLS阈值签名算法的信息交互过程被融合至拜占庭容错算法的prepare投票阶段,节省了交互时间。由于在区块链上实现,还具备去中心化的特性。
验证单元114采用所述唯一公钥验证所述第二签名。
在本发明的至少一个实施例中,由于所述第二签名是根据所述唯一私钥生成,因此,所述验证单元114可以采用所述唯一公钥验证所述第二签名。
具体地,所述区块链系统中的每个区块链节点都可以验证所述第二签名,如果所述第二签名是正确的,那么每个区块链节点都可以成功验证所述第二签名。
当所述第二签名通过验证时,执行单元115将所述第二签名确定为随机数。
在本发明的至少一个实施例中,当所述第二签名通过验证时,说明所述第二签名满足可验证性,可以被确定为所述随机数。
在本发明的至少一个实施例中,所述方法还包括:
所述执行单元115执行所述区块,得到执行结果,所述确定单元110确定commit阶段的commit标识,所述构建单元111根据所述执行结果、所述随机数及所述commit标识构建每个节点的commit投票,当commit投票通过验证的节点大于所述预设比例时,提交单元116提交所述区块。
通过上述实施方式,能够在构建了所述随机数后,直接进入下一阶段,确保了所述随机数的实时可用性。
在本发明的至少一个实施例中,所述方法还包括:
当在预设时间内,prepare投票通过验证的节点没有达到M个,及/或commit投票通过验证的节点没有达到M个时,所述确定单元110确定提块失败,进一步地,生成单元117生成新随机数,提块单元118根据所述新随机数进行提块。
通过上述实施方式,当确定提块失败时,可以及时重新提块,避免影响区块链系统正常执行任务。
综上所述,本发明能够在区块链系统上结合可验证密钥共享机制及预设签名算法生成随机数,具备去中心化的特性,该随机数由部分节点构建的唯一私钥对区块的哈希值进行阈值签名而生成,使得该随机数具有包含区块提议者在内的不可控且不可预测的特性,并且预设签名算法的使用确保了该随机数可被所有节点验证通过,确保了其公开可验证特性,同时,利用预设签名算法的信息交互过程被融合至拜占庭容错算法的prepare投票阶段,节省了交互时间,该随机数可以直接被应用于当前所生成的区块,因此也保证了随机数的实时可用性。
在上述实施例中,可以全部或部分地通过软件、硬件设备、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、移动硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态移动硬盘Solid State Disk(SSD))等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件设备的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动移动硬盘、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
需要说明的是,上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (15)

  1. 一种随机数生成方法,其特征在于,应用于区块链节点,所述方法包括:
    所述区块链节点确定包括自身在内的N个节点参与共识,并获取每个节点的编码;
    基于可验证密钥共享机制,所述区块链节点构建自身的M个公私钥片段对,其中,M、N均为整数,且M=roundup(预设比例*N);
    所述区块链节点根据自身的M个私钥片段计算对应于每个节点的编码的N个数值,将计算的数值分别发送至符合对应编码的其他节点,并接收其他节点发送的数值;
    当有区块需要共识时,根据所述区块链节点上保存的与自身编码对应的数值合成所述区块链节点的第一签名,并根据所述区块链节点的第一签名构建所述区块链节点对待共识区块的prepare投票;
    将prepare投票发送至参与共识的其它区块链节点,以及接收其它区块链节点发送的prepare投票;
    所述区块链节点利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥,其中j为小于或等于M的自然数;
    当在所述N个节点中,prepare投票通过验证的节点达到M个时,所述区块链节点利用M个节点的prepare投票构建第二签名;
    采用所述唯一公钥验证所述第二签名,且所述第二签名通过验证时,所述区块链节点将所述第二签名确定为随机数。
  2. 如权利要求1所述的随机数生成方法,其特征在于,所述区块链节点根据自身的M个私钥片段计算对应于每个节点的编码的N个数值,将计算的数值分别发送至符合对应编码的其他节点包括:
    所述区块链节点构建具有M项的(M-1)阶多项式,所述多项式的系数依次为所述区块链节点的M个私钥片段,并将每个节点的编码依次作为所述多项式的变量值输入至所述多项式中,得到所述区块链节点的N个数值;
    所述区块链节点确定计算每个数值的编码,并根据确定的编码将每个数值发送至与所述确定的编码相对应的节点。
  3. 如权利要求1所述的随机数生成方法,其特征在于,所述根据所述区块链节点上保存的与自身编码对应的数值合成所述区块链节点的第一签名包括:
    获取待共识区块的哈希值;
    将其保存的N个数值累加后对所述待共识区块的哈希值进行签名,得到所述区块链节点的第一签名。
  4. 如权利要求1所述的随机数生成方法,其特征在于,所述区块链节点利用M个节点的prepare投票构建第二签名包括:
    区块链节点利用M个节点的prepare投票中包括的第一签名构建M个方程组成的方程组,求解得到第二签名,第二签名为每个参与共识的区块链节点的第j段私钥片段累加后对待共识区块的哈希值的签名。
  5. 如权利要求1所述的随机数生成方法,其特征在于,所述方法还包括:
    所述区块链节点获取所述区块的执行结果,并确定commit阶段的commit标识;
    所述区块链节点根据所述执行结果、所述随机数及所述commit标识构建所述区块链节点的commit投票;
    当在所述N个节点中,commit投票通过验证的节点大于所述预设比例时,所述区块链节点确定所述区块能够提交。
  6. 如权利要求1所述的随机数生成方法,其特征在于,所述方法还包括:
    当在预设时间内,prepare投票通过验证的节点没有达到M个,及/或commit投票通过验证的节点没有达到M个时,所述区块链节点确定提块失败;
    所述区块链节点获取生成的新随机数,并根据所述新随机数进行提块。
  7. 一种随机数生成方法,其特征在于,应用于区块链系统,所述方法包括:
    确定区块链系统中参与共识的N个节点及每个节点的编码;
    基于可验证密钥共享机制,构建每个节点自身的M个公私钥片段对,其中,M、N均为整数,且M=roundup(预设比例*N);
    根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值并将计算的数值分别发送至符合对应编码的节点;
    当有区块需要共识时,根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名,并根据每个节点的第一签名构建每个节点对待共识区块的prepare投票;
    利用每个参与共识的区块链节点的第j段公钥片段构建唯一公钥,其中j为小于或等于M的自然数;
    当prepare投票通过验证的节点达到M个时,利用M个节点的prepare投票构建第二签名;
    采用所述唯一公钥验证所述第二签名;
    当所述第二签名通过验证时,将所述第二签名确定为随机数。
  8. 如权利要求7所述的随机数生成方法,其特征在于,所述根据每个节点的M个私钥片段计算对应于每个节点的编码的N个数值,并将计算的数值分别发送至符合对应编码的节点包括:
    对于每个节点,构建具有M项的(M-1)阶多项式,所述多项式的系数依次为该节点的M个私钥片段,并将每个节点的编码依次作为所述多项式的变量值输入至所述多项式中,得到该节点的N个数值;
    确定计算每个数值的编码;
    根据确定的编码将每个数值发送至与所述确定的编码相对应的节点。
  9. 如权利要求7所述的随机数生成方法,其特征在于,所述根据每个节点上保存的与自身编码对应的数值合成每个节点的第一签名包括:
    获取待共识区块的哈希值;
    将每个节点保存的N个数值累加后对所述待共识区块的哈希值进行签名,得到每个节点的第一签名。
  10. 如权利要求7所述的随机数生成方法,其特征在于,所述利用M个节点的prepare投票构建第二签名包括:
    利用M个节点的prepare投票中包括的第一签名构建M个方程组成的方程组,求解得到第二签名,第二签名为每个参与共识的区块链节点的第j段私钥片段累加后对待共识区块的哈希值的签名。
  11. 如权利要求7所述的随机数生成方法,其特征在于,所述方法还包括:
    执行所述区块,得到执行结果;
    确定commit阶段的commit标识;
    根据所述执行结果、所述随机数及所述commit标识构建每个节点的commit投票;
    当commit投票通过验证的节点大于所述预设比例时,提交所述区块。
  12. 如权利要求7所述的随机数生成方法,其特征在于,所述方法还包括:
    当在预设时间内,prepare投票通过验证的节点没有达到M个,及/或commit投票通过验证的节点没有达到M个时,确定提块失败;
    生成新随机数;
    根据所述新随机数进行提块。
  13. 一种区块链节点,其特征在于,所述区块链节点包括:
    存储设备,存储至少一个指令;及
    处理设备,执行所述存储设备中存储的指令以实现如权利要求1至6中任意一项所述的随机数生成方法。
  14. 一种区块链系统,其特征在于,所述区块链系统包括:
    存储器,存储至少一个指令;及
    处理器,执行所述存储器中存储的指令以实现如权利要求7至12中任意一项所述的随机数生成方法。
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有随机数生成程序,所述随机数生成程序可被一个或者多个处理器执行,以实现如权利要求1至6中任一项所述的随机数生成方法及/或如权利要求7至12中任一项所述的随机数生成方法。
PCT/CN2020/080433 2019-11-14 2020-03-20 随机数生成方法、区块链节点、系统及介质 WO2021093244A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911115674.5A CN110825349B (zh) 2019-11-14 2019-11-14 随机数生成方法、区块链节点、系统及介质
CN201911115674.5 2019-11-14

Publications (1)

Publication Number Publication Date
WO2021093244A1 true WO2021093244A1 (zh) 2021-05-20

Family

ID=69555658

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/080433 WO2021093244A1 (zh) 2019-11-14 2020-03-20 随机数生成方法、区块链节点、系统及介质

Country Status (2)

Country Link
CN (1) CN110825349B (zh)
WO (1) WO2021093244A1 (zh)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722137A (zh) * 2021-08-26 2021-11-30 杭州优海信息系统有限公司 用于共享工业智能设备故障修复方案的方法及设备
CN113779642A (zh) * 2021-09-02 2021-12-10 国网北京市电力公司 数据处理方法及其装置、系统、电子设备
CN114189325A (zh) * 2021-11-19 2022-03-15 新疆大学 具有高容错可扩展的拜占庭容错方法、装置及存储介质
CN114650127A (zh) * 2022-03-11 2022-06-21 江苏中交车旺科技有限公司 一种基于共享密钥的支付方法和系统
CN114978634A (zh) * 2022-05-12 2022-08-30 上海焜耀网络科技有限公司 一种分布式竞拍系统的构建及竞拍方法
CN114978693A (zh) * 2022-05-23 2022-08-30 深圳壹账通科技服务有限公司 多机构的黑名单保密验证方法、装置、设备及存储介质
CN115085909A (zh) * 2022-05-09 2022-09-20 北京红洞科技有限公司 一种随机数生成方法、装置、计算机设备及介质
CN115314351A (zh) * 2022-07-25 2022-11-08 北京航空航天大学 基于可链接环签名和滑动窗口的无抵押秘密选举方法
CN115643043A (zh) * 2022-09-09 2023-01-24 北京航空航天大学 一种基于验证延迟函数的跨链共识选举方法及系统
CN117614611A (zh) * 2024-01-24 2024-02-27 苏州元脑智能科技有限公司 一种区块链共识方法、系统和存储介质

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825349B (zh) * 2019-11-14 2023-03-28 深圳市迅雷网络技术有限公司 随机数生成方法、区块链节点、系统及介质
CN111371769B (zh) * 2020-02-27 2022-03-08 北京链化未来科技有限公司 共识处理方法、共识节点、电子设备和可读存储介质
CN111427540A (zh) * 2020-03-24 2020-07-17 北京奇艺世纪科技有限公司 随机数的生成方法、装置、电子设备和存储介质
CN111478804B (zh) * 2020-03-31 2023-04-07 上海墨珩网络科技有限公司 一种基于动态区块链的去中心化的流程控制方法及系统
CN111539016B (zh) * 2020-04-14 2023-04-07 浙江浙燃能源有限公司 分布式计算方法、系统、区块链节点及计算机介质
CN111600709B (zh) * 2020-05-26 2023-03-14 牛津(海南)区块链研究院有限公司 可验证随机数的生成方法和装置
CN111818074B (zh) * 2020-07-17 2022-08-05 上海朝夕网络技术有限公司 一种基于芯片的分布式网络节点认证方法
CN112613882B (zh) * 2020-12-29 2023-06-02 成都知道创宇信息技术有限公司 一种分布式签名系统及管理方法
CN112799636B (zh) * 2021-04-14 2021-08-27 北京百度网讯科技有限公司 随机数生成方法、装置、设备和存储介质
CN113783699B (zh) * 2021-06-02 2022-06-14 腾讯科技(深圳)有限公司 基于区块链的数据处理方法、装置、设备及可读存储介质
CN113407156B (zh) * 2021-06-15 2023-02-17 杭州溪塔科技有限公司 基于去中心化可验证延迟函数生成随机数的方法及系统
CN114640451A (zh) * 2022-03-29 2022-06-17 蚂蚁区块链科技(上海)有限公司 区块链上实现分布式密钥生成的方法、系统和共识节点
CN114884652A (zh) * 2022-03-29 2022-08-09 蚂蚁区块链科技(上海)有限公司 一种区块链上产生随机数种子的方法、系统和共识节点
CN114726517A (zh) * 2022-03-29 2022-07-08 蚂蚁区块链科技(上海)有限公司 一种区块链上产生随机数种子的方法、系统和共识节点
CN114650132A (zh) * 2022-03-29 2022-06-21 蚂蚁区块链科技(上海)有限公司 区块链上实现分布式密钥生成的方法、系统和共识节点

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109685505A (zh) * 2018-12-24 2019-04-26 电子科技大学 基于关联环签名的拜占庭容错共识优化方法
US20190158272A1 (en) * 2017-11-17 2019-05-23 International Business Machines Corporation Peer voting on a blockchain
CN109981281A (zh) * 2019-01-14 2019-07-05 北京领主科技有限公司 基于区块链提案随机共识确定候选元素的方法及装置
CN110198213A (zh) * 2019-04-01 2019-09-03 上海能链众合科技有限公司 一种基于秘密共享随机数共识算法的系统
US20190325684A1 (en) * 2018-04-24 2019-10-24 regio iT gesellschaft fuer informationstechnologie mbh Voting method
CN110825349A (zh) * 2019-11-14 2020-02-21 深圳市网心科技有限公司 随机数生成方法、区块链节点、系统及介质

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2580874A (en) * 2018-11-07 2020-08-05 Robot Protos Ltd Method for generating verifiable random selections
CN110113173B (zh) * 2019-05-20 2022-01-21 上海链朗信息科技有限公司 多输入且可验证的伪随机数的生成方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190158272A1 (en) * 2017-11-17 2019-05-23 International Business Machines Corporation Peer voting on a blockchain
US20190325684A1 (en) * 2018-04-24 2019-10-24 regio iT gesellschaft fuer informationstechnologie mbh Voting method
CN109685505A (zh) * 2018-12-24 2019-04-26 电子科技大学 基于关联环签名的拜占庭容错共识优化方法
CN109981281A (zh) * 2019-01-14 2019-07-05 北京领主科技有限公司 基于区块链提案随机共识确定候选元素的方法及装置
CN110198213A (zh) * 2019-04-01 2019-09-03 上海能链众合科技有限公司 一种基于秘密共享随机数共识算法的系统
CN110825349A (zh) * 2019-11-14 2020-02-21 深圳市网心科技有限公司 随机数生成方法、区块链节点、系统及介质

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113722137A (zh) * 2021-08-26 2021-11-30 杭州优海信息系统有限公司 用于共享工业智能设备故障修复方案的方法及设备
CN113779642A (zh) * 2021-09-02 2021-12-10 国网北京市电力公司 数据处理方法及其装置、系统、电子设备
CN113779642B (zh) * 2021-09-02 2024-05-28 国网北京市电力公司 数据处理方法及其装置、系统、电子设备
CN114189325A (zh) * 2021-11-19 2022-03-15 新疆大学 具有高容错可扩展的拜占庭容错方法、装置及存储介质
CN114189325B (zh) * 2021-11-19 2023-09-29 新疆大学 具有高容错可扩展的拜占庭容错方法、装置及存储介质
CN114650127A (zh) * 2022-03-11 2022-06-21 江苏中交车旺科技有限公司 一种基于共享密钥的支付方法和系统
CN115085909A (zh) * 2022-05-09 2022-09-20 北京红洞科技有限公司 一种随机数生成方法、装置、计算机设备及介质
CN114978634B (zh) * 2022-05-12 2024-04-30 上海焜耀网络科技有限公司 一种分布式竞拍系统的构建及竞拍方法
CN114978634A (zh) * 2022-05-12 2022-08-30 上海焜耀网络科技有限公司 一种分布式竞拍系统的构建及竞拍方法
CN114978693A (zh) * 2022-05-23 2022-08-30 深圳壹账通科技服务有限公司 多机构的黑名单保密验证方法、装置、设备及存储介质
CN115314351A (zh) * 2022-07-25 2022-11-08 北京航空航天大学 基于可链接环签名和滑动窗口的无抵押秘密选举方法
CN115314351B (zh) * 2022-07-25 2024-02-02 北京航空航天大学 基于可链接环签名和滑动窗口的无抵押秘密选举方法
CN115643043A (zh) * 2022-09-09 2023-01-24 北京航空航天大学 一种基于验证延迟函数的跨链共识选举方法及系统
CN115643043B (zh) * 2022-09-09 2024-04-19 北京航空航天大学 一种基于验证延迟函数的跨链共识选举方法及系统
CN117614611B (zh) * 2024-01-24 2024-04-12 苏州元脑智能科技有限公司 一种区块链共识方法、系统和存储介质
CN117614611A (zh) * 2024-01-24 2024-02-27 苏州元脑智能科技有限公司 一种区块链共识方法、系统和存储介质

Also Published As

Publication number Publication date
CN110825349A (zh) 2020-02-21
CN110825349B (zh) 2023-03-28

Similar Documents

Publication Publication Date Title
WO2021093244A1 (zh) 随机数生成方法、区块链节点、系统及介质
US11388152B2 (en) Manicoding for communication verification
KR101727525B1 (ko) 블록체인 기반 분산 저장 방법 및 이를 이용한 장치
CN109361740B (zh) 一种区块链的区块生成方法、装置、设备和介质
WO2021031473A1 (zh) 基于多资产模型的区块链资产处理方法及相关设备
TW202025664A (zh) 使用公有側鏈驗證儲存在聯盟區塊鏈中的資料的完整性
CN108848148B (zh) 基于区块链的交易信息确认方法及装置
JP2022532830A (ja) 分散データベース内に状態証明及び台帳識別子を実装するための方法及び機器
JP2020537362A (ja) セキュアマルチパーティ計算の参加者による入力データの不正確な告知の防止
CN110505305A (zh) 一种区块链分片方法、装置及区块链系统
CN114982193A (zh) 使用区块链事务的数字合约
CN110914849A (zh) 用于保护区块链网络中的交易的系统和方法
CN109146677A (zh) 并行构建区块链视图的方法、计算机系统和可读存储介质
CN113489584A (zh) 一种区块链中随机数的处理方法、装置和电子设备
CN109493054A (zh) 多链信息管理方法、装置、存储介质和区块链身份解析器
CN111033491A (zh) 基于纠错编码存储共享的区块链数据
WO2023185051A1 (zh) 一种区块链上产生随机数种子的方法、系统和共识节点
CN114020845A (zh) 区块链网络管理方法、系统、电子设备及存储介质
CN114331397B (zh) 信息处理方法、装置、电子设备和存储介质
CN113255011A (zh) 区块链状态映射方法、系统、计算机设备及存储介质
CN117474124A (zh) 一种基于联邦学习的模型训练方法、装置、设备及介质
WO2023231558A1 (zh) 区块链共识方法、装置、介质、电子设备和程序产品
CN110570309A (zh) 用于更换区块链网络的领导者的方法和系统
CN114328731A (zh) 信息处理方法、装置、电子设备和存储介质
CN113918517A (zh) 多类型文件集中管理方法、装置、设备及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20886467

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20886467

Country of ref document: EP

Kind code of ref document: A1