Movatterモバイル変換


[0]ホーム

URL:


CN110971413A - Random number generation method, random number generation device and storage medium - Google Patents

Random number generation method, random number generation device and storage medium
Download PDF

Info

Publication number
CN110971413A
CN110971413ACN201911256624.9ACN201911256624ACN110971413ACN 110971413 ACN110971413 ACN 110971413ACN 201911256624 ACN201911256624 ACN 201911256624ACN 110971413 ACN110971413 ACN 110971413A
Authority
CN
China
Prior art keywords
node
random number
information
sub
secret
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911256624.9A
Other languages
Chinese (zh)
Other versions
CN110971413B (en
Inventor
刘攀
张劲松
王宗友
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co LtdfiledCriticalTencent Technology Shenzhen Co Ltd
Priority to CN201911256624.9ApriorityCriticalpatent/CN110971413B/en
Publication of CN110971413ApublicationCriticalpatent/CN110971413A/en
Application grantedgrantedCritical
Publication of CN110971413BpublicationCriticalpatent/CN110971413B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The embodiment of the application discloses a random number generation method, a random number generation device and a storage medium, wherein the random number generation method is applied to a block chain system, the block chain system comprises at least two nodes which are connected with each other, the at least two nodes comprise a first node and a second node, the generation method is executed by the first node, and the generation method comprises the following steps: acquiring first signature information generated by the self based on a preset message; acquiring second signature information generated by a second node based on a preset message; aggregating the first signature information and the second signature information to obtain aggregated signature information; generating a first random number according to the aggregated signature information; obtaining a validity verification result of the second node on the first random number; when it is determined that the first random number is legitimate based on the result of the validity verification of the second node, the first random number is stored. According to the method and the device, the plurality of nodes participate in the generation of the random number, so that the safety of the generation of the random number is improved.

Description

Random number generation method, random number generation device and storage medium
The present application is a divisional application of a patent application having an application date of 2019, month 6 and month 20, an application number of 201910535779.X, and an invention name of "a method, an apparatus, and a storage medium for generating random numbers", and the entire content of the parent application is incorporated by reference in the present application.
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for generating a random number, and a storage medium.
Background
The random number is the result of a special random trial. Random numbers are used in different techniques of statistics, such as when a representative sample is drawn from a statistical population, or during the assignment of experimental animals to different experimental groups, or when monte carlo simulation calculations are performed, etc. There are many different ways to generate random numbers. These methods are called random number generators. The most important characteristics of random numbers are: the number of back that it generates has no relation to the number of front.
The prior art has a great problem that the safety of the generation mode of the random number is not high.
Disclosure of Invention
Embodiments of the present application provide a random number generation method, a random number generation apparatus, and a storage medium, which can improve the security of random number generation.
In one aspect, the present application provides a random number generation method, applied to a blockchain system, where the blockchain system includes at least two nodes connected to each other, where the at least two nodes include a first node and a second node, and the generation method is performed by the first node, and the generation method includes:
acquiring first signature information generated by the self based on a preset message;
acquiring second signature information generated by the second node based on the preset message;
aggregating the first signature information and the second signature information to obtain aggregated signature information;
generating a first random number according to the aggregated signature information;
obtaining a validity verification result of the second node on the first random number;
and when the first random number is determined to be legal based on the validity verification result of the second node, storing the first random number.
In one aspect, the present application provides another random number generation method, applied to a blockchain system, where the blockchain system includes at least two nodes connected to each other, where the at least two nodes include a first node and a second node, and the generation method is performed by the first node, and the generation method includes:
generating a secret number according to a preset secret generation strategy;
dividing the secret number into N pieces of first sub-secret information according to a preset secret sharing strategy, wherein N is the number of nodes in the block chain system, and is a positive integer;
distributing N-1 first sub-secret information to the second node in the form of a broadcast transmitted in the blockchain system;
monitoring N-1 second nodes, and respectively receiving second sub-secret information sent by the second nodes, wherein the second sub-secret information comprises sub-secret information sent by N-1 nodes in the second nodes respectively;
secret information is obtained according to the second sub-secret information;
signing a preset message according to the secret information to obtain first signature information;
monitoring the broadcast of the second node to acquire second signature information generated by the second node based on a preset message;
aggregating the first signature information and the second signature information to obtain aggregated signature information;
generating a first random number according to the aggregated signature information;
obtaining a validity verification result of the second node on the first random number;
and when the first random number is determined to be legal based on the validity verification result of the second node, storing the first random number.
In one aspect, the present application provides a random number generation apparatus, applied to a first node in a blockchain system, where the blockchain system includes at least two nodes connected to each other, where the at least two nodes include a first node and a second node, and the generation apparatus includes:
the first acquisition unit is used for acquiring first signature information generated by the first acquisition unit based on a preset message;
a second obtaining unit, configured to obtain second signature information generated by the second node based on the preset message;
the signature unit is used for aggregating the first signature information and the second signature information to obtain aggregated signature information;
a random number generating unit, configured to generate a first random number according to the aggregated signature information;
a third obtaining unit, configured to obtain a validity verification result of the second node on the first random number;
a random number storage unit, configured to store the first random number when it is determined that the first random number is legitimate based on a validity verification result of the second node.
Wherein the first obtaining unit comprises a signature subunit and a secret sharing unit,
the secret sharing unit is used for secret sharing with the second node to obtain secret information;
the first signature unit is used for signing a preset message according to the secret information to obtain the first signature information.
The secret sharing unit is used for generating a secret number according to a preset secret generation strategy;
the secret sharing unit is used for dividing the secret number into N pieces of first sub-secret information according to a preset secret sharing strategy, wherein N is the number of nodes in the block chain system, and is a positive integer;
the secret sharing unit is configured to receive second sub-secret information sent by the second node, where the second sub-secret information includes sub-secret information sent by N-1 nodes in the second node;
and the secret sharing unit is used for acquiring secret information according to the second sub-secret information.
The secret sharing unit is used for verifying the validity of the acquired N-1 second sub-secret information;
and the secret sharing unit is used for acquiring secret information according to the N-1 second sub-secret information if the acquired N-1 second sub-secret information is verified to be valid.
The secret sharing unit is used for verifying the validity of the acquired N-1 second sub-secret information to acquire a first validity verification result;
the secret sharing unit is used for receiving a second validity verification result sent by the second node;
the secret sharing unit is used for determining the validity of N-1 sub-secret information according to the first validity verification result and the second validity verification result;
and the secret sharing unit is used for acquiring secret information according to the second sub-secret information when the N-1 second sub-secret information is determined to be valid.
The signature unit is used for sequentially carrying out validity check on the first signature information and the second signature information;
the signature unit is configured to, when T pieces of legal signature information exist in the obtained first signature information and the second signature information, aggregate the T pieces of legal signature information to obtain the aggregated signature information, where T is a positive integer and is not greater than N.
The random number generation unit is used for acquiring a private key of the first node;
and the random number generating unit is used for generating the first random number and the certification information corresponding to the first random number according to the aggregated signature information and the private key of the first node.
The acquisition unit further comprises an acquisition subunit and a verification subunit;
the obtaining subunit is configured to obtain a public key of the second node, a second random number of the second node, and certification information corresponding to the second random number;
the verification subunit is configured to verify validity of the second random number according to the aggregated signature information, the public key of the second node, the second random number, and the certification information corresponding to the second random number;
the random number storage unit is used for storing the second random number when the verification subunit verifies that the second random number is legal.
In one aspect, the present application provides another random number generation apparatus, applied to a first node in a blockchain system, where the blockchain system includes at least two nodes connected to each other, and the at least two nodes include a first node and a second node, and the generation apparatus includes:
the device comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for generating a secret number according to a preset secret generation strategy; dividing the secret number into N pieces of first sub-secret information according to a preset secret sharing strategy, wherein N is the number of nodes in the block chain system, and is a positive integer; distributing N-1 first sub-secret information to the second node in the form of a broadcast transmitted in the blockchain system; monitoring N-1 second nodes, and respectively receiving second sub-secret information sent by the second nodes, wherein the second sub-secret information comprises sub-secret information sent by N-1 nodes in the second nodes respectively; secret information is obtained according to the second sub-secret information; signing a preset message according to the secret information to obtain first signature information;
the second acquisition unit is used for monitoring the broadcast of the second node to acquire second signature information generated by the second node based on a preset message;
the signature unit is used for aggregating the first signature information and the second signature information to obtain aggregated signature information;
a random number generating unit, configured to generate a first random number according to the aggregated signature information;
a third obtaining unit, configured to obtain a validity verification result of the second node on the first random number;
a random number storage unit, configured to store the first random number when it is determined that the first random number is legitimate based on a validity verification result of the second node.
Wherein the first obtaining unit is further configured to,
verifying the validity of the acquired N-1 second sub-secret information;
and if the obtained N-1 second sub-secret information is verified to be valid, secret information is obtained according to the second sub-secret information.
Wherein the first obtaining unit is further configured to,
verifying the validity of the obtained N-1 second sub-secret information to obtain a first validity verification result;
receiving a second validity verification result sent by the second node;
determining the validity of N-1 sub-secret information according to the first validity verification result and the second validity verification result;
and if the N-1 second sub-secret information is determined to be valid, secret information is obtained according to the second sub-secret information.
In one aspect, the present application provides a storage medium having a plurality of instructions stored therein, the instructions being adapted to be loaded by a processor to perform the method for generating random numbers according to any one of the first aspect.
The generation method of the random number in the embodiment of the application is applied to a blockchain system, the blockchain system comprises at least two nodes which are connected with each other, the at least two nodes comprise a first node and a second node, the generation method is executed by the first node, and the generation method comprises the following steps: acquiring first signature information generated by the self based on a preset message; acquiring second signature information generated by a second node based on a preset message; aggregating the first signature information and the second signature information to obtain aggregated signature information; generating a first random number according to the aggregated signature information; obtaining a validity verification result of the second node on the first random number; when it is determined that the first random number is legitimate based on the result of the validity verification of the second node, the first random number is stored. According to the method and the device, the plurality of nodes participate in the generation of the random number, so that the safety of the generation of the random number is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic view of a block chain system according to an embodiment of the present disclosure;
fig. 2 is a flowchart illustrating an embodiment of a method for generating random numbers according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another embodiment of a method for generating random numbers according to an embodiment of the present application;
fig. 4 is a schematic diagram of information interaction of each node in the method for generating a random number according to the embodiment of the present application;
fig. 5 is a schematic structural diagram of an embodiment of a random number generation apparatus according to an embodiment of the present application;
FIG. 6 is a schematic diagram of an embodiment of the first obtaining unit in FIG. 5;
FIG. 7 is a schematic diagram of an embodiment of a third obtaining unit in FIG. 5;
fig. 8 is a schematic structural diagram of another embodiment of a random number generation apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Before explaining the embodiments of the present invention in detail, some terms related to the embodiments of the present invention are explained.
Block chains: the block chain technique is a low-level technique of bit currency, which is a decentralized distributed account book database. The blockchain itself is a series of data blocks (i.e., blocks) that are generated using a cryptographic algorithm, and each data block contains information that identifies the validity of multiple blockchain network transactions. Based on the above, the data on the block cannot be tampered to cheat, and the data on any block can be ensured to be transparent and transparent, so that the security of the data is ensured.
Block chains can be classified as public, private, or federation chains. The federation chain is between the public chain and the private chain, and several organizations cooperate to maintain a blockchain, the use of the blockchain must be managed with authority, and related information can be protected, such as a financial organization.
To summarize, a blockchain is a distributed database system participated by nodes, or may also be referred to as a distributed public ledger based on P2P (peer-to-peer) network, and is characterized by being unalterable, and can also be understood as an ledger system.
Node of blockchain: the nodes participating in building the block chain can be execution bodies for random number generation, and business such as transaction can be realized through interaction among the nodes. The node stores the related block data.
Next, a method, an apparatus, and a storage medium for generating random numbers according to embodiments of the present application will be described. The node can be a network device such as a smart phone, a smart watch, a tablet personal computer, a vehicle-mounted computer and a server.
Referring to fig. 1, fig. 1 is a schematic view of a block chain system according to an embodiment of the present disclosure.
In the embodiment of the present application, theblockchain system 10 includes at least two nodes (theblockchain system 10 includes 3 nodes in fig. 1 is taken as an example for illustration). The at least two nodes are connected through a network, and the connection mode can be wireless connection or wired connection. Specifically, the at least two nodes are dynamically networked through a peer-to-peer network to form a "decentralized" system, and the at least two nodes are peer-to-peer nodes, i.e., each node is the same for theentire blockchain system 10. It is understood that the number of nodes in theblockchain system 10 may be N, where N is a positive integer and N is not less than 2 (e.g., N ═ 3), that is, it only needs to be satisfied that theblockchain system 10 includes at least two nodes connected to each other, which is not limited in this application.
In the present embodiment, theblockchain system 10 includes afirst node 11 and a second node, which may include athird node 13 and afourth node 14, for example, as shown in fig. 1. It should be noted that thefirst node 11, thethird node 13, and thefourth node 14 are in equal status, and the numbering naming of thefirst node 11, thethird node 13, and thefourth node 14 is not limited thereto, and the numbering naming is only for convenience of explaining information interaction between the nodes. The second node is only relative to thefirst node 11, and the second node is all other nodes except thefirst node 11 in theblockchain system 10. In other embodiments, the second node may also be only a part of other nodes except thefirst node 11 in theblockchain system 10, which is not limited in this application.
It should be noted that the scenario diagram of the blockchain system shown in fig. 1 is merely an example, and theblockchain system 10 and the scenario described in the embodiment of the present application are for more clearly illustrating the technical solution of the embodiment of the present application, and do not form a limitation to the technical solution provided in the embodiment of the present application, and as a person having ordinary skill in the art knows that along with the evolution of theblockchain system 10 and the occurrence of a new service scenario, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
In the embodiment of the present application, the description will be made from the perspective of thefirst node 11, and the random number generation method of the present application can also be performed from the perspective of other nodes in theblock chain system 10.
The application provides a random number generation method, which is applied to ablockchain system 10, wherein theblockchain system 10 comprises at least two nodes which are connected with each other, the at least two nodes comprise afirst node 11 and a second node, and the generation method comprises the following steps: thefirst node 11 acquires first signature information generated by the first node based on a preset message; thefirst node 11 acquires second signature information generated by the second node based on a preset message; thefirst node 11 obtains a group signature according to the first signature information and the second signature information; thefirst node 11 generates a first random number from the group signature.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating an embodiment of a method for generating a random number according to the present application, where the method for generating a random number includes:
101. acquiring first signature information generated by the self based on a preset message.
In the embodiment of the present application, thefirst node 11 signs the preset message to obtain first signature information generated by itself based on the preset message. Preferably, thefirst node 11 performs digital signature on the preset message to obtain first signature information generated by itself based on the preset message. In short, a digital signature is some data appended to a data unit or a cryptographic transformation performed on a data unit. Such data or transformations allow the recipient of the data unit to verify the source of the data unit and the integrity of the data unit and to protect the data against counterfeiting by a person (e.g., the recipient). Which is a method of signing a message in electronic form, a signed message being capable of being transmitted in a communication network.
In some embodiments of the present application, thefirst node 11 shares a secret with a second node, which is another node in theblockchain system 10 except for thefirst node 11, to obtain secret information. Thefirst node 11 signs the preset message according to the secret information to obtain first signature information. That is, thefirst node 11 and the second node share the secret, so as to participate in the signature of thefirst node 11 on the preset message together, and further realize decentralization.
In some embodiments of the present application, the secret sharing between thefirst node 11 and the second node to obtain the secret information may include the following steps:
(1) thefirst node 11 generates a secret number according to a preset secret generation policy.
In a particular embodiment, thefirst node 11 randomly generates a secret number. And the N-1 second nodes also respectively generate own secret numbers according to a preset secret generation strategy. For example, thefirst node 11 randomly generates a first secret a, thethird node 13 randomly generates a third secret B, and thefourth node 14 randomly generates a fourth secret C. That is, the two second nodes generate their own secrets, namely, the third secret B and the fourth secret C.
(2) Thefirst node 11 divides the secret number into N first sub-secret information according to a preset secret sharing policy, where N is the number of nodes in theblockchain system 10.
Thefirst node 11 divides the secret number into 3 pieces of first sub-secret information according to the verifiable secret sharing policy. A verifiable secret sharing policy is used to solve the participant spoofing problem, each participant being able to verify whether the owned sub-secret information is valid without reconstructing the secret. Therefore, by the verifiable secret sharing strategy, each node can verify whether the sub-secret information sent by other nodes is valid or not without reconstructing the secret number.
Further, the secret sharing policy may be verified as Pedersen-VSS or Feldman-VSS. Pedersen-VSS is a non-interactive verifiable secret sharing policy proposed by Pedersen that is secure in information theory. The Pedersen-VSS is obtained based on a Lagrangian polynomial interpolation method, and the information rate is high. The Feldman-VSS is a non-interactive verifiable secret sharing strategy proposed by Feldman and not requiring a trusted authority to participate, and has high efficiency; moreover, the security is based on the difficult assumption of calculating discrete logarithm, the shared secret number can be provided with computational security, and the security can resist the distributor. Secret sharing is performed through Pedersen-VSS or Feldman-VSS, and therefore the generation efficiency and safety of random numbers can be improved.
For example, thefirst node 11 divides the first secret number a into 3 pieces of first sub-secret information according to Pedersen-VSS, and calculates the first sub-secret information to be shared as a1, a2 and A3, respectively. Meanwhile, the N-1 second nodes divide the secret number into 3 sub-secret information according to Pedersen-VSS. For example, thethird node 13 divides the third secret number B into 3 pieces of third sub-secret information according to Pedersen-VSS, and calculates the third sub-secret information to be shared as B1, B2, and B3, respectively. Thefourth node 14 divides the fourth secret number C into 3 fourth sub-secret information according to Pedersen-VSS, and calculates that the fourth sub-secret information to be shared is C1, C2 and C3, respectively.
(3) Thefirst node 11 distributes N-1 pieces of first sub-secret information to the second node.
Specifically, thefirst node 11 distributes N-1 pieces of first sub-secret information to the second node in the form of a broadcast transmitted in theblock chain system 10. For example, thefirst node 11 assigns the first sub-secret information a1 to itself, and assigns the first sub-secret information a2 to thethird node 13 by broadcast, and assigns the first sub-secret information A3 to thefourth node 14 by broadcast.
(4) Thefirst node 11 respectively receives second sub-secret information sent by the second node, wherein the second sub-secret information comprises sub-secret information sent by N-1 nodes in the second node respectively;
since the N-1 second nodes are equal in status to thefirst node 11, the N-1 second nodes respectively distribute the N pieces of sub-secret information to each node in theblockchain system 10, as well as the step of the first node acquiring and distributing the N-1 pieces of first sub-secret information to the second nodes. For example, thethird node 13 assigns the third sub-secret information B2 to itself, and assigns the third sub-secret information B1 to thefirst node 11 by broadcast, and assigns the third sub-secret information B3 to thefourth node 14 by broadcast. Thefourth node 14 assigns the fourth sub-secret information C3 to itself, and assigns the fourth sub-secret information C1 to thefirst node 11 by broadcast, and assigns the fourth sub-secret information C2 to thethird node 13 by broadcast.
Specifically, thefirst node 11 monitors N-1 second nodes, and receives the second sub-secret information sent by the second nodes, respectively, to obtain N-1 second sub-secret information. For example, thefirst node 11 receives the second sub-secret information B1 distributed by thethird node 13 and receives the second sub-secret information C1 distributed by thefourth node 14. In the same way, the sub-secret information obtained by thethird node 13 is a2, B2 and C2; the child secret information obtained by thethird node 13 is a3, B3, and C3, respectively.
(5) Thefirst node 11 acquires the secret information from the second sub-secret information.
In this embodiment, thefirst node 11 receives the second sub-secret information sent by the second node, respectively, to obtain N-1 pieces of second sub-secret information, and since the first node is also distributed with one piece of first sub-secret information, the first node finally obtains N pieces of sub-secret information. Thefirst node 11 acquires secret information from the N pieces of sub-secret information.
In some implementations of the present application, thefirst node 11 performs secret aggregation on the obtained one first sub-secret information and the N-1 second sub-secret information according to Pedersen-VSS to calculate the first secret information. For example, thefirst node 11 performs secret aggregation of a1, B1, and C1 according to Pedersen-VSS to calculate first secret information a 10. Based on the same mode, the N-1 second nodes respectively calculate the N-1 second secret information according to the received N-1 sub secret information and one piece of sub secret information of the second nodes. Thethird node 13 performs secret aggregation on the A2, the B2 and the C2 according to the Pedersen-VSS to calculate third secret information A20. Thefourth node 14 performs secret aggregation on the A3, the B3 and the C3 according to Pedersen-VSS to calculate fourth secret information C30. That is, the N-1 pieces of second secret information are the third secret information B20 and the fourth secret information C30, respectively.
In some implementations of the present application, thefirst node 11 verifies the validity of the acquired N-1 second sub-secret information. If the acquired N-1 pieces of second sub-secret information are valid, thefirst node 11 acquires secret information from the second sub-secret information. That is, thefirst node 11 verifies the validity of the acquired second sub-secret information before acquiring the secret information from the second sub-secret information, thereby ensuring the validity of the secret information and reducing the probability of generating invalid random numbers.
In a specific embodiment, thefirst node 11 verifies the validity of the acquired N-1 second sub-secret information one by one according to Pedersen-VSS; if the N-1 second sub-secret information are all valid, thefirst node 11 acquires the secret information according to the second sub-secret information. That is, the validity of the obtained N-1 pieces of sub-secret information is verified, and when the obtained N-1 pieces of second sub-secret information are all valid, the secret information is obtained according to the second sub-secret information, that is, the safety of secret information generation is ensured, and the validity of the secret information is ensured.
In another specific embodiment, thefirst node 11 verifies the validity of the acquired N-1 second sub-secret information one by one according to Pedersen-VSS. When the valid sub-secret information of the N-1 pieces of second sub-secret information exceeds a first preset value, thefirst node 11 acquires the secret information according to the second sub-secret information. The first preset value is smaller than N-1, and the first preset value can be set according to specific situations, which is not limited in the present application. The validity of part of the secret information in the N-1 pieces of second sub-secret information is verified, and the obtained N-1 pieces of second sub-secret information are evaluated for validity, so that the secret information is guaranteed to be valid, the generation efficiency of the secret information is improved, and the generation efficiency of random numbers is improved.
In some implementations of the present application, thefirst node 11 verifies the validity of the acquired N-1 pieces of sub-secret information to acquire a first validity verification result. Thefirst node 11 receives the second validity verification result of the second node. And the second validity verification result is a validity verification result set obtained after the N-1 second nodes verify the N-1 sub-secret information obtained by the second nodes. Thefirst node 11 determines the validity of the N-1 sub-secret information according to the first validity verification result and the second validity verification result; if the N-1 second sub-secret information is valid, thefirst node 11 acquires the secret information from the second sub-secret information. That is, when verifying the acquired N-1 pieces of sub-secret information, thefirst node 11 agrees with other nodes in theblockchain system 10 in consistency with the verification result, and by participating in the verification by multiple nodes, it is possible to avoid the malicious behavior of the nodes, improve the reliability of the verification result, and improve the security of the random number.
In the following, a specific manner of verifying the validity of the acquired N-1 sub-secret information by thefirst node 11 will be described by taking the verification of one sub-secret information as an example. Thefirst node 11 can verify the validity of the acquired N-1 sub-secret information by verifying the validity of the acquired N-1 sub-secret information one by one according to the following manner.
For example, thefirst node 11 obtains the sub-secret information a1, B1, and C1, respectively. The sub-secret information obtained by thethird node 13 is respectively A2, B2 and C2; the child secret information obtained by thethird node 13 is a3, B3, and C3, respectively. Thefirst node 11 verifies the validity of the sub-secret information B1 sent by thethird node 13, and the first validity verification result is that the sub-secret information B1 is invalid; thethird node 13 verifies the validity of the sub-secret information B2 distributed by itself, and the third verification result obtained is that the sub-secret information B2 is valid, and thefirst node 11 obtains the third verification result sent by thethird node 13; thefourth node 14 verifies the validity of the sub-secret information B3 sent by thethird node 13, and thefirst node 11 obtains the fourth verification result sent by thefourth node 14, if the fourth verification result is that the sub-secret information B3 is invalid. And the second validity verification result of the second node comprises a third verification result and a fourth verification result. Therefore, thefirst node 11 obtains 3 first validity verification results and 3 second validity verification results, that is, the sub-secret information B1 is invalid, the sub-secret information B2 is valid, and the sub-secret information B3 is invalid. If the consistency consensus is performed according to the voting method, since the number of nodes for verifying that the sub-secret information sent by thethird node 13 is invalid is 2, and the number of nodes for verifying that the sub-secret information sent by thethird node 13 is valid is 1, the number of nodes for verifying that the sub-secret information sent by thethird node 13 is invalid is greater than the number of nodes for verifying that the sub-secret information sent by thethird node 13 is valid. Therefore, thefirst node 11, thethird node 13, and thefourth node 14 invalidate the sub-secret information sent by thethird node 13, reach a consensus of consistency, and mark thethird node 13 as a dishonest node. Therefore, thefirst node 11 determines that the sub-secret information B1 is invalid according to the first validity verification result and the second validity verification result. In the same manner, thefourth node 14 determines that the sub-secret information B3 is invalid according to the first validity verification result and the second validity verification result. In other embodiments, the consistency consensus may also be performed according to other manners to further determine the validity of the sub-secret information, which is not limited in this application.
In some embodiments of the present application, after obtaining the first secret information, thefirst node 11 signs the preset message according to the first secret information to obtain first signature information. Based on the same mode, the N-1 second nodes respectively sign the preset message according to the second secret information of the second nodes, and N-1 second signature information is obtained. The predetermined message is the same message received by each node in theblockchain system 10. For example, thefirst node 11 signs the preset message according to the first secret information a10, resulting in first signature information a 11. In the same way, thethird node 13 signs the preset message according to the third secret information B20, and obtains third signature information B21. Thefourth node 14 signs the preset message according to the fourth secret information C30, resulting in fourth signature information C31. That is, the obtained N-1 second signature information is the third signature information B21 and the fourth signature information C31, respectively.
102. And acquiring second signature information generated by the second node based on the preset message.
Specifically, thefirst node 11 listens to the broadcast of the second node to obtain the second signature information generated by the second node based on the preset message.
Since thefirst node 11 and the second node are in peer-to-peer status, the second node can also obtain the second signature information generated based on the preset message according tostep 101. Here, the step of generating the second signature information by the second node based on the preset message is not described in detail.
103. And aggregating the first signature information and the second signature information to obtain aggregated signature information.
In some implementations of the present application, thefirst node 11 aggregates the first signature information and the second signature information to obtain a first set of signatures. For convenience of the following description, the aggregated signature information is referred to as a group signature. Based on the same mode, the N-1 nodes respectively obtain a second group of signatures of the N-1 nodes according to the acquired N-1 signature information and one self-distributed signature information. For example, thefirst node 11 performs aggregated signatures according to the first signature information a11, the third signature information B21, and the fourth signature information C31 to obtain a first group signature a 12. In the same way, thethird node 13 performs aggregated signature according to the first signature information a11, the third signature information B21 and the fourth signature information C31, to obtain a third group signature B22. Thefourth node 14 performs aggregated signatures according to the first signature information a11, the third signature information B21, and the fourth signature information C31, and obtains a fourth set of signatures C32. Wherein the second set of signatures of the N-1 nodes is a third set of signatures B22 and a fourth set of signatures C32.
In some implementations of the present application, the first signature information and the second signature information are sequentially subjected to validity checks; and when the obtained N pieces of signature information are all legal signature information, acquiring the group signature according to the obtained N pieces of signature information.
In some implementations of the present application, the first signature information and the second signature information are sequentially subjected to validity checks; and when T legal signature information exists in the obtained N signature information, acquiring a group signature according to the T legal signature information, wherein T is a positive integer and is not more than N.
In a specific embodiment, the first signature information and the second signature information are subjected to validity check in sequence, illegal signature information is deleted, and legal signature information is cached. And when the number of the obtained legal signature information reaches T, the obtained T legal signature information is used as input, and a BLS signature algorithm is operated to recover the group signature. The BLS signature algorithm is proposed by Dan Boneh, Ben Lynn and Hovav Shacham, university of stanford, and is an algorithm capable of implementing signature aggregation and key aggregation, i.e., a plurality of keys can be aggregated into a key, and a plurality of signatures can be aggregated into a signature. Threshold signatures based on the BLS type are very simple, do not need to carry out multiple rounds of communication among signatories, and can reduce complexity of signatures.
In other embodiments, when the number of the obtained legal signature information reaches T, the obtained T legal signature information is used as input, and a Schnorr signature algorithm is run to recover the group signature. By Schnorr signature, all signature verification equations can be added, all signatures can be verified at one time, block verification can also be faster, and thus some computing power is saved.
104. And generating a first random number according to the aggregated signature information.
In some embodiments of the present application, thefirst node 11 generates the first random number according to the aggregated signature information, and may include the following steps:
(1) thefirst node 11 obtains the private key of thefirst node 11.
Specifically, thefirst node 11 obtains the private key of thefirst node 11 according to the asymmetric encryption algorithm. In other embodiments, thefirst node 11 may also obtain the private key of thefirst node 11 according to a symmetric encryption algorithm. The symmetric encryption algorithm uses the same secret key in encryption and decryption; a non-symmetric encryption algorithm requires two keys, a public key and a private key, to encrypt and decrypt. Unlike symmetric encryption algorithms, asymmetric encryption algorithms require two keys: a public key and a private key. The public key and the private key are a pair, and if the public key is used for encrypting data, the data can be decrypted only by using the corresponding private key; if the data is encrypted with a private key, it can only be decrypted with the corresponding public key.
Preferably, thefirst node 11 obtains the private key of thefirst node 11 according to the RSA encryption algorithm. The RSA encryption algorithm was proposed in 1977 by Ronard Livister (Ron Rivest), Adi Samor (Adi Shamir), and Lonard Adleman (Leonard Adleman). The RSA encryption algorithm usually generates a pair of RSA keys, one of which is a private key, and is stored by the user; the other is a public key which can be disclosed to the outside and even registered in a network server. To increase the security strength, the RSA key is at least 500 bits long, and 1024 bits are generally recommended. The RSA encryption algorithm is the first algorithm that can be used for both encryption and digital signatures, and is also easy to understand and operate. In other embodiments, thefirst node 11 may also obtain the private key of thefirst node 11 according to an elliptic encryption algorithm. In the encryption and decryption speed of the private key, the speed of the elliptic encryption algorithm is high, the occupied storage space is small, and the bandwidth requirement is low.
(2) Thefirst node 11 generates a first random number and certification information corresponding to the first random number according to the aggregated signature information and the private key of thefirst node 11.
In some implementations of the present application, thefirst node 11 generates a first Random number and certification information corresponding to the first Random number through a Verifiable Random Function (VRF) using the first set of signatures and a private key of thefirst node 11 as input. The first random number and the certification information corresponding to the first random number are generated through the verifiable random function, so that the random number which is truly random, cannot be predicted and can be verified can be generated.
Based on the same mode, the N-1 second nodes respectively use the second nodes as input according to the second group of signatures and the private keys of the second nodes, and generate second random numbers and the certification information corresponding to the second random numbers through verifiable random functions.
For example, thefirst node 11 generates the certification information corresponding to the first random number a13 and the first random number a13 according to the first group signature a12 and the private key of thefirst node 11. Thethird node 13 generates certification information corresponding to the third random number B23 and the third random number B23, based on the third group signature B22 and the private key of thethird node 13. Thefourth node 14 generates certification information corresponding to the fourth random number C33 and the fourth random number C33 based on the fourth set signature C32 and the private key of thefourth node 14.
105. And acquiring the validity verification result of the second node on the first random number.
Specifically, thefirst node 11 sends the first random number and the certification information corresponding to the first random number to the second node, so that the second node verifies the validity of the first random number. For example, thefirst node 11 sends the first random number a13 and the certification information of the first random number a13 to the second node, so that the second node verifies the validity of the first random number a 13.
Specifically, thefirst node 11 monitors the broadcast of the second node to obtain the validity verification result of the second node on the first random number.
Since thefirst node 11 and the second node are peer-to-peer, the second node needs to verify the first random number generated by thefirst node 11, and thefirst node 11 also needs to verify the second random number generated by the second node. Here, taking the example that thefirst node 11 verifies the second random number generated by the second node, the process of obtaining the validity verification result is described. Obtaining the validity verification result of thefirst node 11 on the second random number may include the following steps:
(1) thefirst node 11 obtains the public key of the second node, the second random number of the second node, and the certification information corresponding to the second random number.
Specifically, thefirst node 11 monitors the broadcast of the second node, and obtains the public key of the second node, the second random number of the second node, and the certification information corresponding to the second random number. And the second node acquires the public key and the private key of the second node according to the asymmetric encryption algorithm. In other embodiments, the second node may also obtain the public key and the private key of the second node according to a symmetric encryption algorithm.
(2) And thefirst node 11 verifies the validity of the second random number according to the group signature, the public key of the second node, the second random number and the certification information corresponding to the second random number, so as to obtain a validity verification result of the first node on the second random number.
Specifically, thefirst node 11 takes the group signature, the public key of the second node, the second random number, and the certification information corresponding to the second random number as inputs, and verifies the validity of the second random number through the verifiable random function, so as to obtain the validity verification result of the first node on the second random number.
Therefore, the second node monitors the broadcast of thefirst node 11 to obtain the validity verification result of the first node on the second random number. In the same way, thefirst node 11 monitors the broadcast of the second node to obtain the validity verification result of the second node on the first random number.
106. When the first random number is determined to be legal based on the result of validity verification of the second node, the first node stores the first random number.
Specifically, thefirst node 11 and the second node agree on the verification result. When thefirst node 11 and the second node agree the first random number, thefirst node 11 determines that the first random number is legal, and thefirst node 11 stores the first random number. That is, by the plurality of nodes participating in the verification of the first random number, the malicious behavior of the nodes can be avoided, the reliability of the verification result can be improved, and the security of the random number can be improved.
In some embodiments of the present application, thefirst node 11 further participates in verifying the second random number generated by the second node, and sends a validity verification result of the second random number by thefirst node 11 to the second node, which may specifically include the following steps:
(1) thefirst node 11 obtains the public key of the second node, the second random number, and the certification information corresponding to the second random number.
Specifically, thefirst node 11 monitors the broadcast of the second node, and obtains the public key of the second node, the second random number of the second node, and the certification information corresponding to the second random number. And the second node acquires the public key and the private key of the second node according to the asymmetric encryption algorithm. In other embodiments, the second node may also obtain the public key and the private key of the second node according to a symmetric encryption algorithm.
(2) And thefirst node 11 verifies the validity of the second random number according to the group signature, the public key of the second node, the second random number and the certification information corresponding to the second random number to obtain a first validity verification result.
Specifically, thefirst node 11 takes the first group of signatures, the public key of the second node, the second random number, and the certification information corresponding to the second random number as inputs, and verifies the validity of the second random number through the verifiable random function to obtain the first validity verification result.
(3) Thefirst node 11 receives the second validity verification result for the second random number sent by the second node.
Based on the same mode, the N-1 second nodes respectively use the second group of signatures, the public key of the second node, the second random number and the certification information corresponding to the second random number as input, and verify the validity of the second random number through a verifiable random function, so as to obtain N-1 second validity verification results.
For example, thethird node 13 verifies the validity of the third random number B23 through the verifiable random function, and obtains a third verification result that the third random number B23 is valid. Thefourth node 14 verifies the validity of the third random number B23 through the verifiable random function, and obtains a fourth verification result that the third random number B23 is valid. Therefore, the obtained N-1 second validity verification results are respectively the third verification result and the fourth verification result. In the same manner, the fourth random number can also be verified. Thereby obtaining a second validity verification result of the second random number.
Thefirst node 11 listens to the broadcast of the second node to receive the second validity verification result for the second random number sent by the second node.
(4) And determining the validity of the second random number according to the first validity verification result and the second validity verification result.
Specifically, according to the first validity verification result and the second validity verification result, whether thefirst node 11 and the second node are legal or not is judged, and a consensus is achieved for the second random number, if yes, the second random number is determined to be legal; if not, determining that the second random number is illegal.
(5) If the second random number is determined to be legitimate, thefirst node 11 stores the second random number.
In this embodiment of the present application, if it is determined that the second random number is legal, thefirst node 11 stores the second random number. That is, since the plurality of nodes participate in the verification of the second random number, the nodes can be prevented from doing malicious work, the reliability of the verification result can be improved, and the security of the random number can be improved.
As the number of the second nodes is N-1, the N-1 second random numbers are correspondingly generated, so that the legality of the N-1 second random numbers is determined one by one, and the legal second random numbers are stored one by one.
Different from the prior art, the method for generating a random number according to the embodiment of the present application is applied to a blockchain system, where the blockchain system includes at least two nodes connected to each other, and the at least two nodes include a first node and a second node, and the generating method is performed by the first node, and includes: acquiring first signature information generated by the self based on a preset message; acquiring second signature information generated by a second node based on a preset message; aggregating the first signature information and the second signature information to obtain aggregated signature information; generating a first random number according to the aggregated signature information; obtaining a validity verification result of the second node on the first random number; when the first random number is determined to be legal based on the result of validity verification of the second node, the first node stores the first random number. According to the method and the device, the plurality of nodes participate in the generation of the random number, so that the safety of the generation of the random number is improved.
The method for generating the random number in the embodiment of the present application is described below with reference to a specific application scenario.
Referring to fig. 3, fig. 3 is a schematic flow chart of another embodiment of a method for generating a random number according to an embodiment of the present application, and fig. 4 is a schematic information interaction diagram of each node in the method for generating a random number according to the embodiment of the present application. The present embodiment is still illustrated by taking theblock chain system 10 in fig. 1 as an example, where N is 3.
The method flow can comprise the following steps:
201. the first node generates a secret number A according to a preset secret generation strategy.
Specifically, thefirst node 11 randomly generates a secret number. In the same way, the N-1 second nodes also randomly generate own secret numbers respectively. For example, thefirst node 11 randomly generates a first secret a, thethird node 13 randomly generates a third secret B, and thefourth node 14 randomly generates a fourth secret C. That is, the two second nodes generate their own secrets, namely, the third secret B and the fourth secret C.
202. The first node divides the secret number A into N first sub-secret information according to a preset secret sharing strategy.
Specifically, thefirst node 11 divides the first secret number a into 3 pieces of first sub-secret information according to Pedersen-VSS, and calculates the first sub-secret information to be shared as a1, a2 and A3, respectively. Meanwhile, the N-1 second nodes divide the secret number into 3 sub-secret information according to Pedersen-VSS. For example, thethird node 13 divides the third secret number B into 3 pieces of third sub-secret information according to Pedersen-VSS, and calculates the third sub-secret information to be shared as B1, B2, and B3, respectively. Thefourth node 14 divides the fourth secret number C into 3 fourth sub-secret information according to Pedersen-VSS, and calculates that the fourth sub-secret information to be shared is C1, C2 and C3, respectively.
203. The first node distributes N-1 first sub-secret information to the second node.
Specifically, thefirst node 11 distributes N-1 pieces of first sub-secret information to the second node in the form of a broadcast transmitted in theblock chain system 10. For example, thefirst node 11 assigns the first sub-secret information a1 to itself, and assigns the first sub-secret information a2 to thethird node 13 by broadcast, and assigns the first sub-secret information A3 to thefourth node 14 by broadcast.
204. And the first nodes respectively receive second sub-secret information sent by the second nodes, and the second sub-secret information comprises sub-secret information respectively sent by N-1 nodes in the second nodes.
Since the N-1 second nodes are equal in status to thefirst node 11, the N-1 second nodes also respectively distribute the N sub-secret information of the second nodes to each node in theblockchain system 10 in the same manner.
For example, thethird node 13 assigns the third sub-secret information B2 to itself, and assigns the third sub-secret information B1 to thefirst node 11 by broadcast, and assigns the third sub-secret information B3 to thefourth node 14 by broadcast. Thefourth node 14 assigns the fourth sub-secret information C3 to itself, and assigns the fourth sub-secret information C1 to thefirst node 11 by broadcast, and assigns the fourth sub-secret information C2 to thethird node 13 by broadcast.
Therefore, through the information interaction of thefirst node 11 with thethird node 13 and thefourth node 14, the child secret information obtained by thefirst node 11 is a1, B1 and C1, respectively, and the child secret information obtained by thethird node 13 is a2, B2 and C2, respectively; the child secret information obtained by thethird node 13 is a3, B3, and C3, respectively.
205. The first node verifies the validity of the acquired N-1 pieces of second sub-secret information.
Specifically, thefirst node 11 verifies the validity of the acquired N-1 sub-secret information one by one according to Pedersen-VSS. Based on the same manner, thethird node 13 verifies the validity of the acquired N-1 sub-secret information one by one according to Pedersen-VSS. Thefourth node 14 verifies the validity of the acquired N-1 sub-secret information one by one according to Pedersen-VSS.
206. If the N-1 second sub-secret information is valid, the first node obtains the secret information A10 according to the second sub-secret information.
Specifically, if thefirst node 11 verifies that the obtained N-1 sub-secret information is valid according to Pedersen-VSS, the secret information a10 is obtained according to the second sub-secret information.
For example, thefirst node 11 performs secret aggregation of a1, B1, and C1 according to Pedersen-VSS to calculate first secret information a 10. Based on the same mode, the N-1 second nodes respectively calculate the N-1 second secret information according to the received N-1 sub secret information and one piece of sub secret information of the second nodes. Thethird node 13 performs secret aggregation on the A2, the B2 and the C2 according to the Pedersen-VSS to calculate third secret information A20. Thefourth node 14 performs secret aggregation on the A3, the B3 and the C3 according to Pedersen-VSS to calculate fourth secret information C30. That is, the N-1 pieces of second secret information are the third secret information B20 and the fourth secret information C30, respectively.
207. The first node signs the message M according to the secret information to obtain first signature information a 11.
Specifically, thefirst node 11 signs the message M according to the first secret information a10, to obtain first signature information a 11. In the same way, thethird node 13 signs the message M according to the third secret information B20, resulting in third signature information B21. Thefourth node 14 signs the message M according to the fourth secret information C30, resulting in fourth signature information C31. That is, the obtained N-1 second signature information is the third signature information B21 and the fourth signature information C31, respectively.
208. And the first node acquires second signature information generated by the second node based on the message M.
Specifically, thefirst node 11 listens to the broadcast of the second node to acquire the second signature information generated by the second node based on the message M. Therefore, the signature information obtained by thefirst node 11, thethird node 13 and thefourth node 14 is the first signature information a11, the third signature information B21 and the fourth signature information C31.
209. The first node obtains a group signature a12 according to the first signature information and the second signature information.
Specifically, thefirst node 11 obtains a first group of signatures according to the first signature information and the second signature information. Based on the same mode, the N-1 nodes respectively obtain a second group of signatures of the N-1 nodes according to the acquired N-1 signature information and one self-distributed signature information. For example, thefirst node 11 performs aggregated signatures according to the first signature information a11, the third signature information B21, and the fourth signature information C31 to obtain a first group signature a 12. In the same way, thethird node 13 performs aggregated signature according to the first signature information a11, the third signature information B21 and the fourth signature information C31, to obtain a third group signature B22. Thefourth node 14 performs aggregated signatures according to the first signature information a11, the third signature information B21, and the fourth signature information C31, and obtains a fourth set of signatures C32. Wherein the second set of signatures of the N-1 nodes is a third set of signatures B22 and a fourth set of signatures C32.
210. The first node obtains a private key of the first node.
Specifically, thefirst node 11 obtains the private key SK1 of thefirst node 11 according to the RSA encryption algorithm. In the same way, thethird node 13 obtains the private key SK2 of thethird node 13 according to the RSA encryption algorithm. Thefourth node 14 obtains the private key SK3 of thefourth node 14 according to the RSA encryption algorithm.
211. The first node generates the certification information corresponding to the first random number A13 and the first random number A13 according to the group signature and the private key of the first node.
Specifically, thefirst node 11 generates the certification information corresponding to the first random number a13 and the first random number a13 by using the first group signature a12 and the private key SK1 of thefirst node 11 as inputs and using a verifiable random function. Thethird node 13 generates certification information corresponding to the third random number B23 and the third random number B23 with the third group signature B22 and the private key SK2 of thethird node 13. Thefourth node 14 generates certification information corresponding to the fourth random number C33 and the fourth random number C33, based on the fourth group signature C32 and the private key SK3 of thefourth node 14.
212. And acquiring the validity verification result of the second node on the first random number A13.
Specifically, thefirst node 11 obtains the public key PK1 of thefirst node 11 according to the RSA encryption algorithm, and thefirst node 11 sends the proof information of the public key PK1, the first random number a13, and the first random number a13 to the second node, so that the second node verifies the validity of the first random number a 13.
For example, thefirst node 11 verifies the validity of the first random number a13, and the first validity verification result is that the first random number a13 is valid; thethird node 13 verifies the validity of the first random number a13, and the third verification result is that the first random number a13 is valid; thefourth node 14 verifies the validity of the first random number a13, and the fourth verification result is that the first random number a13 is illegal. If the consensus is performed according to the voting method, the number of nodes for verifying the first random number a13 as legitimate is 2, and the number of nodes for verifying the first random number a13 as illegitimate is 1. The number of nodes that verify the first random number a13 as legitimate is greater than the number of nodes that verify the first random number a13 as illegitimate. Therefore, thefirst node 11, thethird node 13 and thefourth node 14 agree that the first random number a13 is legitimate and determine that the first random number a13 is legitimate.
If the number of the nodes which verify the first random number A13 as legal is less than the number of the nodes which verify the first random number A13 as illegal. Thefirst node 11, thethird node 13 and thefourth node 14 are legal and do not reach consistency consensus for the first random number a13, and determine that the first random number a13 is illegal.
In the same manner, thefirst node 11, thethird node 13 and thefourth node 14 can verify the validity of the third random number B23 and the fourth random number C33.
For example, thefirst node 11 verifies the validity of the third random number B23 with thethird node 13 and thefourth node 14. First, thefirst node 11 acquires the certification information corresponding to the public key PK2, the third random number B23, and the third random number B23 of thethird node 13. Thethird node 13 obtains the public key PK2 of thethird node 13 according to the RSA encryption algorithm, and sends the public key PK2 to thefirst node 11 and thefourth node 14. Thefirst node 11 takes the first group signature a12, the proof information corresponding to the public key PK2 of thethird node 13, the third random number B23 and the third random number B23 as input, and verifies the validity of the third random number B23 by a verifiable random function. In the same manner, thefourth node 14 verifies the validity of the third random number B23 by using the verifiable random function with the fourth set of signatures B32, the certification information corresponding to the public key PK2, the third random number B23, and the third random number B23 of thethird node 13 as input. Thefirst node 11, thethird node 13 and thefourth node 14 verify the validity of the third random number B23 by performing consistency consensus on the verified third random number B23.
213. If the first random number is determined to be legitimate based on the result of the validity verification by the second node, the first node stores the first random number a 13.
Specifically, if the verification result of verifying the validity of the first random number a13 is legal, the first node stores the first random number a 13. In the same manner, when the third random number B23 and the fourth random number C33 are verified to be legitimate, the third random number B23 and the fourth random number C33 are stored.
In order to better implement the generation method provided by the embodiment of the present application, the embodiment of the present application further provides a node based on the generation method. The terms are the same as those in the above-described generation method, and details of implementation may refer to the description in the method embodiment.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an embodiment of a random number generating device according to the present application. The generating device is applied to afirst node 11 in ablockchain system 10, theblockchain system 10 includes at least two nodes connected to each other, and the at least two nodes include thefirst node 11 and a second node. The generating means may comprise a first acquiringunit 301, a second acquiringunit 302, asigning unit 303, a randomnumber generating unit 304, a third acquiringunit 305 and a randomnumber storing unit 306,
the generation device specifically comprises the following components:
the first obtainingunit 301 is configured to obtain first signature information generated by itself based on a preset message.
In this embodiment of the application, the first obtainingunit 301 signs the preset message, and the first obtainingunit 301 obtains first signature information generated by itself based on the preset message. Preferably, the first obtainingunit 301 performs digital signature on the preset message to obtain first signature information generated by itself based on the preset message. In short, a digital signature is some data appended to a data unit or a cryptographic transformation performed on a data unit. Such data or transformations allow the recipient of the data unit to verify the source of the data unit and the integrity of the data unit and to protect the data against counterfeiting by a person (e.g., the recipient). Which is a method of signing a message in electronic form, a signed message being capable of being transmitted in a communication network.
Referring to fig. 6, fig. 6 is a schematic structural diagram of an embodiment of the first obtaining unit in fig. 5. In some embodiments of the present application, the first obtainingunit 301 includes: asecret sharing subunit 3011, and asignature subunit 3012. Asecret sharing subunit 3011, configured to share a secret with a second node to obtain secret information; and asignature subunit 3012, configured to sign the preset message according to the secret information, to obtain first signature information. That is, thefirst node 11 and the second node share the secret, so as to participate in the signature of thefirst node 11 on the preset message together, and further realize decentralization.
In some embodiments of the present application, thesecret sharing subunit 3011 performs secret sharing with the second node to obtain secret information, and may include the following steps:
(1) thesecret sharing subunit 3011 generates a secret number according to a preset secret generation policy.
(2) Thesecret sharing subunit 3011 divides the secret number into N pieces of first sub-secret information according to a preset secret sharing policy, where N is the number of nodes in theblock chain system 10.
(3) Thesecret sharing subunit 3011 distributes N-1 pieces of first sub-secret information to the second node.
(4) Thesecret sharing subunit 3011 is configured to receive second sub-secret information sent by the second node, where the second sub-secret information includes sub-secret information sent by N-1 nodes in the second node;
(5) thesecret sharing subunit 3011 obtains the secret information from the second sub-secret information.
In this embodiment, thesecret sharing subunit 3011 receives the second sub-secret information sent by the second node, respectively, to obtain N-1 pieces of second sub-secret information, and since it is also distributed with one piece of first sub-secret information, the first node finally obtains N pieces of sub-secret information. Thesecret sharing subunit 3011 obtains secret information from the N pieces of sub-secret information.
In some implementations of the present application, thesecret sharing subunit 3011 verifies validity of the obtained N-1 sub-secret information to obtain a validity verification result. If the validity verification result is valid, thesecret sharing subunit 3011 obtains the secret information according to the second sub-secret information. That is, thesecret sharing subunit 3011, before obtaining the secret information from the second sub-secret information, verifies the validity of the obtained second sub-secret information, thereby ensuring the validity of the secret information and reducing the probability of generating an invalid random number.
In some embodiments of the present application, after thesecret sharing subunit 3011 obtains the first secret information, thesigning subunit 3012 signs the preset message according to the first secret information to obtain the first signature information. Based on the same mode, the N-1 second nodes respectively sign the preset message according to the second secret information of the second nodes, and N-1 second signature information is obtained. The predetermined message is the same message received by each node in theblockchain system 10.
The second obtainingunit 302 is configured to obtain second signature information generated by the target node based on the preset message.
Specifically, the second obtainingunit 302 monitors the broadcast of the second node to obtain the second signature information generated by the second node based on the preset message.
Since thefirst node 11 and the second node are in peer-to-peer status, the second node can also obtain the second signature information generated based on the preset message according tostep 101. Here, the step of generating the second signature information by the second node based on the preset message is not described in detail.
Thesignature unit 303 obtains a group signature from the first signature information and the second signature information.
In some implementations of the present application, thesignature unit 303 performs validity check on the first signature information and the second signature information in sequence; when the obtained N pieces of signature information are all valid signature information, thesignature unit 303 obtains a group signature according to the obtained N pieces of signature information.
In some implementations of the present application, thesignature unit 303 performs validity check on the first signature information and the second signature information in sequence; when T pieces of legal signature information exist in the obtained N pieces of signature information, thesignature unit 303 acquires a group signature according to the T pieces of legal signature information, where T is a positive integer and is not greater than N.
The randomnumber generation unit 304 is configured to generate a first random number according to the group signature.
Specifically, the randomnumber generation unit 304 is configured to obtain a private key of the first node; and generating the first random number and the certification information corresponding to the first random number according to the aggregated signature information and the private key of the first node.
The third obtainingunit 305 is configured to obtain a validity verification result of the first random number by the second node.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an embodiment of the third obtaining unit in fig. 5. In some embodiments of the present application, the third obtainingunit 305 includes: anacquisition sub-unit 3051 and averification sub-unit 3052. The obtainingsubunit 3051 is configured to obtain a public key of the second node, a second random number of the second node, and certification information corresponding to the second random number; the verifyingsubunit 3052 is configured to verify validity of the second random number according to the aggregated signature information, the public key of the second node, the second random number, and the certification information corresponding to the second random number.
The obtainingsubunit 3051 monitors the broadcast of the second node to obtain a validity verification result of the second node on the first random number.
The randomnumber storage unit 306 is configured to, when it is determined that the first random number is legitimate based on the result of the validity verification of the second node, the first node stores the first random number. The randomnumber storage unit 306 is further configured to store the second random number when theverification subunit 3052 verifies that the second random number is legal. .
In this embodiment, if it is determined that the second random number is legal, the randomnumber generation unit 304 stores the second random number. That is, by the nodes participating in the validity verification of the second random number and by the plurality of nodes participating in the verification of the second random number, the nodes can be prevented from doing malicious activities, the reliability of the verification result can be improved, and the security of the random number can be improved.
Different from the prior art, the random number generation apparatus according to the embodiment of the present application is applied to a first node in a blockchain system, where the blockchain system includes at least two nodes connected to each other, and the at least two nodes include the first node and a second node, and the generation method is executed by the first node, and the generation method includes: acquiring first signature information generated by the self based on a preset message; acquiring second signature information generated by a second node based on a preset message; aggregating the first signature information and the second signature information to obtain aggregated signature information; generating a first random number according to the aggregated signature information; obtaining a validity verification result of the second node on the first random number; when it is determined that the first random number is legitimate based on the result of the validity verification of the second node, the first random number is stored. According to the method and the device, the plurality of nodes participate in the generation of the random number, so that the safety of the generation of the random number is improved.
An embodiment of the present application further provides a device for generating a random number, and referring to fig. 8, fig. 8 is a schematic structural diagram of another embodiment of the device for generating a random number provided in the embodiment of the present application. As shown in fig. 8, a schematic structural diagram of a generating device according to an embodiment of the present application is shown, specifically:
the generating means may comprise components such as aprocessor 501 of one or more processing cores, amemory 502 of one or more computer readable storage media, apower supply 503 and aninput unit 504. Those skilled in the art will appreciate that the generator configuration shown in fig. 8 does not constitute a limitation of the generator and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components. Wherein:
theprocessor 501 is a control center of the generating apparatus, connects various parts of the entire generating apparatus by various interfaces and lines, and executes various functions of the generating apparatus and processes data by running or executing the software program and/or the present application stored in thememory 502 and calling the data stored in thememory 502, thereby monitoring the entire generating apparatus. Optionally,processor 501 may include one or more processing cores; preferably, theprocessor 501 may integrate an application processor and a modem processor, wherein the application processor mainly handles operations of storage media, user interfaces, application programs, and the like, and the modem processor mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into theprocessor 501.
Thememory 502 may be used to store software programs and applications, and theprocessor 501 executes various functional applications and data processing by executing the software programs and applications stored in thememory 502. Thememory 502 may mainly include a storage program area and a storage data area, wherein the storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for operating a storage medium, at least one function, and the like; the storage data area may store data created according to the use of the generation apparatus, and the like. Further, thememory 502 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, thememory 502 may also include a memory controller to provide theprocessor 501 with access to thememory 502.
The generating device further comprises apower supply 503 for supplying power to each component, and preferably, thepower supply 503 may be logically connected to theprocessor 501 through a power management storage medium, so that functions of managing charging, discharging, power consumption management and the like are realized through the power management storage medium. Thepower supply 503 may also include any component of one or more dc or ac power sources, rechargeable storage media, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The generating device may also include aninput unit 504, and theinput unit 504 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the generating device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, theprocessor 501 in the generating apparatus loads the executable file corresponding to the process of one or more application programs into thememory 502 according to the following instructions, and theprocessor 501 runs the application programs stored in thememory 502, thereby implementing various functions as follows:
acquiring first signature information generated by the self based on a preset message; acquiring second signature information generated by a second node based on a preset message; aggregating the first signature information and the second signature information to obtain aggregated signature information; generating a first random number according to the aggregated signature information; obtaining a validity verification result of the second node on the first random number; when it is determined that the first random number is legitimate based on the result of the validity verification of the second node, the first random number is stored.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present application provides a storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the generating methods provided by the present application. For example, the instructions may perform the steps of:
acquiring first signature information generated by the self based on a preset message; acquiring second signature information generated by a second node based on a preset message; aggregating the first signature information and the second signature information to obtain aggregated signature information; generating a first random number according to the aggregated signature information; obtaining a validity verification result of the second node on the first random number; when it is determined that the first random number is legitimate based on the result of the validity verification of the second node, the first random number is stored.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the storage medium may execute the steps in any random number generation method provided in the embodiments of the present application, beneficial effects that can be achieved by any random number generation method provided in the embodiments of the present application may be achieved, and for details, refer to the foregoing embodiments, and are not described herein again.
The method, node and system for generating random numbers provided by the embodiments of the present application are described in detail above, and a specific example is applied in the present application to explain the principle and implementation of the present application, and the description of the above embodiments is only used to help understand the method and core ideas of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

the device comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for generating a secret number according to a preset secret generation strategy; dividing the secret number into N pieces of first sub-secret information according to a preset secret sharing strategy, wherein N is the number of nodes in the block chain system, and is a positive integer; distributing N-1 first sub-secret information to the second node in the form of a broadcast transmitted in the blockchain system; monitoring N-1 second nodes, and respectively receiving second sub-secret information sent by the second nodes, wherein the second sub-secret information comprises sub-secret information sent by N-1 nodes in the second nodes respectively; secret information is obtained according to the second sub-secret information; signing a preset message according to the secret information to obtain first signature information;
CN201911256624.9A2019-06-202019-06-20Random number generation method, random number generation device and storage mediumActiveCN110971413B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201911256624.9ACN110971413B (en)2019-06-202019-06-20Random number generation method, random number generation device and storage medium

Applications Claiming Priority (2)

Application NumberPriority DateFiling DateTitle
CN201910535779.XACN110213059B (en)2019-06-202019-06-20 Random number generation method, generation device and storage medium
CN201911256624.9ACN110971413B (en)2019-06-202019-06-20Random number generation method, random number generation device and storage medium

Related Parent Applications (1)

Application NumberTitlePriority DateFiling Date
CN201910535779.XADivisionCN110213059B (en)2019-06-202019-06-20 Random number generation method, generation device and storage medium

Publications (2)

Publication NumberPublication Date
CN110971413Atrue CN110971413A (en)2020-04-07
CN110971413B CN110971413B (en)2021-07-06

Family

ID=67793634

Family Applications (2)

Application NumberTitlePriority DateFiling Date
CN201910535779.XAActiveCN110213059B (en)2019-06-202019-06-20 Random number generation method, generation device and storage medium
CN201911256624.9AActiveCN110971413B (en)2019-06-202019-06-20Random number generation method, random number generation device and storage medium

Family Applications Before (1)

Application NumberTitlePriority DateFiling Date
CN201910535779.XAActiveCN110213059B (en)2019-06-202019-06-20 Random number generation method, generation device and storage medium

Country Status (1)

CountryLink
CN (2)CN110213059B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112799636A (en)*2021-04-142021-05-14北京百度网讯科技有限公司 Random number generation method, apparatus, device and storage medium
CN114092101A (en)*2022-01-212022-02-25深圳市一航网络信息技术有限公司Transaction verification method and device, storage medium and electronic equipment
CN114553505A (en)*2022-02-092022-05-27蚂蚁区块链科技(上海)有限公司Method and device for generating random number by cooperation of multiple parties

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN110599173B (en)*2019-09-202021-08-17腾讯科技(深圳)有限公司Block chain consensus node determination method, device, equipment and storage medium
CN110597489B (en)*2019-09-262023-11-24腾讯科技(深圳)有限公司Random number generation method, equipment and medium
CN110633071B (en)*2019-09-262023-09-05腾讯科技(深圳)有限公司Random number generation method and device
CN110990790B (en)*2019-11-292022-05-10腾讯科技(深圳)有限公司Data processing method and equipment
CN111177259A (en)*2019-12-132020-05-19杭州复杂美科技有限公司Parallel chain transaction encryption method, device and storage medium
CN111062058B (en)*2019-12-262022-04-15深圳天玑数据有限公司Block chain-based key pair processing method and device, terminal and readable storage medium
CN111541733B (en)*2020-03-062022-09-20杜晓楠Method for testing message storage in P2P network, computer readable storage medium and P2P network
CN111445334B (en)*2020-03-302023-09-05北京数字认证股份有限公司Aggregation signature method, device and storage medium of blockchain system
CN112182612A (en)*2020-09-282021-01-05平安科技(深圳)有限公司 A random number generation method, device, terminal device and storage medium
CN113612614B (en)*2021-07-192023-10-27上海浦东发展银行股份有限公司Method, device, equipment and storage medium for consensus disaster recovery based on blockchain network
CN114329566B (en)*2021-12-312025-05-16杭州溪塔科技有限公司 Method and system for generating random numbers on blockchain based on threshold encryption
CN114915410B (en)*2022-03-212025-05-30蚂蚁区块链科技(上海)有限公司 Method and system for multi-party collaborative random number generation
CN115037464A (en)*2022-05-312022-09-09中邮信息科技(北京)有限公司 Random number seed generation method, device, electronic device and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106487801A (en)*2016-11-032017-03-08江苏通付盾科技有限公司Information Authentication method and device based on block chain
CN106504008A (en)*2016-10-242017-03-15中山大学A kind of fair contract signature method based on block chain
CN106533675A (en)*2016-12-192017-03-22北京洋浦伟业科技发展有限公司Digital signature method and system
CN106651331A (en)*2016-12-222017-05-10飞天诚信科技股份有限公司Digital currency-based electronic transaction method and system
CN106790253A (en)*2017-01-252017-05-31中钞信用卡产业发展有限公司北京智能卡技术研究院Authentication method and device based on block chain
CN107294729A (en)*2017-07-252017-10-24中国联合网络通信集团有限公司Communication means and device in block chain between different nodes
CN107395349A (en)*2017-08-162017-11-24深圳国微技术有限公司A kind of block chain network cryptographic key distribution method based on self-certified public key system
US20180152297A1 (en)*2016-11-012018-05-31Netcomm Inc.System and Method For Digitally Signing Documents Using Biometric Data in a Blockchain or PKI
US20180341775A1 (en)*2017-05-232018-11-29International Business Machines CorporationDigital license authentication with secure privacy logging

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
WO2018209542A1 (en)*2017-05-162018-11-22北京大学深圳研究生院Consensus method for decentralized domain name system
CN109617679B (en)*2018-11-292021-10-22哈希未来(北京)科技有限公司Method, system and storage medium for generating, acquiring and providing random numbers
CN109785130B (en)*2018-12-172021-05-28金蝶软件(中国)有限公司Block chain random consensus method and device, computer equipment and storage medium
CN109617699B (en)*2019-01-162024-11-19北京沃东天骏信息技术有限公司 A key generation method, blockchain network service platform and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106504008A (en)*2016-10-242017-03-15中山大学A kind of fair contract signature method based on block chain
US20180152297A1 (en)*2016-11-012018-05-31Netcomm Inc.System and Method For Digitally Signing Documents Using Biometric Data in a Blockchain or PKI
CN106487801A (en)*2016-11-032017-03-08江苏通付盾科技有限公司Information Authentication method and device based on block chain
CN106533675A (en)*2016-12-192017-03-22北京洋浦伟业科技发展有限公司Digital signature method and system
CN106651331A (en)*2016-12-222017-05-10飞天诚信科技股份有限公司Digital currency-based electronic transaction method and system
CN106790253A (en)*2017-01-252017-05-31中钞信用卡产业发展有限公司北京智能卡技术研究院Authentication method and device based on block chain
US20180341775A1 (en)*2017-05-232018-11-29International Business Machines CorporationDigital license authentication with secure privacy logging
CN107294729A (en)*2017-07-252017-10-24中国联合网络通信集团有限公司Communication means and device in block chain between different nodes
CN107395349A (en)*2017-08-162017-11-24深圳国微技术有限公司A kind of block chain network cryptographic key distribution method based on self-certified public key system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112799636A (en)*2021-04-142021-05-14北京百度网讯科技有限公司 Random number generation method, apparatus, device and storage medium
CN114092101A (en)*2022-01-212022-02-25深圳市一航网络信息技术有限公司Transaction verification method and device, storage medium and electronic equipment
CN114092101B (en)*2022-01-212022-04-08深圳市一航网络信息技术有限公司Transaction verification method and device, storage medium and electronic equipment
CN114553505A (en)*2022-02-092022-05-27蚂蚁区块链科技(上海)有限公司Method and device for generating random number by cooperation of multiple parties

Also Published As

Publication numberPublication date
CN110213059B (en)2021-07-06
CN110971413B (en)2021-07-06
CN110213059A (en)2019-09-06

Similar Documents

PublicationPublication DateTitle
CN110971413B (en)Random number generation method, random number generation device and storage medium
JP7189953B2 (en) Computer-implemented system and method for performing computational tasks across a group that does not require management approval or that operates in a dealer-free manner
Wang et al.Certificateless public auditing for data integrity in the cloud
KR20200035280A (en) Computer-implemented method of generating threshold bolts
TW202029044A (en)Block chain transaction generation method and device
KR20200017531A (en) How to create a blockchain transaction and how to verify a blockchain block
Nosouhi et al.UCoin: An efficient privacy preserving scheme for cryptocurrencies
KR20220142254A (en)Multi-signature wallet system in blockchain using the bloom filter
CN112436938A (en)Digital signature generation method and device and server
CN109905229B (en)Anti-quantum computing Elgamal encryption and decryption method and system based on group asymmetric key pool
Zhou et al.Distributed bitcoin account management
Zhang et al.A novel privacy protection of permissioned blockchains with conditionally anonymous ring signature
Zhang et al.Anonymous authentication and information sharing scheme based on blockchain and zero knowledge proof for vanets
CN109687961B (en)Quantum computation resistant blockchain transaction method and system based on symmetric key pool routing device
JP2024541936A (en) Threshold Signature Scheme
CN112527898B (en)Security calculation method, device, computer and storage medium
CN117223252A (en)Nested threshold signatures
Li et al.A regulatable data privacy protection scheme for energy transactions based on consortium blockchain
Wang et al.Verifiable threshold scheme in multi-secret sharing distributions upon extensions of ECC
Ebrahimi et al.Enhancing cold wallet security with native multi-signature schemes in centralized exchanges
Ma et al.Toward data authenticity and integrity for blockchain-based mobile edge computing
CN117201041A (en)Under-chain collaborative threshold signature method and device based on block chain
Huang et al.Hucdo: A hybrid user-centric data outsourcing scheme
ZhouA Certificate‐Based Provable Data Possession Scheme in the Standard Model
HK40021398B (en)Method and device for generating random numbers, and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
REGReference to a national code

Ref country code:HK

Ref legal event code:DE

Ref document number:40021398

Country of ref document:HK

SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp