Random number generation method and device, equipment, storage medium and program product

By introducing quantum computing nodes into the blockchain and using quantum algorithms to generate quantum random numbers, the problem of poor randomness in the existing technology is solved, and the security of the blockchain is improved.

CN119718253APending Publication Date: 2025-03-28INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411929135.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, random numbers generated based on smart contracts are reproducible under a given seed, resulting in poor randomness and affecting the security of the blockchain.

Method used

Quantum computing nodes are introduced into the blockchain, quantum random numbers are generated through quantum algorithms, and the final random numbers are generated based on the quantum random numbers.

Benefits of technology

Improve the randomness of random numbers, enhance the security of blockchain, and ensure that the generated random numbers are difficult to predict.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718253A_ABST
    Figure CN119718253A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a random number generation method and device, equipment, a storage medium and a program product, and relates to the technical field of quantum. The method is applied to a common computing node of a block chain, and the block chain comprises the common computing node and a quantum computing node. The method comprises the following steps: in response to a random number generation request, determining a target quantum computing node and a target quantum algorithm based on a preset smart contract; based on the smart contract, according to the target quantum algorithm, generating and sending a quantum algorithm calling request to the target quantum computing node; based on the smart contract, receiving a quantum random number sent by the target quantum computing node; wherein the quantum random number is obtained by processing a target quantum calculation node based on a target quantum algorithm indicated by a quantum algorithm calling request; and based on the smart contract, generating a final random number according to the quantum random number. According to the method, the randomness of the random number is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of quantum technology, and in particular to a method, device, equipment, storage medium and program product for generating random numbers. Background Art

[0002] The application of random number generation technology in the financial industry covers multiple fields such as risk management, data security, trading strategies and simulation experiments, and is of great significance for improving the operational efficiency, risk control and business decision-making of financial institutions. For example, in the field of data security, since financial transactions and data transmission have extremely high security requirements, the use of random number generation technology to generate high-quality random numbers for encryption algorithms, digital signatures and security authentication can ensure the confidentiality of payment data, transaction information and personal privacy.

[0003] A smart contract is a self-executing agreement on the blockchain that is used to define, verify, and enforce the rights and obligations between parties. A smart contract usually presets a "random number seed" based on which a random number is generated through a mathematical algorithm.

[0004] However, in the above method, the random numbers are reproducible under a given seed, resulting in poor randomness of the random numbers. Summary of the invention

[0005] The present application provides a random number generation method, apparatus, device, storage medium and program product to solve the technical problem of poor randomness of random numbers.

[0006] In a first aspect, the present application provides a method for generating a random number, the method being applied to an ordinary computing node in a blockchain, the blockchain comprising ordinary computing nodes and quantum computing nodes; comprising:

[0007] In response to a request for generating a random number, a target quantum computing node and a target quantum algorithm are determined based on a preset smart contract;

[0008] Based on the smart contract and according to the target quantum algorithm, generate and send a quantum algorithm call request to the target quantum computing node;

[0009] Based on the smart contract, receiving a quantum random number sent by the target quantum computing node; wherein the quantum random number is obtained by the target quantum computing node based on the target quantum algorithm indicated by the quantum algorithm call request;

[0010] Based on the smart contract, a final random number is generated according to the quantum random number.

[0011] In a second aspect, the present application provides a random number generation device, which is applied to an ordinary computing node in a blockchain, wherein the blockchain includes ordinary computing nodes and quantum computing nodes; including:

[0012] A determination module, configured to determine a target quantum computing node and a target quantum algorithm based on a preset smart contract in response to a request for generating a random number;

[0013] A sending module, configured to generate and send a quantum algorithm call request to the target quantum computing node based on the smart contract and the target quantum algorithm;

[0014] A receiving module, configured to receive a quantum random number sent by the target quantum computing node based on the smart contract; wherein the quantum random number is obtained by the target quantum computing node based on the target quantum algorithm indicated by the quantum algorithm call request;

[0015] A generation module is used to generate a final random number based on the smart contract and the quantum random number.

[0016] In a third aspect, the present application provides an electronic device, comprising a processor, and a memory communicatively connected to the processor;

[0017] The memory stores computer-executable instructions;

[0018] The processor executes the computer-executable instructions stored in the memory to implement the method according to the first aspect.

[0019] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.

[0020] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.

[0021] The random number generation method, device, equipment, storage medium and program product provided by the present application, after receiving the random number generation request, the ordinary computing node of the blockchain can determine the target quantum computing node and the target quantum algorithm based on the preset smart contract, and then send the quantum algorithm call request to the target quantum computing node, so that the target quantum computing node calls the target quantum algorithm to calculate the quantum random number, and receives the quantum random number returned by the target quantum computing node, and obtains the final random number based on the quantum random number. In this way, based on the quantum mechanics principle of the quantum algorithm, it is possible to generate quantum random numbers that are difficult to predict and more random, thereby improving the randomness of the final random number and thus improving the security of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0023] Figure 1 A schematic diagram of an application scenario provided for this application;

[0024] Figure 2 A schematic diagram of a random number generation method provided in this application;

[0025] Figure 3 A schematic diagram of a random number generation method provided in this application;

[0026] Figure 4 A schematic diagram of the structure of a random number generation device provided in this application;

[0027] Figure 5 A schematic diagram of the structure of the electronic device provided in this application.

[0028] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0029] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0030] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0031] In addition, this application involves big data analysis of user information (including but not limited to personal biometrics, identity data, consumption data, asset data, electronic terminal operation data, etc.), and the use of artificial intelligence technology for automated decision-making, and a technical solution for making decisions that have a significant impact on personal rights and interests based on the results of automated decision-making. The application provides users with corresponding operation entrances for them to choose to agree or reject the results of automated decision-making; if the user chooses to reject, the expert decision-making process will be entered.

[0032] It should be noted that the random number generation method, device, equipment, storage medium and program product provided in this application can be used in the field of quantum technology, and can also be used in any field outside the field of quantum technology. The application field of the random number generation method, device, equipment, storage medium and program product in this application is not limited.

[0033] Explanation of the terms involved in this application:

[0034] Malicious nodes: refers to nodes in the blockchain network that do not comply with established rules or protocols and may conduct malicious activities.

[0035] In the related art, the way that the computing nodes of blockchain generate random numbers based on smart contracts is mostly to give a random number seed, and then generate random numbers based on the random number seed and a mathematical algorithm. However, in this method, the random numbers can be reproduced under a given seed. In other words, the generated random numbers are predictable, resulting in poor randomness of the random numbers, which in turn affects the security of the blockchain.

[0036] Quantum algorithms use properties such as quantum entanglement and quantum teleportation to ensure that the generated random numbers are real and unpredictable. In view of this, this application provides a method for generating random numbers, which introduces quantum computing nodes into the blockchain. Quantum random numbers can be generated on the quantum computing nodes according to the quantum algorithm, and then the final random numbers can be obtained based on the quantum random numbers, thereby improving the randomness of the random numbers and thus improving the security of the blockchain.

[0037] Figure 1 A schematic diagram of an application scenario provided by this application. Figure 1As shown, the blockchain includes ordinary computing nodes and quantum computing nodes, which are connected in communication. It should be noted that this application does not limit the number of ordinary computing nodes and quantum computing nodes in the blockchain, and can be set according to actual needs. Figure 1 The example of two ordinary computing nodes and two quantum computing nodes is used for illustration only.

[0038] The above-mentioned ordinary computing nodes represent traditional computing devices that participate in the operation of the blockchain network, which together constitute the distributed architecture of the blockchain. The ordinary computing nodes can be any type of computing devices, such as computers, servers, etc., and this application does not limit them here.

[0039] Exemplarily, a common computing node may have the following functions:

[0040] (1) Verifying transactions: Ordinary computing nodes will strictly review and verify transactions according to the rules and protocols of the blockchain to ensure the legality and authenticity of transactions.

[0041] (2) Data storage: Ordinary computing nodes, as the guardians of blockchain ledgers, are responsible for preserving blockchain historical records.

[0042] (3) Information dissemination: Once a new transaction or block is generated, ordinary computing nodes will quickly disseminate this information in the network to ensure that other ordinary computing nodes can understand and update the status of the blockchain in a timely manner.

[0043] (4) Maintaining network security: By participating in the consensus mechanism, ordinary computing nodes work together to ensure that the blockchain will not be maliciously tampered with or attacked.

[0044] The above-mentioned quantum computing node represents a computing device that uses the principles of quantum mechanics to perform calculations. The quantum computing node can be any type of computing device, such as a computer, a server, etc., and this application does not limit this. In the embodiments provided in this application, the quantum computing node can calculate quantum random numbers based on a quantum algorithm.

[0045] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0046] Figure 2 A schematic diagram of a random number generation method provided in this application, refer to Figure 1 and Figure 2 As shown, the method comprises the following steps:

[0047] S101. The ordinary computing node responds to the random number generation request and determines the target quantum computing node and the target quantum algorithm based on the preset smart contract.

[0048] Exemplarily, the random number generation request indicates that a random number needs to be generated. The generation request can be triggered by a user based on a client or automatically triggered by an application service, which is not limited in this application. The random number generation request can include business data, such as business type or business scenario, etc.; it can also include specific requirements for random number type, length, and security level.

[0049] The target quantum computing node refers to the quantum computing node used for quantum computing in the random number generation. The target quantum computing node may include one or more quantum computing nodes, and the present application does not limit the number of quantum computing nodes included in the target quantum computing node. The target quantum algorithm refers to the quantum algorithm used for quantum computing in the random number generation.

[0050] The above-mentioned smart contract can indicate the selection criteria or rules of the target quantum computing node and the target quantum algorithm in the random number generation process. For example, the selection criteria or rules of the target quantum computing node can be based on the performance, load balancing, availability, historical performance and other attributes of the quantum computing node, and the target quantum computing node can be determined from the available quantum computing nodes. The selection criteria or rules of the target quantum algorithm can be based on the type, length, security level and other requirements of the random number, and the target quantum algorithm can be determined from multiple preset quantum algorithms.

[0051] In one example, ordinary computing nodes in the blockchain can monitor random number generation requests, read the preset smart contract content, and then determine the target quantum computing node and target quantum algorithm based on the smart contract. For example, ordinary computing nodes can randomly determine one or more quantum computing nodes as target quantum computing nodes based on smart contracts, or they can determine the target quantum computing nodes based on the performance, load balancing, and availability of each quantum computing node based on smart contracts.

[0052] In one example, a common computing node can randomly determine one or more quantum algorithms as target quantum algorithms based on a smart contract. Alternatively, based on a smart contract, the target quantum algorithm can be determined according to the type, length, security level, and other requirements of the random number indicated in the random number generation request. Alternatively, the correspondence between quantum computing nodes and quantum algorithms is preset, and after the target quantum computing node is determined, the target quantum algorithm can be determined according to the correspondence between the quantum computing node and the quantum algorithm.

[0053] S102. The ordinary computing node generates and sends a quantum algorithm call request to the target quantum computing node based on the smart contract and the target quantum algorithm.

[0054] Exemplarily, the quantum algorithm call request indicates calling a quantum algorithm for calculation, and the quantum algorithm call request may indicate the target quantum algorithm to be called.

[0055] In one example, a common computing node can generate parameters of a call request based on the smart contract and the algorithm information of the target quantum algorithm, and encapsulate the parameters of the call request into a standard message format to obtain the quantum algorithm call request and send it to the target quantum computing node. The algorithm information can include, for example, an algorithm ID or an algorithm name, algorithm input parameters, etc.

[0056] S103. The ordinary computing node receives the quantum random number sent by the target quantum computing node based on the smart contract.

[0057] Exemplarily, the quantum random number is obtained by the target quantum computing node based on the target quantum algorithm indicated by the quantum algorithm call request.

[0058] In one example, the target quantum computing node can call the algorithm information of the target quantum algorithm indicated by the quantum algorithm call request according to the received quantum algorithm call request, and calculate the quantum random number. For example, the target quantum computing node can use a quantum algorithm that characterizes the principles of quantum mechanics (such as quantum superposition, quantum entanglement, and quantum interference) to generate quantum random numbers. Furthermore, the target quantum computing node can generate a response message based on the quantum random number and return it to the ordinary computing node. The ordinary computing node receives the response information based on the smart contract and parses it to obtain the quantum random number. It should be noted that this application does not limit the type of quantum algorithm.

[0059] Optionally, the ordinary computing node can perform integrity verification on the received response message to ensure that the response message comes from the target quantum computing node and has not been tampered with.

[0060] Optionally, ordinary computing nodes can verify the type, length and other attributes of the quantum random number based on the smart contract to ensure that the generated quantum random number complies with the rules of the smart contract.

[0061] S104. Ordinary computing nodes generate final random numbers based on smart contracts and quantum random numbers.

[0062] Exemplarily, ordinary computing nodes can process quantum random numbers based on preset rules in smart contracts to obtain final random numbers. The processing can be, for example, encryption processing, hash processing, etc.

[0063] In one example, based on the smart contract, the ordinary computing node can directly use the quantum random number as the final random number; or the quantum random number can be hashed to obtain a hash value, and the hash value can be used as the final random number; or the ordinary computing node can obtain at least two quantum random numbers, splice the quantum random numbers to obtain a spliced ​​sequence, and use the hash value of the spliced ​​sequence as the final random number; or the quantum random number can be input into a preset random number enhancement algorithm to output the final random number. It should be noted that this application does not limit the type of hash algorithm used for hash processing.

[0064] In the random number generation method provided in this embodiment, after receiving a random number generation request, the ordinary computing node of the blockchain can determine the target quantum computing node and the target quantum algorithm based on a preset smart contract, and then send a quantum algorithm call request to the target quantum computing node, so that the target quantum computing node calls the target quantum algorithm to calculate a quantum random number, and receives the quantum random number returned by the target quantum computing node, and obtains the final random number based on the quantum random number. In this way, based on the quantum mechanics principle of the quantum algorithm, a quantum random number that is difficult to predict and has higher randomness can be generated, thereby improving the randomness of the final random number and thus improving the security of the blockchain.

[0065] Figure 3 A schematic diagram of a random number generation method provided in this application. Figure 2 Based on the embodiment shown, a method for generating a random number provided by the present application is described in detail. The method comprises the following steps:

[0066] S201. The ordinary computing node responds to the request for generating a random number. After verifying the generation request, the ordinary computing node determines the number of quantum computing nodes required for the generation request based on the smart contract.

[0067] Exemplarily, the ordinary computing node of the blockchain can respond to the random number generation request and verify the generation request. For example, the format of the generation request, the signature information of the generation request, the user information of the initiator of the generation request, or the authority of the initiator, etc. can be verified. This application does not limit how to verify. After the generation request is verified, the ordinary computing node can determine the number of quantum computing nodes required for the generation request based on the selection rules of the quantum computing nodes in the preset smart contract. For example, the number of quantum computing nodes required for the generation request can be determined based on parameters such as the business type, business scenario, type of random number, and length of random number indicated by the generation request.

[0068] In some possible implementations, the number of quantum computing nodes required for the generation request may be carried in the generation request. In other words, the generation request carries the number of quantum computing nodes. For example, a user may input the number of quantum computing nodes on a client, and then obtain a random number generation request based on the number of quantum computing nodes.

[0069] In some possible implementations, based on the smart contract, the complexity of the algorithm required for the business data is determined according to the business data indicated by the generation request; based on the smart contract, the number of quantum computing nodes is determined according to the complexity.

[0070] Exemplarily, the algorithm required for the above-mentioned business data may be, for example, a transaction algorithm, an optimization algorithm, etc., and the present application does not limit the algorithm required for the business data. The above-mentioned complexity indicates the complexity of the algorithm required for the business data. For example, an ordinary computing node can predict the complexity of the algorithm required for the business data based on the prediction algorithm preset in the smart contract, according to the business data indicated by the generation request, such as the identification of the business type or the identification of the business scenario. The corresponding relationship between the complexity and the number of quantum computing nodes may be preset in the smart contract, and then the number of quantum computing nodes may be determined based on the complexity. In this way, the number of quantum computing nodes that meet the business needs can be determined according to the business data indicated by the generation request, so as to ensure that the subsequently generated quantum random numbers meet the business needs.

[0071] Through this step, ordinary computing nodes can ensure the reliability of the generation request based on the verification processing of the random number generation request, and can determine the number of quantum computing nodes that meet the generation request based on the generation request, so that the subsequently determined quantum random number can better meet business needs.

[0072] S202. The ordinary computing node determines the target quantum computing node based on the smart contract and the number of quantum computing nodes required to generate the request.

[0073] Exemplarily, the common computing node can query the state and performance of each quantum computing node, and then determine the available quantum computing nodes based on the state of the quantum computing nodes, and then determine the target quantum computing node according to the performance of the available quantum computing nodes and the number of quantum computing nodes described in the production request. For example, a quantum computing node with high CPU utilization can be selected from the available quantum computing nodes as the target quantum computing node.

[0074] S203. The ordinary computing node determines the target quantum algorithm based on the smart contract and the business data indicated by the generation request.

[0075] For example, the degree of confidentiality or security required for different business types or different business scenarios is different. The degree of randomness of the quantum random numbers generated by each quantum algorithm can be preset. The higher the degree of randomness, the higher the corresponding degree of confidentiality or security. Based on the smart contract, the target quantum algorithm that meets the requirements can be determined according to the degree of confidentiality or security corresponding to the business data indicated by the generation request.

[0076] In this way, ordinary computing nodes can determine the target quantum algorithm that meets the business requirements based on the business data indicated by the generation request, so that the quantum random numbers determined subsequently can better meet the business requirements.

[0077] S204. The ordinary computing node generates a quantum algorithm call request based on the smart contract and the target quantum algorithm.

[0078] It should be noted that this step is similar to the aforementioned step S102 and will not be repeated here.

[0079] S205. The ordinary computing node sends a quantum algorithm call request to the target quantum computing node.

[0080] Correspondingly, the target quantum computing node receives the quantum algorithm call request.

[0081] S206. The target quantum computing node generates a quantum random number in response to the quantum algorithm call request according to the target quantum algorithm indicated by the quantum algorithm call request.

[0082] It should be noted that this step is similar to the aforementioned step S103 and will not be repeated here.

[0083] S207. The target quantum computing node returns a quantum random number to the common computing node.

[0084] Correspondingly, the ordinary computing node receives the quantum random number sent by the target quantum computing node.

[0085] It should be noted that this step is similar to the aforementioned step S103 and will not be repeated here.

[0086] S208. Ordinary computing nodes determine hash values ​​based on smart contracts and quantum random numbers.

[0087] In some possible implementations, ordinary computing nodes hash quantum random numbers based on smart contracts to obtain hash values.

[0088] In some possible implementations, ordinary computing nodes splice quantum random numbers based on smart contracts to obtain a spliced ​​sequence; then hash the spliced ​​sequence to obtain a hash value. For example, splicing can be performed in a random order, or it can be based on the ID order of the quantum computing nodes to splice each quantum random number to obtain a spliced ​​sequence. In this way, multiple quantum random numbers are combined and connected into a long string of data sequences, which can further increase the complexity and unpredictability of the data, and through further hashing, the complexity and unpredictability of the random numbers are further improved, so that the generated random numbers have higher randomness.

[0089] S209. The common computing node generates a final random number based on the hash value.

[0090] For example, an ordinary computing node may use the hash value as the final random number, or may add a random value based on the hash value as the final random number.

[0091] In the above steps, the final random number generated can be obtained based on the quantum random number generated by multiple quantum computing nodes. Therefore, even if there are malicious nodes in the quantum computing nodes, it will not have an absolute impact on the final random number, thereby ensuring the randomness of the final random number.

[0092] Optionally, the common computing node can obtain the node information of the target quantum computing node; determine whether there is a malicious node in the target quantum computing node according to the node information of the target quantum computing node; if so, prohibit the malicious node from being the target quantum computing node. In this way, the common computing node can manage the quantum computing node, prohibit the malicious node from becoming a new target quantum node, and ensure the reliability of generating quantum random numbers.

[0093] Exemplarily, the above-mentioned node information may include, for example, the node's network behavior, transaction behavior, performance, status, operation log, error report, etc.

[0094] In some possible implementations, the common computing nodes may determine whether the target quantum computing node has an abnormality based on a preset consensus algorithm and the node information of the target quantum computing node; if so, the target quantum computing node is determined to be a malicious node. For example, the common computing nodes may perform voting or aggregation based on the node information of the target quantum computing node to determine whether the target quantum computing node has an abnormality based on a preset consensus algorithm. If the common computing nodes agree that the target quantum computing node has an abnormality, the target quantum computing node is determined to be a malicious node.

[0095] It should be noted that this application does not limit the type of consensus algorithm.

[0096] In this way, based on the consensus algorithm, multiple ordinary computing nodes can jointly verify the status of the target quantum computing node and identify malicious nodes, reducing the possibility of misjudgment of a single node. In addition, the consensus algorithm allows the blockchain to flexibly add or remove nodes without affecting the stability and security of the entire system. Therefore, quantum computing nodes can be expanded or deleted as needed, improving the flexibility and scalability of node management.

[0097] In some possible implementations, the reputation of the target quantum computing node is determined based on the node information of the target quantum computing node; if it is determined that the reputation of the target quantum computing node is less than or equal to a preset threshold, the target quantum computing node is determined to be a malicious node. For example, each ordinary computing node can evaluate the reputation of the target quantum computing node based on the node information of the target quantum computing node, and average or weighted average the reputation corresponding to each ordinary computing node to obtain the reputation of the target quantum computing node. If it is determined that the reputation of the target quantum computing node is less than or equal to the preset threshold, the target quantum computing node is determined to be a malicious node.

[0098] In this way, ordinary computing nodes can identify and isolate malicious nodes based on the credibility of quantum computing nodes, thereby enhancing the robustness of the blockchain.

[0099] In the random number generation method provided in this embodiment, after receiving the random number generation request, the ordinary computing node of the blockchain can determine the number of quantum computing nodes required for the generation request based on the preset smart contract, and then determine the target quantum computing node based on the number of quantum computing nodes; and determine the target quantum algorithm based on the business data indicated by the generation request, and then send the quantum algorithm call request to the target quantum computing node, so that the target quantum computing node calls the target quantum algorithm to calculate the quantum random number, and receives the quantum random number returned by the target quantum computing node, determines the hash value based on the quantum random number, and obtains the final random number based on the hash value. In this way, the ordinary computing node can determine the target quantum computing node and the target quantum algorithm that meet the business data requirements indicated by the generation request according to the random number generation request, and can generate quantum random numbers that are difficult to predict and more random based on the quantum mechanics principle of the quantum algorithm. At the same time, the quantum random number is hashed, and the final random number is obtained based on the hash value after hashing, which further improves the randomness, complexity and unpredictability of the final random number, thereby improving the security of the blockchain.

[0100] Figure 4 A schematic diagram of the structure of a random number generation device provided in this application, such as Figure 4 As shown, the device 300 includes:

[0101] A determination module 301 is used to determine a target quantum computing node and a target quantum algorithm based on a preset smart contract in response to a request for generating a random number;

[0102] A sending module 302 is used to generate and send a quantum algorithm call request to the target quantum computing node based on the smart contract and the target quantum algorithm;

[0103] A receiving module 303 is used to receive a quantum random number sent by the target quantum computing node based on the smart contract; wherein the quantum random number is obtained by the target quantum computing node based on the target quantum algorithm indicated by the quantum algorithm call request;

[0104] The generation module 304 is used to generate a final random number based on the smart contract and the quantum random number.

[0105] In some possible implementations, the determination module 301 is specifically configured to:

[0106] In response to a request for generating a random number, after verifying the generation request, determining the number of quantum computing nodes required for the generation request based on the smart contract;

[0107] Based on the smart contract, the target quantum computing node is determined according to the number of quantum computing nodes required for the generation request.

[0108] In some possible implementations, the determination module 301 is specifically configured to:

[0109] Based on the smart contract, and according to the business data indicated by the generation request, determining the complexity of the algorithm required for the business data;

[0110] Based on the smart contract and according to the complexity, the number of quantum computing nodes is determined.

[0111] In some possible implementations, the determination module 301 is specifically configured to:

[0112] Based on the smart contract, the target quantum algorithm is determined according to the business data indicated by the generation request.

[0113] In some possible implementations, the generating module 304 is specifically configured to:

[0114] Based on the smart contract, determining a hash value according to the quantum random number;

[0115] The final random number is generated according to the hash value.

[0116] In some possible implementations, the generating module 304 is specifically configured to:

[0117] Based on the smart contract, splicing the quantum random numbers to obtain a splicing sequence;

[0118] Perform hash processing on the spliced ​​sequence to obtain the hash value.

[0119] In some possible implementations, the device further includes a processing module, configured to:

[0120] Obtaining node information of the target quantum computing node;

[0121] Determining whether there is a malicious node in the target quantum computing node according to the node information of the target quantum computing node;

[0122] If so, the malicious node is prohibited from being used as a target quantum computing node.

[0123] In some possible implementations, the processing module is specifically configured to:

[0124] Based on a preset consensus algorithm, and according to the node information of the target quantum computing node, determining whether the target quantum computing node has an abnormality;

[0125] If so, it is determined that the target quantum computing node is the malicious node.

[0126] In some possible implementations, the processing module is specifically configured to:

[0127] Determining the credibility of the target quantum computing node according to the node information of the target quantum computing node;

[0128] If it is determined that the credibility of the target quantum computing node is less than or equal to a preset threshold, the target quantum computing node is determined to be the malicious node.

[0129] The random number generation device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.

[0130] Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application. Figure 5 As shown, the electronic device 400 provided in this embodiment includes: at least one processor 401 and a memory 402. Optionally, the device 400 also includes a communication component 403. The processor 401, the memory 402 and the communication component 403 are connected via a bus 404. The electronic device can be the aforementioned ordinary computing node or quantum computing node.

[0131] In a specific implementation process, at least one processor 401 executes the computer-executable instructions stored in the memory 402, so that at least one processor 401 executes the above method.

[0132] The specific implementation process of the processor 401 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0133] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0134] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0135] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0136] The present application also provides a blockchain, including multiple ordinary computing nodes and quantum computing nodes, and the ordinary computing nodes can implement the above method.

[0137] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0138] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0139] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0140] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0141] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0142] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0143] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0144] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0145] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.

[0146] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0147] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0148] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0149] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for generating a random number, characterized in that: The method is applied to ordinary computing nodes in a blockchain, wherein the blockchain includes ordinary computing nodes and quantum computing nodes; the method includes: In response to a request for generating a random number, a target quantum computing node and a target quantum algorithm are determined based on a preset smart contract; Based on the smart contract and according to the target quantum algorithm, generate and send a quantum algorithm call request to the target quantum computing node; Based on the smart contract, receiving a quantum random number sent by the target quantum computing node; wherein the quantum random number is obtained by the target quantum computing node based on the target quantum algorithm indicated by the quantum algorithm call request; Based on the smart contract, a final random number is generated according to the quantum random number.

2. The method according to claim 1, characterized in that The step of determining a target quantum computing node in response to a random number generation request based on a preset smart contract includes: In response to a request for generating a random number, after verifying the generation request, determining the number of quantum computing nodes required for the generation request based on the smart contract; Based on the smart contract, the target quantum computing node is determined according to the number of quantum computing nodes required for the generation request.

3. The method according to claim 2, characterized in that The determining, based on the smart contract, the number of quantum computing nodes required for the generation request comprises: Based on the smart contract, and according to the business data indicated by the generation request, determining the complexity of the algorithm required for the business data; Based on the smart contract and according to the complexity, the number of quantum computing nodes is determined.

4. The method according to claim 1, characterized in that: Determining a target quantum algorithm based on the smart contract includes: Based on the smart contract, the target quantum algorithm is determined according to the business data indicated by the generation request.

5. The method according to claim 1, characterized in that The generating a final random number based on the smart contract and according to the quantum random number includes: Based on the smart contract, determining a hash value according to the quantum random number; The final random number is generated according to the hash value.

6. The method according to claim 5, characterized in that The step of determining a hash value based on the smart contract and according to the quantum random number includes: Based on the smart contract, splicing the quantum random numbers to obtain a splicing sequence; Perform hash processing on the spliced ​​sequence to obtain the hash value.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Obtaining node information of the target quantum computing node; Determining whether there is a malicious node in the target quantum computing node according to the node information of the target quantum computing node; If so, the malicious node is prohibited from being used as a target quantum computing node.

8. The method according to claim 7, characterized in that The determining, according to the node information of the target quantum computing node, whether there is a malicious node in the target quantum computing node includes: Based on a preset consensus algorithm, and according to the node information of the target quantum computing node, determining whether the target quantum computing node has an abnormality; If so, it is determined that the target quantum computing node is the malicious node.

9. The method according to claim 7, characterized in that: The determining, according to the node information of the target quantum computing node, whether there is a malicious node in the target quantum computing node includes: Determining the credibility of the target quantum computing node according to the node information of the target quantum computing node; If it is determined that the credibility of the target quantum computing node is less than or equal to a preset threshold, the target quantum computing node is determined to be the malicious node.

10. A random number generating device, characterized in that: The device is applied to a common computing node in a blockchain, and the blockchain includes a common computing node and a quantum computing node; the device includes: A determination module, configured to determine a target quantum computing node and a target quantum algorithm based on a preset smart contract in response to a request for generating a random number; A sending module, configured to generate and send a quantum algorithm call request to the target quantum computing node based on the smart contract and the target quantum algorithm; A receiving module, configured to receive a quantum random number sent by the target quantum computing node based on the smart contract; wherein the quantum random number is obtained by the target quantum computing node based on the target quantum algorithm indicated by the quantum algorithm call request; A generation module is used to generate a final random number based on the smart contract and the quantum random number.

11. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 9 when executed by a processor.

13. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.