CN112182612A - Random number generation method and device, terminal equipment and storage medium - Google Patents

Random number generation method and device, terminal equipment and storage medium Download PDF

Info

Publication number
CN112182612A
CN112182612A CN202011038683.1A CN202011038683A CN112182612A CN 112182612 A CN112182612 A CN 112182612A CN 202011038683 A CN202011038683 A CN 202011038683A CN 112182612 A CN112182612 A CN 112182612A
Authority
CN
China
Prior art keywords
random number
public
random
signature
number generation
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.)
Pending
Application number
CN202011038683.1A
Other languages
Chinese (zh)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202011038683.1A priority Critical patent/CN112182612A/en
Publication of CN112182612A publication Critical patent/CN112182612A/en
Priority to PCT/CN2021/091091 priority patent/WO2022062405A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Databases & Information Systems (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computational Mathematics (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The application is applicable to the technical field of block chains, and provides a random number generation method, a device, a terminal device and a storage medium, wherein the method comprises the following steps: receiving a random message submitted by a language predicting machine, wherein the random message is obtained by the language predicting machine by calling a third-party random number generation service; signing the random message according to a preset encryption algorithm to obtain a signature value of a target node; aggregating the signature values of a plurality of nodes in the block chain to obtain an aggregated signature result; verifying the signature result; and if the signature result passes the verification, taking the signature result as a random number. By the method, the efficiency and the reliability of generating the random numbers can be improved.

Description

Random number generation method and device, terminal equipment and storage medium
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a method and an apparatus for generating a random number, a terminal device, and a storage medium.
Background
The random number requirement and application are found everywhere in daily life. Such as license plate shaking, tax spot checks, lottery drawings, etc. Various methods have been invented for generating random numbers. These methods can be roughly classified into two categories, one is the generation of true random numbers represented by the physical phenomena of rolling dice, rotating wheels, using atmospheric noise and the like, and the true random numbers are unpredictable and can not be repeatedly generated; the other is generation of pseudo random numbers represented by program codes. Although as close to the generation of true random numbers as possible, because of the presence of a "seed value", pseudo random numbers are somewhat predictable and are not a true random process.
In block chaining, the generation of random numbers is important. Many blockchain applications, such as games, lotteries, gambling, fair distribution, etc., require the application of random numbers, which are also a fundamental function of blockchains. The authenticity of the random numbers is more demanding for the blockchain as a fundamental function that may affect the assets on the chain.
At present, most of the methods for acquiring true random numbers are to invoke third party random number generation services in the market, such as a program for generating random numbers by using atmospheric noise, a generator for generating random numbers by using quantum theory, and the like. These random number generation methods, although capable of generating true random numbers, are not trusted in a decentralized system such as a blockchain because they are centralized nodes. To solve this problem, blockchains have also proposed a decentralized random number generation service, which guarantees the generation of decentralized random numbers by using a commit-reveal scheme. But such random number generation services cannot be put into use on a large scale due to the complexity of node interaction and the high cost of transaction mortgage. Therefore, there is currently no efficient and reliable random number generation scheme in the blockchain.
Disclosure of Invention
In view of this, embodiments of the present application provide a random number generation method, an apparatus, a terminal device, and a storage medium, so as to solve the problem in the prior art that there is no efficient and reliable random number generation scheme.
A first aspect of an embodiment of the present application provides a random number generation method, which is applied to a block chain, and the method includes:
receiving a random message submitted by a language predicting machine, wherein the random message is obtained by the language predicting machine by calling a third-party random number generation service;
signing the random message according to a preset encryption algorithm to obtain a signature value of a target node;
aggregating the signature values of a plurality of nodes in the block chain to obtain an aggregated signature result;
verifying the signature result;
and if the signature result passes the verification, taking the signature result as a random number.
A second aspect of the embodiments of the present application provides a random number generation apparatus, which is applied to a block chain, and the apparatus includes:
the system comprises a receiving module, a sending module and a sending module, wherein the receiving module is used for receiving a random message submitted by a language predicting machine, and the random message is obtained by the language predicting machine by calling a third-party random number generation service;
the signature module is used for signing the random message according to a preset encryption algorithm to obtain a signature value of a target node;
the aggregation module is used for aggregating the signature values of a plurality of nodes in the block chain to obtain an aggregated signature result;
the verification module is used for verifying the signature result; and if the signature result passes the verification, taking the signature result as a random number.
A third aspect of embodiments of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the terminal device, where the processor implements the steps of the random number generation method provided in the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the steps of the random number generation method provided in the first aspect.
A fifth aspect of embodiments of the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to execute the steps of the random number generation method provided in the first aspect.
The random number generation method, the random number generation device, the terminal equipment and the storage medium provided by the embodiment of the application have the following beneficial effects:
according to the random number generation method provided by the embodiment of the application, the random message generated by calling the third-party random number generation service by using the prediction machine is used as the seed information, the random message can be signed and the signature values of a plurality of nodes are aggregated to obtain a signature result, and if the signature result passes verification, the signature result can be used as the finally generated random number. The third-party random number generation service does not act as a malicious incentive, and the random message generated by the third-party random number generation service is not directly used but only used as seed information in the subsequent encryption process, so that the randomness of the finally generated random number is ensured, and the reliability of the generated 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 embodiments or the prior art descriptions will be briefly described 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 without creative efforts.
Fig. 1 is a flowchart illustrating steps of a random number generation method according to an embodiment of the present disclosure;
FIG. 2 is a flow chart illustrating steps of a method for generating random numbers according to another embodiment of the present application;
fig. 3 is a flowchart of an implementation of a random number generation method according to an embodiment of the present application;
fig. 4 is a block diagram of a random number generation apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The technical solution of the present application will be described below by way of specific examples.
Referring to fig. 1, a flowchart illustrating steps of a random number generation method provided in an embodiment of the present application is shown, which may specifically include the following steps:
s101, receiving a random message submitted by a language predicting machine, wherein the random message is obtained by the language predicting machine by calling a third-party random number generation service.
It should be noted that the method can be applied to a Blockchain (Blockchain). The blockchain referred to in the embodiments of the present application is a novel application mode based on computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. The blockchain is essentially a decentralized database, which is a string of data blocks associated by using cryptography, each data block contains information of a batch of network transactions, and the information is used for verifying the validity (anti-counterfeiting) of the information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
According to different classification methods, the blockchain may include various forms such as a public blockchain, a private blockchain, and a federation blockchain. Illustratively, the method may be implemented in a federation blockchain.
A federation blockchain, also known as an alliance chain (alliance chain), is a type of blockchain used between enterprises. The federation chain is only for members of a particular group and limited third parties, and a plurality of preselected nodes can be designated as billers in the federation chain, and the generation of each block is determined by all of the preselected nodes. Federation chains have advantages in efficiency and flexibility over common blockchains. The main groups of use of the federation chain are banks, insurance, securities, business associations, corporate enterprises and upstream and downstream enterprises thereof, and so on.
In the embodiment of the present application, a node that needs to generate a random number may be referred to as a target node or an originating node, and the target node may be any node in a block chain. For example, the target node is a node in the federation chain described above.
In an embodiment of the present application, the target node may receive a random message submitted by the oracle, where the random message may be obtained by the oracle by invoking a third-party random number generation service.
An oracle machine (oracle machine) is an abstract computer used to study deterministic problems. One speaker may be considered a turing machine connected to one speaker (oracle). The function of the predictive engine is to solve a particular problem within a single operation. The question that the preloader can solve is based on the question being within any class of complexity.
In a specific implementation, the oracle may invoke a third party random number generation service, generate a random message, and submit the random message to the target node. The random message may be used as seed information for an encryption process in a subsequent random number generation process.
S102, signing the random message according to a preset encryption algorithm to obtain a signature value of the target node.
In the embodiment of the application, after receiving the random message submitted by the language-predicting machine, the target node can sign the random message to obtain a corresponding signature value.
In cryptography, a 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 others (e.g., the recipient).
In a specific implementation, the target node may sign the random message in any manner, which is not limited in this embodiment of the present application.
S103, aggregating the signature values of the nodes in the block chain to obtain an aggregated signature result.
Typically, a block chain such as a federation chain includes a plurality of nodes. In order to improve the reliability of the subsequently generated random numbers, each node in the block chain can sign the random message to obtain a signature value corresponding to each node. Then, each node can submit the respective signature value to an intelligent contract which generates a random number in a block chain, and the intelligent contract aggregates the signature values of each node according to an aggregation signature algorithm to obtain an aggregated signature result. The plurality of nodes includes a target node.
And S104, verifying the signature result.
In a specific implementation, the verification of the signature result obtained by aggregation may be performed according to a preset verification manner, which is not limited in this embodiment of the present application.
For example, a verification mode may be preset, and when the signature result is verified in this mode, if the verification result matches a preset expected result of the current verification mode, the verification may be considered to be passed.
And S105, if the signature result passes the verification, taking the signature result as a random number.
In the embodiment of the present application, for a signature result that passes verification, the signature result may be used as a finally generated random number; and discarding the signature result which fails to pass the verification, and generating a new random number again according to the steps.
In the embodiment of the application, the random message generated by calling the third-party random number generation service by using the predicting machine is used as the seed information, the random message can be signed and the signature values of a plurality of nodes are aggregated to obtain a signature result, and if the signature result passes verification, the signature result can be used as the finally generated random number. The third-party random number generation service does not act as a malicious incentive, and the random message generated by the third-party random number generation service is not directly used but only used as seed information in the subsequent encryption process, so that the randomness of the finally generated random number is ensured, and the reliability of the generated random number is improved.
Referring to fig. 2, a flowchart illustrating steps of a random number generation method according to another embodiment of the present application is shown, which may specifically include the following steps:
s201, receiving a random message submitted by a language predicting machine, wherein the random message is obtained by the language predicting machine by calling a third-party random number generation service.
The method may be applied to a block chain, such as a public block chain, a private block chain, and a federation block chain, which is not limited in this embodiment of the present application.
For the convenience of understanding, the present embodiment describes the method by taking an application in a federation blockchain, i.e., a federation chain, as an example.
In this embodiment of the present application, a target node that needs to generate a random number in a federation chain may initiate a random number generation request, where the random number generation request may be used to instruct a talker to invoke a third-party random number generation service to generate a random message M. The target node may receive a random message M submitted by the oracle. The random message M is any random number generated by the third party random number generation service.
Illustratively, the third party random number generation service may be a random number generation service provided by a website that generates random numbers using atmospheric noise, such as random.
In a specific implementation, each node in the federation chain can be intelligently polled by the oracle to determine whether a random number generation request initiated by a node is detected.
If a random number generation request initiated by a certain node exists, the prediction machine can call a third-party random number generation service aiming at the request, generate the random message M of this time and submit the random message M to a corresponding target node.
In this embodiment of the present application, when the talker submits the random message M to the target node, security of message transmission may be ensured through an encryption technology such as a Transport Layer Security (TLS).
S202, obtaining a public and private key pair of a target node, and adopting a target private key in the public and private key pair to sign the random message to obtain a signature value of the target node.
In the embodiment of the application, after receiving the random message M submitted by the talker, the target node may sign the message M according to a preset encryption algorithm to obtain a signature value SiWhere i represents the target node's sequence number in the federation chain. The target node may sign the random message M in any manner, which is not limited in this embodiment of the present application.
Typically, a federation chain includes a plurality of nodes, e.g., N nodes, each node i having its own public-private key pair(s)i,pi) Wherein s isiPrivate key, p, representing node iiRepresenting the public key of node i. Each public or private key may be viewed as a string of 16-ary digits. Public key p of each nodeiBy means of a private key siAnd (6) calculating to obtain. I.e. pi=siG, can be used for pairing the private key s according to a certain ruleiTransforming to obtain the public key p of the corresponding nodei
Therefore, in a possible implementation manner of the embodiment of the present application, the preset encryption algorithm may be a public-private key pair corresponding to the target node. Therefore, when signing the random message according to the preset encryption algorithm, the target node can obtain the public and private key pair(s) of the nodei,pi) And use public and private key pair(s)i,pi) S ofiSigning the random message M to obtain a signature value Si
And S203, aggregating the signature values of the nodes in the block chain to obtain an aggregated signature result.
In the embodiment of the present application, each of the plurality of nodes i in the federation chain may adopt the public and private key pair(s) of the node in the above manneri,pi) S ofiSigning the random message M to obtain signature values S corresponding to a plurality of nodes respectivelyiThen according to the aggregation signature algorithm, signature values S of a plurality of nodesiThe signature result S after the aggregation can be obtained by performing the aggregation.
For example, the aggregated signature result S may be represented as S ═ S1+S2+……+SN
It should be noted that a plurality of nodes in the federation chain may also sign the random message M in other signature manners to obtain the signature value SiThe present embodiment is not limited to this.
S204, public keys in public and private key pairs of a plurality of nodes in the block chain are obtained, and the public keys in the public and private key pairs of the nodes are aggregated to obtain an aggregated public key.
In the embodiment of the application, the signature result S obtained by aggregation may be verified in any verification manner according to actual needs. And when the verification result meets the preset expected result of the current verification mode, the verification is considered to be passed. The embodiment of the present application does not limit how to verify the signature result S.
In a possible implementation manner of the embodiment of the present application, the public keys of a plurality of nodes in a federation chain are aggregated, and the aggregated public key P is used to verify the signature result S.
Thus, in a particular implementation, the target node may be paired with a public-private key(s) of the target nodei,pi) Target public key p in (1)iBroadcasting to a plurality of nodes and receiving public and private key pairs(s) of respective nodes broadcasted by the plurality of nodesi,pi) Of (1)i
In this embodiment of the present application, the target node may perform chain broadcast on the target public key in the public-private key pair of the node according to a preset consensus mechanism, and receive public keys in the public-private key pairs of the respective nodes broadcast and propagated by other nodes through the chain broadcast.
As previously mentioned, each node i in the federation chain has its own public-private key pair(s)i,pi) Before verifying the signature result S, each node i may use the public key p of the node itselfiBroadcast to all other nodes in the federation chain.
Then, the attack of forged keys is prevented, and each node i can calculate the public key p of each node through a hash functioniCorresponding non-linear coefficient ai=hash(pi,{p1,p2,…pN})。
Illustratively, for a target node, the node may compute the target public key p of the nodeiCorresponding non-linear coefficient aiAnd receives the respective public keys p of the plurality of nodesiCorresponding non-linear coefficient ai
Then, the nonlinear coefficient a corresponding to each node iiFor the weighted value, the public key p of each node iiAnd carrying out weighted summation to obtain the aggregation public key P.
That is, the aggregation public key P can be expressed as: p ═ P1+P2+…PN=a1*p1+a1*p1+…+aN*pN
S205, verifying the signature result by adopting the aggregation public key.
And S206, if the signature result passes the verification, taking the signature result as a random number.
After the aggregation public key P is obtained through aggregation, the signature result S may be verified by using the aggregation public key P, and when the verification result satisfies a preset expected result, the verification may be considered to be passed. At this time, the signature result S may be regarded as a random number.
S207, based on a preset hash algorithm, carrying out hash operation on the random number, packaging the random number into a data block, and linking the data block to a preset data chain.
The signature result that passes the verification may be used as the random number generated this time. The random number may be written into the block chain for recall in use.
In a specific implementation, when the random number is written into the block chain, hash operation may be performed on the random number based on a preset hash algorithm, so as to encapsulate the random number into a data block, and the purpose of writing the random number into the block chain is achieved by linking the data block to a preset data chain.
In the embodiment of the present application, the random seed message is generated by using a third-party random number generation service capable of generating true random numbers, which is a centralized random number generation system but generates random numbers that are only used as seeds in subsequent encryption (the result of the random number generation by encryption is also random numbers and is unpredictable) and are not directly used, and the third-party random number generation service has no incentive to do ill at all. Currently, although some items generate random numbers by using a prediction machine, for example, the prediction machine calls a URL to query the internet to generate random number information, such as block numbers, block hashes, and the like. These information are easily manipulated by miners, attacking third party random number generation services, making the finally generated random numbers untrustworthy. The embodiment of the application obtains the true random number seeds by using the true random number generation service, and the true random number seeds are the first level of the guarantee of the randomness of the final result, and the signature for performing decentralization on the random number seeds is the second level of the guarantee of the randomness of the final result.
Secondly, compared with the existing block chain signature algorithm which is used more, each node in the existing algorithm has an independent public and private key pair, each signature needs to be checked and signed during decryption, the speed is low, if random numbers are reused in the existing algorithm, the private keys are leaked, and the submitting-disclosing scheme is not used in a large scale due to the fact that interaction among the nodes is too many, and the random number generating efficiency is low. The embodiment of the application utilizes the linear additivity of the encryption algorithm, uses the aggregated signature, only needs one signature verification process (due to the linearity of the signature, a plurality of verification equations are allowed to be added, and the number of dot products is reduced by verifying all the signatures at one time), greatly improves the efficiency of generating random numbers, can reduce the storage and bandwidth of a block chain when a large number of signatures are aggregated into one signature, and improves the performance of the block chain.
Third, the method and the device can solve the problem of collusion possibility of generating random numbers by cooperation of multiple persons. By utilizing the characteristics of the alliance chain, all alliance members are required to encrypt the random number seed in the process of generating the random number, and the encryption process ensures that the signature of each node is the random number. Because each node cannot predict the signature result of the subsequent group, in a public chain environment, because the nodes participating in the encryption process are random, the last node may refuse to give a final signature for the benefit of the last node, so that the generation of the random number fails, but in the alliance chain environment, each node needs to sign, and the signature fails only when all the nodes forge the signature, so that the reliability of the finally generated random number is ensured.
It should be noted that, the sequence numbers of the steps in the foregoing embodiments do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation on the implementation process of the embodiments of the present application.
For the convenience of understanding, the random number generation method provided by the embodiments of the present application is described below with reference to the drawings as a specific example.
Fig. 3 is a flowchart illustrating an implementation of a random number generation method according to an embodiment of the present application. As shown in fig. 3, each node in the federation chain may initiate a random number generation request when it needs to generate a random number. The prediction machine can intelligently poll each node in real time and confirm whether a random number generation request submitted by the corresponding node is detected.
If the prediction machine detects a random number generation request submitted by a certain node, a third party random number generation service, such as random. The talker may submit the random message M to the target node that originated the request via TLS encryption.
In the embodiment of the application, each node in the federation chain can generate a public and private key pair(s) of the cost nodei,pi). Each node can then use the private key s of the public-private key pair described aboveiAnd signing the random message M to obtain a signature value Si corresponding to each node. By performing aggregation calculation on the signature values corresponding to all nodes, the corresponding signature result S ═ S can be obtained1+S2+……+SNThe signature result S is the random number to be verified subsequently.
To verify the signature result S, each node in the federation chain may have its own public key piBroadcast to all other nodes in the federation chain. And aggregating the public keys of all the nodes to obtain an aggregated public key P.
In a specific implementation, the nonlinear coefficient a corresponding to the public key of each node can be obtained through hash function calculationi=hash(pi,{p1,p2,…pN}) and then aggregating the public keys of all nodes by taking the nonlinear coefficient of each node as a weight value to obtain an aggregated public key P ═ P1+P2+…PN=a1*p1+a1*p1+…+aN*pN
The signature result S can be verified using the aggregated public key P. If the verification is passed, the signature result S may be a random number that is finally generated. For the generated random number, hash operation can be performed on the random number based on a preset hash algorithm, the random number is packaged into a data block, and the purpose of writing the random number into a block chain database is achieved by linking the data block to a preset data chain.
According to the method and the device, the generation process of the random number on the alliance chain based on the pre-speaker and the multiple signatures is based on the generation process of the random number, the external true random number can be obtained through the pre-speaker, and then the centralization influence of the external random number is eliminated through the decentralized multiple signatures. In the embodiment of the application, the random number seed is generated by using the prediction machine, and for the external third-party random number generation service, the final random number cannot be determined because the public and private key pair of the nodes on the chain is unknown, and the external third-party random number generation service is not necessary to be fake; secondly, because the method is applied to the alliance chain, the final signature generation result can be used as a final random number after all nodes are signed and authenticated, and the nodes on the chain can not collude to be fake. Since the possibility of making a fake is only one, that is, all nodes in the chain use a fake private key, which is completely impossible in practical processes. Thirdly, the embodiment of the application utilizes the linear additivity of the multiple signatures, reduces the signature verification process of the signatures and improves the signature efficiency.
Referring to fig. 4, fig. 4 is a block diagram of a random number generating device according to an embodiment of the present disclosure. The device in this embodiment includes modules for performing the steps in the embodiments corresponding to fig. 1 to 3. Please refer to fig. 1 to 3 and fig. 1 to 3 for the corresponding embodiments. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 4, the random number generation apparatus 400 includes: a receiving module 401, a signing module 402, an aggregation module 403, and a verification module 404, wherein:
the system comprises a receiving module, a sending module and a sending module, wherein the receiving module is used for receiving a random message submitted by a language predicting machine, and the random message is obtained by the language predicting machine by calling a third-party random number generation service;
the signature module is used for signing the random message according to a preset encryption algorithm to obtain a signature value of a target node;
the aggregation module is used for aggregating the signature values of a plurality of nodes in the block chain to obtain an aggregated signature result;
the verification module is used for verifying the signature result; and if the signature result passes the verification, taking the signature result as a random number.
In this embodiment, the receiving module may specifically include the following sub-modules:
a generation request initiating submodule, configured to initiate a random number generation request, where the random number generation request is used to instruct the talker to invoke the third-party random number generation service to generate the random message;
and the random message receiving submodule is used for receiving the random message submitted by the language predicting machine.
In this embodiment of the present application, the encryption algorithm includes a public and private key pair corresponding to a target node, and the signature module may specifically include the following sub-modules:
the public and private key pair obtaining submodule is used for obtaining a public and private key pair of a target node;
and the random message signing submodule is used for signing the random message by adopting a target private key in the public and private key pair to obtain a signature value of the target node.
In this embodiment, the verification module may specifically include the following sub-modules:
the aggregation public key generation submodule is used for acquiring public keys in public and private key pairs of a plurality of nodes in the block chain and aggregating the public keys in the public and private key pairs of the plurality of nodes to obtain an aggregation public key;
and the signature result verification submodule is used for verifying the signature result by adopting the aggregation public key.
In this embodiment of the present application, the aggregation public key generation sub-module may specifically include the following units:
the public key broadcasting unit is used for carrying out chain broadcasting on a target public key in the public and private key pair according to a preset consensus mechanism;
a public key receiving unit, configured to receive public keys in public and private key pairs of respective nodes broadcast and spread by the plurality of nodes on the chain;
the nonlinear coefficient calculation unit is used for calculating nonlinear coefficients corresponding to a target public key in a public and private key pair of the target node and receiving the nonlinear coefficients corresponding to the public keys in the public and private key pairs of the nodes;
and the aggregation public key generating unit is used for weighting and summing the public keys of the nodes by taking the nonlinear coefficients corresponding to the nodes as weight values to obtain the aggregation public key.
In this embodiment, the apparatus may further include the following modules:
the packaging module is used for carrying out Hash operation on the random number based on a preset Hash algorithm so as to package the random number into a data block;
and the link module is used for linking the data blocks to a preset data chain.
It should be understood that, in the structural block diagram of the random number generating apparatus shown in fig. 4, each module is used to execute each step in the embodiment corresponding to fig. 1 to fig. 3, and each step in the embodiment corresponding to fig. 1 to fig. 3 has been explained in detail in the above embodiment, and specific reference is made to the relevant description in the embodiment corresponding to fig. 1 to fig. 3 and fig. 1 to fig. 3, which is not repeated herein.
Fig. 5 is a block diagram of a terminal device according to another embodiment of the present application. As shown in fig. 5, the terminal device 500 of this embodiment includes: a processor 501, a memory 502 and a computer program 503, e.g. a program of a random number generation method, stored in said memory 502 and executable on said processor 501. The processor 501, when executing the computer program 503, implements the steps in the embodiments of the random number generation method described above, such as S101 to S105 shown in fig. 1, or S201 to S206 shown in fig. 2. Alternatively, when the processor 501 executes the computer program 503, the functions of the modules in the embodiment corresponding to fig. 4, for example, the functions of the modules 401 to 404 shown in fig. 4, are implemented, for which reference is specifically made to the relevant description in the embodiment corresponding to fig. 4, and details are not repeated here.
Illustratively, the computer program 503 may be partitioned into one or more modules/units that are stored in the memory 502 and executed by the processor 501 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 503 in the terminal device 500. For example, the computer program 503 may be divided into a receiving module, a signing module, an aggregation module, and a verification module, each module having the specific functions as described above.
The terminal device 500 may include, but is not limited to, a processor 501, a memory 502. Those skilled in the art will appreciate that fig. 5 is merely an example of a terminal device 500 and does not constitute a limitation of terminal device 500 and may include more or less components than those shown, or some components in combination, or different components, e.g., the turntable device may also include input output devices, network access devices, buses, etc.
The Processor 501 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 502 may be an internal storage unit of the terminal device 500, such as a hard disk or a memory of the terminal device 500. The memory 502 may also be an external storage device of the terminal device 500, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the terminal device 500. Further, the memory 502 may also include both an internal storage unit and an external storage device of the terminal device 500. The memory 502 is used for storing the computer program and other programs and data required by the turntable device. The memory 502 may also be used to temporarily store data that has been output or is to be output.
Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the embodiments of the random number generation method.
The embodiment of the present application further provides a computer program product, which when running on a terminal device, causes the terminal device to execute the steps in the embodiments of the random number generation method.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A random number generation method, applied to a block chain, the method comprising:
receiving a random message submitted by a language predicting machine, wherein the random message is obtained by the language predicting machine by calling a third-party random number generation service;
signing the random message according to a preset encryption algorithm to obtain a signature value of a target node;
aggregating the signature values of a plurality of nodes in the block chain to obtain an aggregated signature result;
verifying the signature result;
and if the signature result passes the verification, taking the signature result as a random number.
2. The random number generation method of claim 1, wherein receiving the random message submitted by the oracle comprises:
initiating a random number generation request, wherein the random number generation request is used for instructing the talker to invoke the third-party random number generation service to generate the random message;
receiving the random message submitted by the prediction machine.
3. The method of claim 1, wherein the encryption algorithm comprises a public-private key pair corresponding to the target node, and the signing the random message according to the predetermined encryption algorithm to obtain the signature value of the target node comprises:
and acquiring a public and private key pair of the target node, and signing the random message by adopting a target private key in the public and private key pair to acquire a signature value of the target node.
4. The random number generation method of claim 3, wherein said verifying said signature result comprises:
acquiring public keys in public and private key pairs of a plurality of nodes in the block chain, and aggregating the public keys in the public and private key pairs of the plurality of nodes to obtain an aggregated public key;
and verifying the signature result by adopting the aggregation public key.
5. The method of generating random numbers according to claim 4, wherein said obtaining public keys in public-private key pairs of a plurality of nodes in the block chain comprises:
according to a preset consensus mechanism, the target node broadcasts a target public key in the public and private key pair on a chain;
the target node accepts public keys in respective public-private key pairs of nodes broadcast-propagated over the chain by the plurality of nodes.
6. The method of claim 4, wherein aggregating public keys of the public-private key pairs of the plurality of nodes to obtain an aggregated public key comprises:
calculating nonlinear coefficients corresponding to target public keys in a public and private key pair of the target node, and receiving the nonlinear coefficients corresponding to the public keys in the public and private key pairs of the nodes;
and taking the nonlinear coefficient corresponding to each node as a weight value, and carrying out weighted summation on the public key of each node to obtain the aggregation public key.
7. The random number generation method according to any one of claims 1 to 6, wherein after taking the signature result as a random number, the method further comprises:
based on a preset hash algorithm, carrying out hash operation on the random number to package the random number into a data block;
and linking the data block to a preset data chain.
8. An apparatus for random number generation, applied to a block chain, the apparatus comprising:
the system comprises a receiving module, a sending module and a sending module, wherein the receiving module is used for receiving a random message submitted by a language predicting machine, and the random message is obtained by the language predicting machine by calling a third-party random number generation service;
the signature module is used for signing the random message according to a preset encryption algorithm to obtain a signature value of a target node;
the aggregation module is used for aggregating the signature values of a plurality of nodes in the block chain to obtain an aggregated signature result;
the verification module is used for verifying the signature result; and if the signature result passes the verification, taking the signature result as a random number.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202011038683.1A 2020-09-28 2020-09-28 Random number generation method and device, terminal equipment and storage medium Pending CN112182612A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011038683.1A CN112182612A (en) 2020-09-28 2020-09-28 Random number generation method and device, terminal equipment and storage medium
PCT/CN2021/091091 WO2022062405A1 (en) 2020-09-28 2021-04-29 Random number generation method, apparatus, terminal device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011038683.1A CN112182612A (en) 2020-09-28 2020-09-28 Random number generation method and device, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112182612A true CN112182612A (en) 2021-01-05

Family

ID=73945157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011038683.1A Pending CN112182612A (en) 2020-09-28 2020-09-28 Random number generation method and device, terminal equipment and storage medium

Country Status (2)

Country Link
CN (1) CN112182612A (en)
WO (1) WO2022062405A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113935737A (en) * 2021-12-15 2022-01-14 支付宝(杭州)信息技术有限公司 Random number generation method and device based on block chain
WO2022062405A1 (en) * 2020-09-28 2022-03-31 平安科技(深圳)有限公司 Random number generation method, apparatus, terminal device, and storage medium
CN114338699A (en) * 2021-11-18 2022-04-12 山大地纬软件股份有限公司 Block chain communication method and system based on dynamic strategy
CN114338715A (en) * 2021-12-31 2022-04-12 杭州趣链科技有限公司 Data synchronization method, block chain system, terminal device and storage medium
CN114362968A (en) * 2022-03-15 2022-04-15 北京百度网讯科技有限公司 Method, device, equipment and medium for acquiring random number by block chain
WO2023103689A1 (en) * 2021-12-07 2023-06-15 中移(上海)信息通信科技有限公司 Method and device for generating random number in blockchain, blockchain node, storage medium and computer program product
CN116629773A (en) * 2023-04-12 2023-08-22 国网河北省电力有限公司 Aggregation signature method based on internal and external collaborative bill combined signature service

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726541B (en) * 2022-04-08 2023-12-22 平安国际智慧城市科技股份有限公司 Electronic license reading method, device, equipment and storage medium
CN115242402B (en) * 2022-07-12 2023-05-30 长春吉大正元信息技术股份有限公司 Signature method, signature verification method and electronic equipment
CN115170322B (en) * 2022-09-05 2022-12-27 深圳市明源云科技有限公司 Real estate property right transfer method, device, terminal device and computer medium
CN115809482B (en) * 2023-02-01 2023-05-16 上海金仕达软件科技股份有限公司 Data aggregation calculation method, device, medium and equipment based on random number confusion

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109450629A (en) * 2018-12-21 2019-03-08 深圳区块大陆科技有限公司 Based on block chain random-number generating method
CN110213059A (en) * 2019-06-20 2019-09-06 腾讯科技(深圳)有限公司 A kind of generation method of random number, generating means and storage medium
CN111385096A (en) * 2018-12-28 2020-07-07 北京沃东天骏信息技术有限公司 Block chain network, signature processing method, terminal and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111488134B (en) * 2020-04-09 2021-04-27 堡垒科技有限公司 Public random number generation method and device based on block chain
CN112182612A (en) * 2020-09-28 2021-01-05 平安科技(深圳)有限公司 Random number generation method and device, terminal equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109450629A (en) * 2018-12-21 2019-03-08 深圳区块大陆科技有限公司 Based on block chain random-number generating method
CN111385096A (en) * 2018-12-28 2020-07-07 北京沃东天骏信息技术有限公司 Block chain network, signature processing method, terminal and storage medium
CN110213059A (en) * 2019-06-20 2019-09-06 腾讯科技(深圳)有限公司 A kind of generation method of random number, generating means and storage medium

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022062405A1 (en) * 2020-09-28 2022-03-31 平安科技(深圳)有限公司 Random number generation method, apparatus, terminal device, and storage medium
CN114338699A (en) * 2021-11-18 2022-04-12 山大地纬软件股份有限公司 Block chain communication method and system based on dynamic strategy
CN114338699B (en) * 2021-11-18 2024-01-30 山大地纬软件股份有限公司 Block chain communication method and system based on dynamic strategy
WO2023103689A1 (en) * 2021-12-07 2023-06-15 中移(上海)信息通信科技有限公司 Method and device for generating random number in blockchain, blockchain node, storage medium and computer program product
CN113935737A (en) * 2021-12-15 2022-01-14 支付宝(杭州)信息技术有限公司 Random number generation method and device based on block chain
WO2023109520A1 (en) * 2021-12-15 2023-06-22 支付宝(杭州)信息技术有限公司 Random number generation method and apparatus based on blockchain
CN114338715A (en) * 2021-12-31 2022-04-12 杭州趣链科技有限公司 Data synchronization method, block chain system, terminal device and storage medium
CN114362968A (en) * 2022-03-15 2022-04-15 北京百度网讯科技有限公司 Method, device, equipment and medium for acquiring random number by block chain
CN116629773A (en) * 2023-04-12 2023-08-22 国网河北省电力有限公司 Aggregation signature method based on internal and external collaborative bill combined signature service
CN116629773B (en) * 2023-04-12 2024-04-02 国网河北省电力有限公司 Aggregation signature method based on internal and external collaborative bill combined signature service

Also Published As

Publication number Publication date
WO2022062405A1 (en) 2022-03-31

Similar Documents

Publication Publication Date Title
CN112182612A (en) Random number generation method and device, terminal equipment and storage medium
US10803205B1 (en) Retrieving public data for blockchain networks using trusted execution environments
Wei et al. Security and privacy for storage and computation in cloud computing
US20180205558A1 (en) Method and apparatus for the limitation of the mining of blocks on a block chain
CN111566649A (en) Verifying integrity of data stored in a federation blockchain using a public side chain
CN111563261A (en) Privacy protection multi-party computing method and system based on trusted execution environment
CN109951296A (en) A kind of remote data integrity verification method based on short signature
US20040006692A1 (en) Method and system for assuring an original
Emmadi et al. Reinforcing immutability of permissioned blockchains with keyless signatures' infrastructure
CN111950032A (en) Block chain-based data storage method, terminal device and storage medium
CN111815321A (en) Transaction proposal processing method, device, system, storage medium and electronic device
CN112241434A (en) Data privacy protection oriented alliance block chain system
Xiong et al. Anonymous auction protocol based on time-released encryption atop consortium blockchain
CN112734423A (en) Transaction method based on block chain and terminal equipment
US11729231B2 (en) Secure multi-party random bit generation
Rangasamy et al. Revisiting single-server algorithms for outsourcing modular exponentiation
Sun et al. Public data integrity auditing without homomorphic authenticators from indistinguishability obfuscation
CN111385096A (en) Block chain network, signature processing method, terminal and storage medium
CN115409511B (en) Personal information protection system based on block chain
CN115392914B (en) Supply chain financial platform based on block chain and data processing method
CN113259384B (en) Mechanism model call information processing method, server and system based on block chain
CN112422294B (en) Anonymous voting method and device based on ring signature, electronic equipment and storage medium
Le et al. Flexible signatures: Making authentication suitable for real-time environments
CN114826653B (en) Credential verification method, system, device, equipment and storage medium based on blockchain network
CN115599773B (en) Distributed resource transfer method, device and system and computer equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination