Blockchain-based random number generation method, device, equipment, medium and product
Patent Information
- Application Number
- CN202210402186.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2026-08-18
- Estimated Expiration
- 2042-04-15
AI Technical Summary
[0002]相关技术中区块链的随机数的生成方案包括链上生成方案,即依赖区块链实现随机性的智能合约,以当前最新区块hash(哈希)作为种子生成随机数,但由于过度依赖区块hash,区块链节点可能会有选择性地发布对他们有利的区块,导致生成的随机数的安全性低
[0024]According to one aspect of the embodiments of this application, a computer program product is provided, including a computer program stored in a computer-readable storage medium, wherein a processor of an electronic device reads from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the blockchain-based random number generation method as described above.
Smart Images

Figure CN116961913B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer and communication technology, and more specifically, to a blockchain-based random number generation method, a blockchain-based random number generation device, a blockchain-based random number verification device, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] Among the related technologies, blockchain random number generation schemes include on-chain generation schemes, which rely on smart contracts that implement randomness through the blockchain and use the latest block hash as a seed to generate random numbers. However, due to over-reliance on block hashes, blockchain nodes may selectively publish blocks that are advantageous to them, resulting in low security of the generated random numbers. Summary of the Invention
[0003] To address the aforementioned technical problems, embodiments of this application provide a blockchain-based random number generation method, a blockchain-based random number generation device, a blockchain-based random number verification device, an electronic device, a computer-readable storage medium, and a computer program product, ensuring the security of the random number generation process.
[0004] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0005] According to one aspect of the embodiments of this application, a blockchain-based random number generation method is provided, comprising: detecting a random number generation event triggered by a business party; determining a second execution node for providing a seed source based on the random number generation event; obtaining a random seed from the determined second execution node, and generating a random number based on the obtained random seed to obtain a random number generation result; generating a verification request for the random number generation result based on the random number generation result, and sending the verification request to a verification node so that the verification node verifies the random number generation result contained in the verification request; receiving a signature triggered by the verification node when the verification of the random number generation result is successful; generating on-chain evidence based on the signature of the verification node and the random number generation result, and sending the on-chain evidence to a blockchain network so as to send the on-chain evidence to the business party through the blockchain network.
[0006] According to one aspect of the embodiments of this application, a blockchain-based random number generation method is also provided, comprising: receiving a verification request from an execution node; the verification request carrying a random number generation result obtained by the execution node based on a generated random number, wherein the random number is generated by the execution node after detecting a random number generation event triggered by a business party, determining a second execution node to provide a seed source based on the random number generation event, obtaining a random seed from the determined second execution node, and generating the random number based on the obtained random seed; verifying the random number generation result contained in the verification request; if the verification of the random number generation result is successful, signing the random number generation result; sending the signature to the execution node, so that the execution node generates on-chain evidence based on the signature and the random number generation result, and sends the on-chain evidence to the business party through a blockchain network.
[0007] According to one aspect of the embodiments of this application, a random number generation apparatus is provided. The apparatus includes: a detection and determination module, configured to detect a random number generation event triggered by a business party, and determine a second execution node for providing a seed source based on the random number generation event; a result generation module, configured to obtain a random seed from the determined second execution node, and generate a random number based on the obtained random seed to obtain a random number generation result; a generation and sending module, configured to generate a verification request for the random number generation result based on the random number generation result, and send the verification request to a verification node so that the verification node verifies the random number generation result contained in the verification request; a first receiving module, configured to receive a signature triggered by the verification node when the verification of the random number generation result is successful; the generation and sending module is further configured to: generate on-chain evidence based on the signature of the verification node and the random number generation result, and send the on-chain evidence to a blockchain network so that the on-chain evidence is sent to the business party through the blockchain network.
[0008] In one embodiment of this application, the random number generation event includes a node identifier of a first execution node for generating random numbers and a node identifier of at least one second execution node; the detection and determination module includes a determination unit, which is used to determine a corresponding second execution node based on the node identifier of the at least one second execution node if the local node identifier matches the node identifier of the first execution node in the random number generation event; the result generation module is specifically used to generate the random number generation result based on the random number, the local node identifier, and the node identifier of the at least one second execution node.
[0009] In one embodiment of this application, the random number generation event includes a list of verification nodes, which includes at least two specified verification node identifiers; the generation and sending module includes a sending unit, which is used to send the verification request to a verification node in the verification node cluster that matches the at least two specified verification node identifiers.
[0010] In one embodiment of this application, the random number generation event includes a number of verification nodes, wherein the number of verification nodes is at least two; the generation and sending module includes a sending unit, which is used to select a verification node from the verification node cluster that matches the number of verification nodes, and send the verification request to the selected verification node.
[0011] In one embodiment of this application, the random number generation event includes a number of verification nodes, wherein the number of verification nodes is at least two; the generation and sending module includes a sending unit, which is used to send the number of verification nodes and the verification request to a node allocator, so that the node allocator selects a verification node from the verification node cluster that matches the number of verification nodes, and forwards the verification request to the selected verification node.
[0012] In one embodiment of this application, the generation and sending module includes a generation unit, which is used to encapsulate the signature of the verification node and the random number generation result if the number of received signatures exceeds a preset number threshold, and then sign the encapsulated data to obtain the on-chain evidence.
[0013] In one embodiment of this application, the apparatus further includes a first deployment module, which is configured to receive a generation service deployment request sent by the service provider. The generation service deployment request carries a seed source service identifier, a random number generation service identifier, a list of execution node identifiers to be deployed corresponding to the seed source service identifier, and a list of execution node identifiers to be deployed corresponding to the random number generation service identifier. If the list of execution node identifiers to be deployed corresponding to the seed source service identifier contains a local node identifier, then the seed source service corresponding to the seed source service identifier is deployed. The seed source service is used to provide a random seed. If the list of execution node identifiers to be deployed corresponding to the random number generation service identifier contains a local node identifier, then the random number generation service corresponding to the random number generation service identifier is deployed. The random number generation service is used to generate random numbers based on the random seed.
[0014] In one embodiment of this application, the apparatus further includes a first staking module, which is used by the first deployment module to stake virtual resources with a virtual resource processor when deploying at least one of the seed source service and the random number generation service, so that the virtual resource processor sends the staked virtual resources to the blockchain network for storage; if it is necessary to cancel at least one of the deployed random number generation service and the deployed seed source service, the module applies to the virtual resource processor for the return of the staked virtual resources, so that other execution nodes can challenge the execution process of the at least one service locally; if other execution nodes fail to challenge successfully during the challenge period, the module receives the virtual resources returned by the virtual resource processor through the blockchain network.
[0015] In one embodiment of this application, the generation and sending module includes a sending unit, which is used to deploy an evidence contract in the blockchain network if no deployed evidence contract is found in the blockchain network; and to send the on-chain evidence to the evidence contract in the blockchain network if a deployed evidence contract is stored in the blockchain network, so that the evidence contract stores the on-chain evidence, and sends the on-chain evidence to the business party according to the callback information of the business party.
[0016] In one embodiment of this application, the generation and sending module includes a generation unit, which is used to sign the random number generation result and encapsulate the signature and the random number generation result to generate the verification request.
[0017] According to one aspect of the embodiments of this application, a random number verification device is provided, the device comprising: a second receiving module, configured to receive a verification request from an execution node; the verification request carrying a random number generation result obtained by the execution node based on a generated random number, wherein the random number is generated by the execution node after detecting a random number generation event triggered by a business party, determining a second execution node to provide a seed source based on the random number generation event, obtaining a random seed from the determined second execution node, and generating the random number based on the obtained random seed; a verification module, configured to verify the random number generation result contained in the verification request; a signature module, configured to sign the random number generation result if the verification of the random number generation result is successful; and a sending module, configured to send the signature to the execution node, so that the execution node generates on-chain evidence based on the signature and the random number generation result, and sends the on-chain evidence to the business party through a blockchain network.
[0018] In one embodiment of this application, the second receiving module is specifically used to receive a verification request sent by the execution node; or to receive a verification request forwarded by the node allocator from the execution node, wherein the verification request is forwarded by the node allocator after selecting the corresponding verification node according to the verification request after receiving the verification request sent by the execution node.
[0019] In one embodiment of this application, the apparatus further includes a second deployment module, which is configured to receive a verification service deployment request sent by a service provider. The verification service deployment request carries a random number verification service identifier and a list of verification node identifiers to be deployed. If the list of verification node identifiers to be deployed includes a local node identifier, then a random number verification service corresponding to the random number verification service identifier is deployed. The random number verification service is used to verify the random number generation result contained in the verification request.
[0020] In one embodiment of this application, the apparatus further includes a second staking module. The second staking module is used by the second deployment module to stake virtual resources with the virtual resource processor when deploying the random number verification service corresponding to the random number verification service identifier, so that the virtual resource processor sends the staked virtual resources to the blockchain network for storage. If it is necessary to cancel the deployed random number verification service, the module applies to the virtual resource processor for the return of the staked virtual resources, so that other verification nodes can challenge the execution process of the local data verification service. If the verification execution node fails to challenge successfully during the challenge period, the module receives the virtual resources returned by the virtual resource processor through the blockchain network.
[0021] In one embodiment of this application, the verification module is specifically used to obtain a verification random number based on the verification request, and to verify the random number generation result contained in the verification request based on the verification random number.
[0022] According to one aspect of the embodiments of this application, an electronic device is provided, including one or more processors; and a storage device for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to implement the blockchain-based random number generation method as described above.
[0023] According to one aspect of the embodiments of this application, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor of an electronic device, causes the electronic device to perform the blockchain-based random number generation method as described above.
[0024] According to one aspect of the embodiments of this application, a computer program product is provided, including a computer program stored in a computer-readable storage medium, wherein a processor of an electronic device reads from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the blockchain-based random number generation method as described above.
[0025] In the technical solution provided in the embodiments of this application, the execution node determines a second execution node to provide the seed source through a random number generation event triggered by the business party, obtains a random seed from the determined second execution node, generates a random number based on the obtained random seed, obtains the random number generation result, and then generates a verification request; the verification node verifies the random number generation result through the verification request, and then the execution node generates on-chain evidence based on the signature triggered when the verification node passes the verification and the random number generation result, thereby sending the on-chain evidence to the business party through the blockchain network; in this way, random numbers are generated off-chain by the execution node, verified by the verification node, and then the verified data is uploaded to the blockchain, avoiding the excessive reliance on block hashes in on-chain random number generation schemes in related technologies, and ensuring the security of the random number generation process.
[0026] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0027] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:
[0028] Figure 1 This is a schematic diagram of the blockchain network structure;
[0029] Figure 2 This is a diagram illustrating the connection relationships between blocks in a blockchain.
[0030] Figure 3 This is a schematic diagram of one implementation environment involved in this application;
[0031] Figure 4 This is a flowchart illustrating a blockchain-based random number generation method in an exemplary embodiment of this application;
[0032] Figure 5 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0033] Figure 6 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0034] Figure 7 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0035] Figure 8 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0036] Figure 9 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0037] Figure 10 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0038] Figure 11 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0039] Figure 12 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0040] Figure 13 This is a flowchart illustrating another blockchain-based random number generation method, as shown in an exemplary embodiment of this application.
[0041] Figure 14 This is a flowchart illustrating a blockchain-based random number generation method, as shown in another exemplary embodiment of this application.
[0042] Figure 15 This is a flowchart illustrating another exemplary embodiment of the present application, showing another blockchain-based random number generation method;
[0043] Figure 16 This is a flowchart illustrating another exemplary embodiment of the present application, showing another blockchain-based random number generation method;
[0044] Figure 17 This is a flowchart illustrating another exemplary embodiment of the present application, showing another blockchain-based random number generation method;
[0045] Figure 18 This is a flowchart illustrating another exemplary embodiment of the present application, showing another blockchain-based random number generation method;
[0046] Figure 19This is a flowchart illustrating another exemplary embodiment of the present application, showing another blockchain-based random number generation method;
[0047] Figure 20 This is a flowchart illustrating a blockchain-based random number generation method based on a random number network and a blockchain network, as shown in another exemplary embodiment of this application.
[0048] Figure 21 This is a flowchart illustrating the workflow of a node in a random number network, as shown in yet another exemplary embodiment of this application.
[0049] Figure 22 This is a structural block diagram of a blockchain-based random number generation device, as illustrated in an exemplary embodiment of this application.
[0050] Figure 23 This is a structural block diagram of a blockchain-based random number verification device, as illustrated in an exemplary embodiment of this application.
[0051] Figure 24 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0052] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0053] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0054] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0055] It should also be noted that "multiple" as mentioned in this application refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0056] The technical solutions of the embodiments of this application relate to the field of blockchain technology. Before introducing the technical solutions of the embodiments of this application, blockchain technology will be briefly introduced first.
[0057] Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. Essentially, a blockchain is a decentralized database, a chain of data blocks (i.e., blocks) linked together using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and to generate the next block. A blockchain can include an underlying platform, a platform product and service layer, and an application service layer.
[0058] As mentioned above, a blockchain is essentially a decentralized database, and it is maintained collaboratively by nodes within a blockchain network. For example, please refer to... Figure 1 ,exist Figure 1 The blockchain network shown may include multiple nodes 101, which can be various servers or terminals forming the blockchain network. Each node 101, in its normal operation, receives input information and maintains shared data within the blockchain network based on this information. To ensure information exchange within the blockchain network, information connections can exist between each node, allowing for information transmission. For example, when any node in the blockchain network receives input information, other nodes in the network obtain this input information according to a consensus algorithm and store it as shared data, ensuring consistency of data stored on all nodes in the blockchain network.
[0059] Each node in a blockchain network has a corresponding node identifier, and each node can store the node identifiers of other nodes. This allows for the broadcast of generated blocks to other nodes in the blockchain network based on their node identifiers. Each node can maintain a list of node identifiers, storing the node name and its corresponding node identifier in this list. The node identifier can be an IP (Internet Protocol) address or any other information that can be used to identify the node.
[0060] See Figure 1 The blockchain network shown includes nodes, and the functions of each node include:
[0061] 1) Routing: A basic function of nodes used to support communication between nodes.
[0062] 2) Applications are deployed within the blockchain to implement specific business functions based on actual business needs. They record data related to these functions, forming record data. This record data carries a digital signature to indicate the source of the task data. The record data is then sent to other nodes in the blockchain system. Upon successful verification of the record data's source and integrity, other nodes add the record data to a temporary block. The business functions implemented by these applications include: smart contracts. A smart contract is a computerized protocol that executes the terms of a contract. It is implemented through code deployed on a shared ledger that executes when certain conditions are met. Based on actual business needs, this code is used to automate transactions. Of course, smart contracts are not limited to executing contracts for transactions; they can also execute contracts for processing received data.
[0063] Please see Figure 2 A blockchain consists of multiple blocks. The genesis block includes a block header and a block body. The block header stores input information features, version number, timestamp, and difficulty value, while the block body stores the input information. The next block after the genesis block is the parent block of the genesis block. The next block also includes a block header and a block body. The block header stores the input information features of the current block, the block header features of the parent block, version number, timestamp, and difficulty value, and so on. This ensures that the block data stored in each block is related to the block data stored in the parent block, guaranteeing the security of the input information in the blocks.
[0064] It is understood that nodes in a blockchain network can be servers or terminals. Servers can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and intelligent platforms. Terminals can be smartphones, tablets, laptops, desktop computers, smart speakers, smartwatches, terminals used in vehicles, aircraft, etc., but are not limited to these. Nodes can be directly or indirectly connected via wired or wireless communication, and this application does not impose any restrictions on this.
[0065] The technical solutions of this application specifically relate to blockchain technology. The technical solutions of this application are described in detail below:
[0066] Please see Figure 3 , Figure 3 This is a schematic diagram of an implementation environment involved in this application. The implementation environment mainly includes a business party 301, a random number network 302, and a blockchain network 303.
[0067] Among them, business party 301 is the initiator of the random number request; it can initiate the random number request through any terminal with an input interface; the terminal includes, but is not limited to, smartphones, tablets, laptops, computers, smart voice interaction devices, smart home appliances, terminals used in automobiles, aircraft, etc., and the input interface includes, but is not limited to, touch screens, keyboards, physical buttons, audio pickup devices, etc.
[0068] The random number network 302 is the party responding to a random number request initiated by the business party. It can generate random numbers, verify the generated random numbers, and then upload the verified random numbers to the blockchain network, i.e., store them in the blockchain network. The random number network can be deployed using any server; the server can be a server providing various services, which can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and intelligent platforms. This document does not impose any restrictions on this.
[0069] Blockchain network 303 refers to the aforementioned blockchain network, which feeds back the stored data to the business party. There can be one or more blockchain networks 303; this is not a limitation.
[0070] Please refer to the following: Figure 3 The random number network 302 is a decentralized network, mainly comprising an execution node cluster 3021, a verification node cluster 3022, a virtual resource processor 3023, and a node allocator 3024; among which:
[0071] Execution node cluster 3021 includes at least two execution nodes. Figure 3(Only three execution nodes are shown in the example). Each execution node can be used to: detect the random number generation event triggered by the business party; determine the second execution node to provide the seed source based on the random number generation event; obtain the random seed from the determined second execution node; generate a random number based on the obtained random seed; obtain the random number generation result; generate a verification request for the random number generation result based on the random number generation result; send the verification request to the verification node; receive the signature triggered by the verification node when the random number generation result is successfully verified; generate on-chain evidence based on the signature of the verification node and the random number generation result; and send the on-chain evidence to the blockchain network 303.
[0072] Validation node cluster 3022 includes at least two validation nodes. Figure 3 (Only 3 verification nodes are shown in the example). Each verification node can be used to: receive verification requests from the execution node, verify the random number generation result contained in the verification request, sign the random number generation result if the verification is successful, and then send the signature to the execution node.
[0073] The virtual resource processor 3023 can be used to manage the virtual resources pledged by nodes (such as execution nodes and / or verification nodes) when they join the random number network. It will upload the pledged virtual resources of nodes in the random number network 302 to the blockchain network 303 for storage. Specifically, when a node joins the random number network 302, it needs to pledge virtual resources in the virtual resource processor 3023. When a node leaves the random number network 302, it can apply to unlock its virtual resources. If the node performed its business normally during its time in the random number network 302 and did not engage in malicious activities, all virtual resources on the blockchain network 303 will be returned. If the node did not perform its business normally during its time in the random number network 302, or even engaged in malicious activities, its virtual resources can be confiscated, and a higher amount of virtual resources can be added, or the node can be ordered to leave the random number network 302, depending on the specific agreement between the random number network 302 and the node.
[0074] The virtual resources corresponding to different nodes can be the same or different. Understandably, each node in a random number network typically corresponds to a different resource provider. When a business initiates a data request, it can select a node with the corresponding computing resources. These computing resources include, but are not limited to, a Central Processing Unit (CPU), memory, and hard disks. Furthermore, each computing resource can be priced by the resource provider, thus forming a decentralized network resource market and ensuring its stability.
[0075] The node allocator 3024 can be used to: collect execution nodes and verification nodes in the random number network, maintain the node set of the entire random number network, and allocate nodes (such as execution nodes and / or verification nodes) that have joined the random number network. These nodes can be located in or outside the random number network.
[0076] It should be noted that, in the specific implementation of this application, if the generation of random numbers involves objects, then when the embodiments of this application are applied to specific products or technologies, permission or consent from the objects is required, and the collection, use and processing of related data must comply with the relevant regulations and standards of the relevant countries and regions.
[0077] The following details the various implementation details of the technical solutions in the embodiments of this application:
[0078] like Figure 4 As shown, Figure 4 This is a flowchart illustrating a blockchain-based random number generation method according to an embodiment of this application. This method can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used to execute the blockchain-based random number generation method, which may include steps S410 to S450, as detailed below:
[0079] S410. Detect the random number generation event triggered by the business party, and determine the second execution node used to provide the seed source based on the random number generation event.
[0080] In this embodiment, the random number generation event refers to an event triggered by a business entity that indicates the need to generate random numbers. The business entity can trigger the random number generation event through operations. For example, if the business entity clicks a control on the execution node screen indicating the need to generate random numbers, the execution node checks whether the control has been clicked to determine whether the business entity has triggered the random number generation event. The business entity can also trigger the random number generation event through information, such as detecting whether a specified message has been received from the business entity. If a specified message from the business entity is detected, it is determined that the business entity has triggered the random number generation event.
[0081] In this embodiment of the application, when a random number generation event is detected that the business party has triggered the event, the execution node determines a second execution node to provide a seed source based on the random number generation event. The second execution node is used to provide a seed source for the random seed, where the random seed refers to the initial value used to generate random numbers.
[0082] S420. Obtain a random seed from the determined second execution node, and generate a random number based on the obtained random seed to obtain the random number generation result.
[0083] As mentioned earlier, since the second execution node is used to provide the seed source for the random seed, a seed request message can be sent to the determined second execution node, thereby obtaining the random seed from the determined second execution node.
[0084] In this embodiment, a random number is generated based on a random seed to obtain the random number generation result. Here, a random number refers to a sequence of one or more numbers, which can be used in security scenarios such as key generation, as well as in consensus mechanisms, zero-knowledge proofs, and other scenarios. The random number generation result can be the generated random number itself, or it can be data after preprocessing the generated random number, such as an encrypted random number.
[0085] It should be noted that if a random seed is obtained, the execution node generates random numbers based on that random seed. If multiple random seeds are obtained, the execution node can aggregate the multiple random seeds into one seed, for example, by taking the average of the multiple random seeds as the aggregated seed, and then generating random numbers based on the aggregated seed; alternatively, it can select a seed from the multiple random seeds and then generate random numbers based on the selected seed. The selection method can be random.
[0086] Optionally, in this embodiment of the application, the random number is generated based on the random seed, which can be done by generating the random number through VRF (Verifiable Random Function).
[0087] S430. Generate a verification request for the random number generation result based on the random number generation result, and send the verification request to the verification node so that the verification node can verify the random number generation result contained in the verification request.
[0088] In this embodiment of the application, after the execution node obtains the random number generation result, it generates a verification request based on the random number generation result. The verification request includes at least the random number generation result. The verification request is used to instruct the verification node to verify the random number generation result. After the verification request is sent to the verification node, the verification node verifies the random number generation result contained in the verification request to determine the authenticity of the random number generation result.
[0089] S440, Receive the signature triggered by the verification node when the random number generation result is successfully verified.
[0090] In this embodiment, the verification node verifies the random number generation result, and triggers the signing of the random number generation result when the verification is successful, and then the execution node receives the signature triggered by the verification node.
[0091] S450. Generate on-chain evidence based on the signature of the verification node and the random number generation result, and send the on-chain evidence to the blockchain network so that the on-chain evidence can be sent to the business party through the blockchain network.
[0092] After receiving the signature from the verification node, the execution node generates on-chain evidence based on the signature of the verification node and the random number generation result. This on-chain evidence is used to represent the final data result obtained by the execution node in response to the random number generation event of the business party, and the data result has the verification guarantee of the verification node. The execution node sends the on-chain evidence to the blockchain network for storage, and then sends the on-chain evidence to the business party through the blockchain network.
[0093] In this embodiment, random numbers are generated off-chain by execution nodes and verified by verification nodes. The verified data is then uploaded to the blockchain, avoiding excessive reliance on blocks in related technologies for on-chain random number generation schemes and ensuring the security of the random number generation process.
[0094] In one embodiment of this application, another blockchain-based random number generation method is provided, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 5 As shown, the blockchain-based random number generation method may include steps S510-S540 and S430-S440. Specifically, the random number generation event in step S510 includes a node identifier of a first execution node for generating random numbers and a node identifier of at least one second execution node for providing a seed source; that is, the node identifier of the first execution node indicates which execution nodes generate random numbers, and the node identifier of the second execution node indicates which execution nodes provide a seed source. The first execution node may include at least one node identifier.
[0095] Steps S510 to S540 are described in detail below:
[0096] S510, Detect random number generation events triggered by the business party.
[0097] Please refer to the process of detecting random number generation events. Figure 4 The process of detecting the random number generation event triggered by the business party in step S410 shown will not be described again here.
[0098] S520. If it is determined that the local node identifier matches the node identifier of the first execution node in the random number generation event, then the corresponding second execution node is determined based on the node identifier of at least one second execution node.
[0099] Understandably, each execution node is pre-configured with a unique node identifier. When an execution node detects a random number generation event, it extracts the node identifier of the first execution node from the random number generation event and determines whether the local node identifier (i.e., its own node identifier) matches the node identifier of the first execution node. If the node identifier of the first execution node includes the local node identifier, then the node identifier of the second execution node is extracted from the random number generation event.
[0100] In one example of this application, the second execution node with the node identifier of the second execution node can provide a random seed, so the execution node can determine the corresponding second execution node based on the node identifier of at least one second execution node.
[0101] Understandably, if at least two second execution nodes are identified, the random seeds obtained from these two second execution nodes will be different. For example, if a random number generation event includes node identifiers of two second execution nodes, such as node ID (Identity document) 1 and node ID 2, then the execution node can identify node 1 and node 2 corresponding to the node identifiers of the second execution nodes, and thus obtain random seed 1 from node 1 and random seed 2 from node 2, which is different from random seed 1.
[0102] Optionally, an execution node can be both a first execution node and a second execution node, meaning that the node identifier of the first execution node and the node identifier of the second execution node can both include the local node identifier.
[0103] S530. Obtain a random seed from the determined second execution node and generate a random number based on the obtained random seed.
[0104] The process of obtaining a random seed and generating random numbers involves Figure 4 The process of generating random numbers in step S420 shown in the diagram will not be described in detail here.
[0105] S540. Generate a random number generation result based on the random number, the local node identifier, and the node identifier of at least one second execution node.
[0106] After generating a random number, the execution node generates a random number generation result based on the random number, the local node identifier, and the node identifier of at least one second execution node. In the example of Embodiment 1 of this application, the random number, the local node identifier, and the node identifier of at least one second execution node are packaged to generate a random number generation result. At this time, the random number generation result also includes the local node identifier and the node identifier of the second execution node. The local node identifier indicates which execution node performed the random number generation process, and the node identifier of the second execution node indicates which execution node provided the random seed.
[0107] In another example of the embodiments of this application, the random number, the local node identifier, and the node identifier of at least one second execution node can be associated, and the associated random number can be used as the random number generation result. In this way, it can be directly known which execution node performed the random number generation and which execution node provided the random seed.
[0108] It should be noted that, Figure 5 For further details on steps S430 to S440 shown, please refer to [link to relevant documentation]. Figure 4 Steps S430 to S440 shown will not be repeated here.
[0109] This application embodiment can accurately determine whether to execute the random number generation process by matching the local node identifier and the node identifier of the first execution node in the random number generation event. The random seed can be quickly obtained through the second execution node in the random number generation event. The random number generation result is generated by using the random number, the local node identifier, and the node identifier of the second execution node. The executor of the random number generation process and the provider of the random seed can be quickly located, which is convenient for later traceability.
[0110] This application provides another blockchain-based random number generation method, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 6 As shown, this blockchain-based random number generation method... Figure 4 A step S610 is added between S420 and S430. Step S610 is described in detail below:
[0111] S610. Sign the random number generation result, and encapsulate the signature and the random number generation result to generate a verification request.
[0112] In this embodiment of the application, the execution node signs the random number generation result, making the execution node responsible for the random number generation result. The random number generation result can be signed based on the execution node's private key. Then, the execution node's signature and the random number generation result are encapsulated to generate a verification request. The encapsulation can be performed using the encapsulation tool in the execution node's local SDK (Software Development Kit).
[0113] It should be noted that, Figure 6 For detailed information on steps S410 to S450 shown, please refer to [link to relevant documentation]. Figure 4 Steps S410 to S450 shown will not be repeated here.
[0114] This application embodiment signs the random number generation result, making the execution node responsible for the random number generation result, and generates a verification request through the signature and random number generation result, which facilitates the quick location of the generator of the verification request.
[0115] This application also provides another blockchain-based random number generation method, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 7 As shown, this blockchain-based random number generation method... Figure 4 A step S710 is added between S430 and S440 as shown. Wherein, Figure 7 The random number generation event in step S410 shown includes a list of verification nodes, which includes at least two specified verification node identifiers, i.e., the business party specifies which verification nodes will perform the random number verification process.
[0116] Step S710 is described in detail below:
[0117] S710. Send the verification request to the verification node in the verification node cluster that matches at least two specified verification node identifiers.
[0118] Understandably, the verification node cluster consists of multiple verification nodes, each configured with a unique node identifier. Therefore, after the execution node detects a random number generation event, it extracts at least two specified verification node identifiers from the verification node list contained in the random number generation event, and then selects a verification node from the verification node cluster that matches at least two specified verification node identifiers, sending the verification request to the selected verification node.
[0119] For example, a random number generation event includes a list of verification nodes, which includes verification node identifiers A, B, and C. The execution node sends verification requests to verification node 1, which matches verification node identifier A; verification node 2, which matches verification node B; and verification node 3, which matches verification node C. Verification nodes 1, 2, and 3 then perform the random number verification process.
[0120] It should be noted that, Figure 7 For further details on steps S410 to S450 shown, please refer to [link to relevant documentation]. Figure 4 Steps S410 to S450 shown in the diagram will not be repeated here.
[0121] This application embodiment uses a list of verification nodes included in the random number generation event to easily and quickly send verification requests to verification nodes that match the verification node identifiers contained in the list for verification; and since there are at least two verification nodes, it avoids the phenomenon of a single verification node acting maliciously and improves the accuracy of verification.
[0122] In one embodiment of this application, another blockchain-based random number generation method is also provided, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 8 As shown, this blockchain-based random number generation method... Figure 4 A step S810 is added between S430 and S440 shown in the diagram. Figure 8 The random number generation event in step S410 shown includes the number of verification nodes. The number of verification nodes is at least two, meaning that the business side has specified that a certain number of verification nodes will perform the random number verification process, but has not specified which specific verification nodes will perform the verification.
[0123] Step S810 is described in detail below:
[0124] S810: Select a verification node from the verification node cluster that matches the number of verification nodes, and send the verification request to the selected verification node.
[0125] It should be noted that the verification node selected from the verification node cluster can be a currently idle verification node, that is, a node that has not executed any verification process; or it can be a node that is currently executing a verification process. In this case, the verification request is sent to the selected verification node, and then the verification node is waited for to finish executing the verification process it is currently executing before the random number verification process corresponding to the verification request is executed.
[0126] Among them, the number of verification nodes in the verification node cluster is greater than or equal to the number of verification nodes included in the random number generation event.
[0127] In some embodiments of this application, if the number of verification nodes included in the random number generation event is greater than the number of verification nodes in the verification node cluster, the execution node can send a message to the business party that there are not enough verification nodes in the verification node cluster, so that the business party can re-specify the number of verification nodes.
[0128] In one example of this application embodiment, after the execution node detects a random number generation event, it extracts the number of verification nodes from the random number generation event, and then the execution node directly selects a verification node from the verification node cluster that matches the number of verification nodes, and sends the verification request to the selected verification node.
[0129] Optionally, the execution node can randomly select verification nodes from the verification node cluster that match the number of verification nodes; for example, if the random number generation event includes 4 verification nodes, the execution node can randomly select 4 verification nodes from the verification node cluster and then send the verification request to these 4 verification nodes respectively.
[0130] Optionally, the execution node can also select verification nodes from the verification node cluster according to a certain rule, matching the number of verification nodes. For example, it can select verification nodes according to the order in which they come online, where the online status of a verification node indicates that it can execute the random number verification process. Assuming the random number generation event involves three verification nodes, with verification node 1 coming online first, followed by verification node 3 and then verification node 4, the execution node selects verification nodes 1, 3, and 4, and then sends the verification request to them respectively. Another example is selecting verification nodes based on the number of verification processes currently pending execution, i.e., prioritizing verification nodes with fewer pending verification processes.
[0131] In another example of the embodiments of this application, the node allocator may select a verification node from the verification node cluster that matches the number of verification nodes. The execution node sends a verification node allocation request to the node allocator based on the number of verification nodes, so that the node allocator selects a verification node from the verification node cluster that matches the number of verification nodes based on the verification node allocation request and returns the identifier of the verification node. Then the execution node sends the verification request to the verification node that matches the identifier of the verification node.
[0132] For example, in a random number generation event, the number of verification nodes is 3. The execution node sends a verification node allocation request to the node allocator. This verification node allocation request carries the required number of verification nodes, i.e., 3 verification nodes. Then, the node allocator selects verification nodes 1, 2, and 3, and feeds back the verification node identifiers A, B, and C corresponding to verification nodes 1, 2, and 3 to the execution node. The execution node sends the verification request to the verification nodes 1, 2, and 3 that match the verification node identifiers A, B, and C.
[0133] When the node allocator selects a verification node from the verification node cluster that matches the number of verification nodes based on the verification node allocation request, the node allocator can select randomly or according to a certain rule. For details, please refer to the description of the aforementioned embodiments, which will not be repeated here.
[0134] It should be noted that, Figure 8 For further details on steps S410 to S450 shown, please refer to [link to relevant documentation]. Figure 4 Steps S410 to S450 shown will not be repeated here.
[0135] This application embodiment generates the number of verification nodes included in the event by random number generation. The execution node can easily and quickly send the verification request to the verification node that matches the number of verification nodes for verification. Furthermore, since there are at least two verification nodes, the phenomenon of a single verification node acting maliciously is avoided, thus improving the accuracy of verification.
[0136] This application provides another blockchain-based random number generation method, which includes methods applicable to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 9 As shown, this blockchain-based random number generation method... Figure 4 A step S910 is added between S430 and S440 as shown. Wherein, Figure 9 The random number generation event in step S410 shown includes the number of verification nodes. The number of verification nodes is at least two, meaning that the business side has specified that a certain number of verification nodes will perform the random number verification process, but has not specified which verification nodes will specifically perform the verification.
[0137] Step S910 is described in detail below:
[0138] S910. Send the number of verification nodes and verification requests to the node allocator so that the node allocator can select verification nodes from the verification node cluster that match the number of verification nodes and forward the verification requests to the selected verification nodes.
[0139] In this embodiment, the node allocator selects verification nodes that match the number of verification nodes, and the node allocator forwards verification requests from the execution nodes to the selected verification nodes. That is, the node allocator specifies which verification nodes will perform verification and forwards the verification requests sent by the execution nodes to the specified verification nodes.
[0140] For example, a random number generation event includes three verification nodes. The execution node sends the number of three verification nodes and a verification request to the node allocator. The node allocator selects verification nodes 1, 2, and 3, and then forwards the verification request to verification nodes 1, 2, and 3 respectively.
[0141] When the node allocator selects a verification node from the verification node cluster that matches the number of verification nodes based on the verification node allocation request, the node allocator can select randomly or according to a certain rule. For details, please refer to the description of the aforementioned embodiments, which will not be repeated here.
[0142] The embodiments of this application reduce the processing pressure on business processing nodes by generating a number of verification nodes through random number generation events, and the verification nodes are selected by the node allocator. This can be applied to a wider range of application scenarios and avoid the situation where execution nodes and verification nodes collude to commit malicious acts, making random number verification more reliable.
[0143] It should be noted that, Figure 9 For further details on steps S410 to S450 shown, please refer to [link to relevant documentation]. Figure 4 Steps S410 to S450 shown in the diagram will not be repeated here.
[0144] It is worth noting that at this time, when receiving the signature triggered by the verification node when the random number generation result is successfully verified in step S440, the execution node can directly receive the signature sent by the verification node; or the execution node can receive the signature from the verification node forwarded by the node allocator. The signature of the verification node is forwarded by the node allocator after receiving the signature sent by the verification node; that is, the verification node sends the signature to the node allocator, and then the node allocator forwards the signature to the execution node.
[0145] This application provides another blockchain-based random number generation method, which includes methods applicable to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 10 As shown, this blockchain-based random number generation method... Figure 4 A step S1010 is added between S440 and S450 shown. Step S1010 is described in detail below:
[0146] S1010. If the number of received signatures exceeds the preset threshold, the signatures of the verification nodes and the random number generation results are encapsulated, and the encapsulated data is signed to obtain on-chain evidence.
[0147] It should be noted that the execution node can receive signatures from multiple verification nodes, and then determine whether the number of received signatures exceeds a preset threshold. In one example of this application embodiment, the preset threshold can be flexibly set by the execution node or the business party.
[0148] In another example of this application embodiment, the preset quantity threshold can also be flexibly set according to the business requirements of the business party and the total number of verification nodes performing the random number verification process. For example, if the business party has strict requirements for random numbers and there are 50 verification nodes performing the random number verification process, the preset quantity threshold can be set to four-fifths of the number of verification nodes. That is, if the number of received signatures exceeds 40, the signatures of the verification nodes and the random number generation results will be encapsulated. Of course, the preset quantity threshold can also be flexibly set only according to the total number of verification nodes performing the random number verification process, such as setting the preset quantity threshold to two-thirds of the number of verification nodes.
[0149] The execution node encapsulates the signature and random number generation result of the verification node, and then signs the encapsulated data to obtain on-chain evidence. This makes the execution node responsible for the on-chain evidence, which facilitates the identification or location of the responsible party in the future.
[0150] In this embodiment, if the number of received signatures does not exceed a preset threshold, the execution node does not perform the process of generating on-chain evidence. In one example, the execution node can re-execute the process of generating random numbers and then verify the random numbers again through the verification node. In another example, the execution node can also reselect a verification node or reselect a verification node through the node allocator, and then have the reselected verification node perform the random number verification process. The execution node can also provide feedback to the business party on the reason for not generating on-chain evidence, so that the business party can reselect an execution node to execute the random number generation process and then verify the random numbers through the verification node.
[0151] It should be noted that, Figure 10 For detailed information on steps S410 to S450 shown in the diagram, please refer to [link / reference]. Figure 4 Steps S410 to S450 shown in the diagram will not be repeated here.
[0152] In this embodiment of the application, after receiving a sufficient number of signatures, on-chain evidence is generated to ensure the authenticity and reliability of the on-chain evidence.
[0153] This application provides another blockchain-based random number generation method, which includes methods applicable to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 11 As shown, this blockchain-based random number generation method... Figure 4 Steps S1110 to S1120 are added after S450 shown. Steps S1110 to S1120 are described in detail below:
[0154] S1110. If no deployed evidence contract exists in the blockchain network, then deploy the evidence contract in the blockchain network.
[0155] It's important to note that if multiple execution nodes perform the same task, the evidence contract address generated by each node will be identical. To prevent contract duplication, only one evidence contract will be successfully deployed on the blockchain network for the same task. Therefore, before sending the on-chain evidence to the blockchain network, each execution node will first check if another execution node has already deployed an evidence contract. An evidence contract is a smart contract within the blockchain network used to store the on-chain evidence.
[0156] If no evidence contract has been deployed in the blockchain network, the execution node needs to deploy an evidence contract in the blockchain network to send the on-chain evidence to the evidence contract in the blockchain network.
[0157] S1120. If a deployed evidence contract is stored in the blockchain network, the on-chain evidence is sent to the evidence contract in the blockchain network so that the evidence contract stores the on-chain evidence and sends the on-chain evidence to the business party according to the callback information from the business party.
[0158] If there is an evidence contract deployed by the execution node itself or by other execution nodes in the blockchain network, the on-chain evidence will be sent directly to the evidence contract already deployed in the blockchain network.
[0159] In this embodiment, after the on-chain evidence is sent to the evidence contract on the blockchain network, the evidence contract stores the on-chain evidence and sends it to the business party according to the callback information from the business party. The callback information from the business party represents the receiving address for the business party to receive data from the blockchain network. This callback information can be obtained by the execution node from the business party and stored in the evidence contract during deployment.
[0160] It should be noted that, Figure 11 For detailed information on steps S410 to S450 shown, please refer to [link to relevant documentation]. Figure 4 Steps S410 to S450 shown in the diagram will not be repeated here.
[0161] This application embodiment determines whether a deployed evidence contract exists in the blockchain network. If not, the execution node deploys the evidence contract, avoiding duplicate deployment of the evidence contract. The on-chain evidence is then sent to the evidence contract for storage, facilitating later retrieval.
[0162] It is worth noting that this application provides another blockchain-based random number generation method, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 12 As shown, this blockchain-based random number generation method... Figure 4 The steps S1210 to S1230 have been added before S410 shown. Steps S1210 to S1230 constitute the service deployment process for the execution node, detailed below:
[0163] S1210. Receive the generation service deployment request sent by the business party. The generation service deployment request carries a seed source service identifier, a random number generation service identifier, a list of execution node identifiers to be deployed corresponding to the seed source service identifier, and a list of execution node identifiers to be deployed corresponding to the random number generation service identifier.
[0164] In this embodiment of the application, when a business wants an execution node to perform a specific task, it can send a corresponding service deployment request to the execution node, and then the execution node will deploy the corresponding service to perform the corresponding task.
[0165] The execution node receives a generation service deployment request sent by the business party. This generation service deployment request carries a seed source service identifier, a random number generation service identifier, a list of execution node identifiers to be deployed corresponding to the seed source service identifier, and a list of execution node identifiers to be deployed corresponding to the random number generation service identifier. The seed source service identifier is used to uniquely identify the seed source service, and the random number generation service identifier is used to uniquely identify the random number generation service. That is, the business party specifies which execution nodes to deploy the random number generation service and which execution nodes to deploy the seed source service. The seed source service and the random number generation service can be developed by the business party or by a third party trusted by the business party.
[0166] S1220. If the list of execution node identifiers to be deployed corresponding to the seed source service identifier contains a local node identifier, then deploy the seed source service corresponding to the seed source service identifier; wherein, the seed source service is used to provide random seeds.
[0167] The execution node extracts a list of execution node identifiers to be deployed, corresponding to the seed source service identifier, from the generated service deployment request. If it determines that the list of execution node identifiers to be deployed contains a local node identifier, it extracts the seed source service identifier from the generated service deployment request and then deploys the seed source service corresponding to the data seed source service identifier. After deploying the seed source service, the execution node can provide random seeds based on this seed source service.
[0168] It should be noted that the execution node has many options when providing a random seed, such as generating a random seed based on the timestamp or the hash of the current block, which can be determined according to business needs.
[0169] It is understandable that the execution node can pre-store multiple business services, and then determine and deploy the seed source service corresponding to the seed source service identifier from among these multiple business services. Alternatively, the execution node can obtain the seed source service corresponding to the seed source service identifier from a third party trusted by the business party, and then deploy that seed source service.
[0170] S1230. If the list of execution node identifiers to be deployed corresponding to the random number generation service identifier contains a local node identifier, then deploy the random number generation service corresponding to the random number generation service identifier; wherein, the random number generation service is used to generate random numbers based on a random seed.
[0171] The execution node extracts the local node identifier from the list of execution node identifiers to be deployed, corresponding to the random number generation service identifier, from the generation service deployment request. If the list contains the local node identifier, the execution node extracts the random number generation service identifier from the generation service deployment request and then deploys the random number generation service corresponding to that identifier. After deploying the random number generation service, the execution node can generate random numbers based on it.
[0172] It is understandable that a single execution node can simultaneously deploy a seed generation service and a random number generation service to generate random numbers, but this could lead to malicious behavior by the execution node. In some embodiments, the seed generation service and the random number generation service can be deployed on two different execution nodes, i.e., the generation of random numbers and the generation of random seeds are separated, ensuring security and increasing the cost of malicious behavior.
[0173] As mentioned earlier, the random number generation service can be determined from multiple pre-stored business services, or it can be obtained from a third party trusted by the business party.
[0174] It should be noted that, Figure 12 For detailed information on steps S410 to S450 shown, please refer to [link to relevant documentation]. Figure 4Steps S410 to S450 shown in the diagram will not be repeated here.
[0175] In this embodiment, a random number generation service and a seed source service are deployed through a generation service deployment request sent by the business party, so as to provide support for the subsequent implementation of corresponding random number generation based on the random number generation service and the seed source service.
[0176] This application provides another blockchain-based random number generation method, which includes methods applicable to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The execution nodes in the execution node cluster 3021 shown are used for execution, such as Figure 13 As shown, this blockchain-based random number generation method... Figure 12 Steps S1310 to S1330 have been added between S1230 and S410. Steps S1310 to S1330 describe the process by which the execution node pledges virtual resources and requests the return of those resources, detailed below:
[0177] S1310. When deploying at least one of the seed source service and the random number generation service, virtual resources are pledged to the virtual resource processor so that the virtual resource processor sends the pledged virtual resources to the blockchain network for storage.
[0178] In this embodiment of the application, when the execution node deploys at least one of the seed source service and the random number generation service, it indicates that the execution node has joined. Figure 3 The random number network shown requires staking virtual resources with the virtual resource processor. Staking virtual resources ensures that the execution process of the execution nodes is as reliable as possible when performing seed source services and / or random number generation services. The virtual resource processor then sends the staked virtual resources to the blockchain network for storage, thus locking the staked virtual resources.
[0179] After pledging virtual resources to the virtual resource processor, the execution node can enter the random number generation step, i.e., step S410, when random number generation is required.
[0180] S1320. If it is necessary to cancel at least one of the deployed random number generation service and the deployed seed source service, apply to the virtual resource processor for the return of the pledged virtual resources so that other execution nodes can challenge the execution process of at least one service locally.
[0181] In this embodiment of the application, if the execution node needs to cancel the deployed seed source service and / or random number generation service, it indicates that the execution node is exiting. Figure 3The random number network shown requests the return of pledged virtual resources from the virtual resource processor. When the virtual resource processor receives the request from the execution node, it sends a challenge message to other execution nodes. In turn, other execution nodes challenge the execution process of their local seed source service and / or random number generation service. That is, other execution nodes determine whether the execution process of their local seed source service and / or random number generation service is normal, such as whether there are malicious or unreasonable phenomena.
[0182] S1330. If other execution nodes fail to complete the challenge during the challenge period, the virtual resources returned by the virtual resource processor through the blockchain network will be received.
[0183] It should be noted that, starting from the time the executing node applies for the return of virtual resources, if other executing nodes fail to successfully challenge during the challenge period, it indicates that the execution process of the executing node's seed source service and / or random number generation service is normal. The virtual resource processor then extracts the virtual resources staked by the executing node from the blockchain network and sends them to the executing node. If other executing nodes successfully challenge during the challenge period, the virtual resources staked by the executing node belong to the other executing nodes that successfully challenged.
[0184] Optionally, the challenge period can be flexibly adjusted by the virtual resource processor according to the actual situation, such as setting the challenge period to 7 days.
[0185] It should be noted that, Figure 13 For detailed information on steps S410 to S450 shown, please refer to [link to relevant documentation]. Figure 4 Steps S410 to S450 shown are... Figure 13 For a detailed description of steps S1210 to S1230 shown, please refer to [link to relevant documentation]. Figure 12 Steps SS1210 to S1230 shown in the diagram will not be repeated here.
[0186] This application embodiment pledges virtual resources to the virtual resource processing party when deploying the random number generation service and / or seed source service, and applies for the return of virtual resources when canceling the deployed random number generation service and / or seed source service. This is done by supervising the normal execution of the random number generation service and / or seed source service by the execution node through virtual resources, thereby ensuring the authenticity and reliability of the random number generation process.
[0187] Figures 4 to 13 The illustrated embodiment is presented from the perspective of the execution node. The following is combined with... Figures 14 to 19 The implementation details of the technical solution in the embodiments of this application are described in detail from the perspective of the verification node:
[0188] Please see Figure 14 , Figure 14This is a flowchart illustrating a blockchain-based random number generation method according to an embodiment of this application. The method can be... Figure 3 The verification nodes in the verification node cluster 3022 shown are used to execute the command. Figure 14 As shown, the blockchain-based random number generation method may include steps S1410 to S1440, which are described in detail below:
[0189] S1410. Receive a verification request from the execution node; the verification request carries the random number generation result obtained by the execution node based on the generated random number. The random number is generated by the execution node after detecting the random number generation event triggered by the business party, determining the second execution node to provide the seed source based on the random number generation event, obtaining the random seed from the determined second execution node, and generating the random number based on the obtained random seed.
[0190] As mentioned earlier, the verification request is used to instruct the verification node to verify the random number generation result, which is obtained by the execution node based on the generated random number. The specific process of generating the random number is detailed in steps S410–S420 or S520–S530, and will not be repeated here.
[0191] S1420. Verify the random number generation result contained in the verification request.
[0192] Therefore, after receiving the verification request, the verification node will verify the random number generation result contained in the verification request to verify whether the random number generation result contained in the verification request is correct.
[0193] S1430. If the random number generation result is successfully verified, then the random number generation result is signed.
[0194] If the verification node verifies that the random number generation result is correct, it means that the verification of the random number generation result is successful. Then, the random number generation result can be signed using the verification node's private key, and the signature indicates the verification node's approval.
[0195] If the verification node verifies that the random number generation result is incorrect, it means that the verification of the random number generation result has failed. In one example, the verification node will not perform any action; in another example, the verification node can provide feedback on the failure to the execution node.
[0196] S1440. Send the signature to the execution node so that the execution node can generate on-chain evidence based on the signature and the random number generation result, and send the on-chain evidence to the business party through the blockchain network.
[0197] In this embodiment of the application, after the verification node signs the random number generation result, it sends the signature to the execution node. After receiving the signature of the verification node, the execution node can know the verification node's approval opinion, generate on-chain evidence based on the signature of the verification node and the random number generation result, and send it to the blockchain network for storage. Then, the on-chain evidence is sent to the business party through the blockchain network.
[0198] In this embodiment, random numbers are generated off-chain by execution nodes and verified by verification nodes. The verified data is then uploaded to the blockchain, avoiding excessive reliance on blocks in related technologies for on-chain random number generation schemes and ensuring the security of the random number generation process.
[0199] This application provides another blockchain-based random number generation method, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The verification nodes in the verification node cluster 3022 shown are used to execute the command, as follows: Figure 15 As shown, the blockchain-based random number generation method may include steps S1510, S1420 to S1440. Step S1510 is described in detail below:
[0200] S1510, Receive the verification request sent by the execution node.
[0201] The verification node can directly receive verification requests sent by the execution node without going through an intermediate forwarder.
[0202] It should be noted that, Figure 15 For detailed information on steps S1420 to S1440 shown, please refer to [link to relevant documentation]. Figure 14 Steps S1420 to S1440 shown in the diagram will not be repeated here.
[0203] It is worth noting that this application provides another blockchain-based random number generation method, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The verification nodes in the verification node cluster 3022 shown are used to execute the command, as follows: Figure 16 As shown, the blockchain-based random number generation method may include steps S1610, S1420 to S1440. Step S1610 is described in detail below:
[0204] S1610. The receiving node allocator forwards the verification request from the execution node. The verification request is forwarded by the node allocator after selecting the corresponding verification node based on the verification request after receiving the verification request sent by the execution node.
[0205] In this embodiment, the verification node indirectly receives the verification request sent by the execution node. Specifically, the execution node sends the verification request to the node allocator, which then selects the corresponding verification node based on the verification request and forwards the verification request to the selected node. The process by which the node allocator selects the corresponding verification node based on the verification request is detailed in the above embodiments and will not be repeated here.
[0206] It should be noted that, Figure 16 For detailed information on steps S1420 to S1440 shown, please refer to [link to relevant documentation]. Figure 14 Steps S1420 to S1440 shown in the diagram will not be repeated here.
[0207] The embodiments of this application obtain verification requests from the execution node in at least two ways, which can be applied to a wider range of application scenarios and provide support for subsequent verification processes based on verification requests.
[0208] It is worth noting that this application provides another blockchain-based random number generation method, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The verification nodes in the verification node cluster 3022 shown are used to execute the command, as follows: Figure 17 As shown, the blockchain-based random number generation method includes steps S1410, S1710, and S1430-S1440. Step S1710 is described in detail below:
[0209] S1710. Obtain a verification random number based on the verification request, and verify the random number generation result contained in the verification request based on the verification random number.
[0210] As mentioned above, the verification request includes at least a random number generation result and a signature of the execution node, wherein the random number generation result includes at least a random number generated by the execution node. In one example of this application embodiment, the verification request also includes a node identifier of at least one second execution node providing a seed source. Upon receiving the verification request, the verification node can obtain a verification random seed from the second execution node corresponding to the node identifier of at least one second execution node based on the verification request. The verification request generates a verification random number based on the verification random seed, wherein the verification node generates the random number in the same way as the execution node generates the random number.
[0211] In another example of the embodiments of this application, the process of the execution node generating random numbers and the process of the verification node performing random number verification are set up in a coordinated manner. That is, the verification node obtains a random seed from the specified execution node and then generates a random number. The execution node can then know the specified execution node, obtain the verification random seed from the specified execution node, and then generate a verification random number in the same way as the execution node.
[0212] In one example of an embodiment of this application, the verification node compares the verification random number with the random number generated in the random number generation result. If the verification random number matches the random number generated in the random number generation result, such as when the data is completely identical, then the random number generation result is normal and the verification of the random number generation result is successful. If the verification random number does not match the random number generated in the random number generation result, such as when the data is missing or the data is partially different, then the random number generation result is abnormal and the verification of the random number generation result fails.
[0213] In another example of this application embodiment, the random number generation result includes a random number generated by the execution node, and also includes an execution node identifier and a second execution node identifier. The verification node obtains a verification random seed from the second execution node corresponding to the second execution node identifier based on the verification request, and also obtains a node identifier from the data record of the second execution node. The node identifier indicates which execution nodes obtained random seeds from the second execution node. Then, the verification node verifies the random number in the random number generation result based on the verification random number generated by the verification random seed, and verifies the execution node identifier in the random number generation result based on the node identifier obtained from the data record of the second execution node. If the random number in the random number generation result is successfully verified, and the execution node identifier in the random number generation result is successfully verified, then the random number generation result is successfully verified.
[0214] It should be noted that, Figure 17 For detailed information on steps S1410, S1430 to S1440 shown, please refer to [link to relevant documentation]. Figure 14 Steps S1410, S1430 to S1440 shown in the diagram will not be repeated here.
[0215] This application embodiment verifies the random number in the random number generation result by using the verification random number generated by the verification node, which can simply and quickly verify data security.
[0216] It is worth noting that this application provides another blockchain-based random number generation method, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The verification nodes in the verification node cluster 3022 shown are used to execute the command, as follows: Figure 18 As shown, this blockchain-based random number generation method... Figure 14 Steps S1810 to S1820 have been added before step S1410. Steps S1810 to S1820 constitute the service deployment process for the verification node, detailed below:
[0217] S1810. Receive a verification service deployment request sent by the business party. The verification service deployment request carries a random number verification service identifier and a list of verification node identifiers to be deployed.
[0218] In this embodiment of the application, when a business wants to verify that a node is performing a specific task, it can send a corresponding service deployment request to the verification node, and then the verification node will deploy the corresponding service to perform the corresponding task.
[0219] The verification node receives a verification service deployment request sent by the business party. The verification service deployment request carries a random number verification service identifier and a list of verification node identifiers to be deployed. The random number verification service identifier is used to uniquely identify the random number verification service, that is, the business party specifies the verification nodes to deploy the random number verification service and specifies which verification nodes to deploy. The random number verification service can be developed by the business party or by a third party trusted by the business party.
[0220] S1820. If the list of verification node identifiers to be deployed includes a local node identifier, then deploy the random number verification service corresponding to the random number verification service identifier; wherein, the random number verification service is used to verify the random number generation result contained in the verification request.
[0221] The verification node extracts a list of verification node identifiers to be deployed from the verification service deployment request. If it is determined that the list of verification node identifiers to be deployed contains the local node identifier, it extracts the random number verification service identifier from the verification service deployment request and then deploys the random number verification service corresponding to the random number verification service identifier.
[0222] Understandably, the verification node can pre-store multiple business services, and then determine and deploy the random number verification service corresponding to the random number verification service identifier from among these services. The execution node can also obtain the data verification service corresponding to the random number verification service identifier from a third party trusted by the business party, and then deploy that data verification service. After deploying the random number verification service, the verification node can verify the random number generation result contained in the verification request based on this service.
[0223] It should be noted that, Figure 18 For detailed information on steps S1410 to S1440 shown, please refer to [link to relevant documentation]. Figure 14 Steps S1410 to S1440 shown in the diagram will not be repeated here.
[0224] In this embodiment, a random number verification service is deployed through a verification service deployment request sent by the business party, so as to provide support for the subsequent implementation of corresponding verification random numbers based on the random number verification service.
[0225] This application also provides another blockchain-based random number generation method, which can be applied to... Figure 3 The implementation environment shown indicates that this method can be implemented by Figure 3 The verification nodes in the verification node cluster 3022 shown are used to execute the command, as follows: Figure 19 As shown, this blockchain-based random number generation method... Figure 18 The steps between S1820 and S1410 shown in the diagram can include S1910 to S1930. Steps S1910 to S1930 are the process by which the verification node pledges virtual resources and applies for the return of the pledged virtual resources, detailed below:
[0226] S1910. When deploying the random number verification service corresponding to the random number verification service identifier, pledge virtual resources to the virtual resource processor so that the virtual resource processor can send the pledged virtual resources to the blockchain network for storage.
[0227] In this embodiment of the application, when the verification node deploys the random number verification service corresponding to the random number verification service identifier, it indicates that the verification node has joined... Figure 3 The random number network shown requires staking virtual resources with the virtual resource processor. By staking virtual resources, the reliability of the verification node's random number verification process is ensured. The virtual resource processor then sends the staked virtual resources to the blockchain network for storage, thereby locking the staked virtual resources.
[0228] After pledging virtual resources to the virtual resource processor, if a verification request from the execution node is required, proceed to step S1410.
[0229] S1920. If it is necessary to cancel the deployed random number verification service, apply to the virtual resource processor for the return of the pledged virtual resources so that other verification nodes can challenge the execution process of the local data verification service.
[0230] In this embodiment, if a verification node needs to cancel the deployed random number verification service, it indicates that the verification node is exiting. Figure 3The random number network shown requests the return of pledged virtual resources from the virtual resource processor. When the virtual resource processor receives the request from the verification node, it sends a challenge message to other verification nodes. Then, other verification nodes challenge the execution process of their local random number verification service. That is, other verification nodes determine whether the execution process of their local random number verification service is normal, such as whether there is any malicious or unreasonable behavior.
[0231] S1930. If other verification nodes fail to succeed in the challenge during the challenge period, the virtual resources returned by the virtual resource processor through the blockchain network will be received.
[0232] It should be noted that, starting from the time a validator requests the return of virtual resources, if other validators fail to succeed in their challenge during the challenge period, it indicates that the execution process of the validator's random number verification service is normal. The virtual resource processor then extracts the virtual resources staked by the validator from the blockchain network and sends them to the validator. If other validators succeed in their challenge during the challenge period, the virtual resources staked by the validator belong to the other validators who successfully completed the challenge.
[0233] Optionally, the challenge period can be flexibly adjusted by the virtual resource processor according to the actual situation, such as setting the challenge period to 7 days.
[0234] It should be noted that, Figure 19 For detailed information on steps S1410 to S1440 shown, please refer to [link to relevant documentation]. Figure 14 Steps S1410 to S1440 shown are... Figure 19 For detailed information on steps S1810 to S1820 shown, please refer to [link to relevant documentation]. Figure 18 Steps S1810 to S1820 shown in the diagram will not be repeated here.
[0235] This application embodiment pledges virtual resources to the virtual resource processor when deploying the random number verification service, and applies for the return of virtual resources when canceling the deployed random number verification service. This method uses virtual resources to supervise the normal execution of the random number verification service by the verification node, thereby ensuring the authenticity and reliability of the random number verification process.
[0236] For ease of understanding, the following is based on Figure 3 The implementation environment shown below provides a detailed description of the blockchain-based random number generation method provided in this application embodiment:
[0237] It should be noted that the following preliminary preparations are required before the execution node and verification node execute the blockchain-based random number generation method:
[0238] When business users have random number requirements, they develop their own random number contract, seed source service, random number generation service, and random number verification service. The business users deploy the random number contract to the blockchain network, and deploy the seed source service, random number generation service, and random number verification service to the random number network. The business users also deploy a business contract in the blockchain network. This business contract is used to initiate random number generation requests for smart contracts in the blockchain network. The business contract is used to call the random number contract, and the random number contract is used to respond to the call of the business contract by initiating random number generation requests to the random number network and feeding back the on-chain data to the business contract through the blockchain network.
[0239] When the business deploys the seed source service and random number generation service to the random number network, it needs to specify a list of execution node IDs to be deployed. That is, it specifies execution nodes in the execution node cluster of the random number network to deploy the seed source service and the random number generation service. The seed source service and random number generation service are stored in the execution nodes in the execution node cluster of the random number network and run by the execution nodes. The execution nodes provide a Docker container runtime environment to provide random seeds through the execution seed service and to generate random numbers through the execution random number generation service. Subsequently, the execution nodes will deploy the corresponding evidence contract in the blockchain network. The evidence contract is used to store the data uploaded by the execution nodes and to feed the uploaded data back to the business contract.
[0240] It should be noted that if the business party designates multiple execution nodes to deploy the random number generation service, the address of the evidence contract generated by each execution node is the same. Therefore, only one evidence contract will be successfully deployed on the blockchain. Before uploading data to the blockchain, the execution node needs to check whether there is an evidence contract in the blockchain network. If not, the evidence contract needs to be deployed in the blockchain network. If it exists, there is no need to deploy the evidence contract again.
[0241] When a business deploys a random number verification service to a random number network, it needs to specify a list of verification node IDs to be deployed. That is, it specifies the verification nodes in the verification node cluster of the random number network to deploy the random number verification service. The random number verification service will be stored on the verification nodes, and the verification nodes will execute the random number verification service to verify the results of the execution nodes.
[0242] Optionally, the random number verification service consumes fewer resources than the random number generation service. If the business has high security requirements, it can choose to deploy multiple verification nodes to verify the results of the execution nodes. However, this will increase costs, which the business must weigh against its own priorities.
[0243] Based on the above preliminary preparations, please refer to Figure 20 , Figure 20This is a flowchart of a random number generation method based on random number networks and blockchain networks. The method includes:
[0244] S2010, The business party's business contract calls the random number contract, carrying the relevant business information and the node ID of the specified random number network.
[0245] When a business needs random numbers, the business contract is triggered, and then the business contract calls the random number contract, carrying the relevant business information. This business information can be the business's callback information, specifying the random number node ID, including the seed source execution node ID, the random number generation execution node ID, and the verification node ID.
[0246] S2020, random number contracts will be triggered, leaving an event record on the blockchain network.
[0247] This means that a random number generation event has been triggered. The random number generation event record includes at least the seed source execution node ID, the random number generation execution node ID, the verification node ID, and business information.
[0248] S2030: Execution nodes in the random number network subscribe to events on the blockchain network to obtain relevant information from event records.
[0249] The execution nodes in the random number network will detect event records on the blockchain network. If the running execution node ID is detected to match the random number generated execution node ID in the event record, the relevant information in the event record will be retrieved.
[0250] S2040. The execution nodes in the random number network obtain random seeds through the execution node corresponding to the seed source execution node ID.
[0251] The execution node obtains a random seed from the execution node corresponding to the seed source execution node ID. There can be multiple seed source execution node IDs, and each one obtains a random seed. The execution node corresponding to the seed source execution node ID caches the provided seed for verification by the verification node.
[0252] S2050, The execution node generates a random number based on the obtained random seed.
[0253] Multiple random seeds are combined into one seed according to the rules, and this seed is used to generate random numbers.
[0254] S2060, the execution nodes and verification nodes in the random number network reach a consensus.
[0255] After generating a random number, the execution node calls the encapsulated SDK provided by the random number network to encapsulate the seed source node ID list, the verification node ID list, and the random number to be verified, and triggers the construction of a verification request. The verification request is then sent to the verification node corresponding to the verification node ID in the event log, in an effort to obtain the verification node's approval opinion (i.e., signature). If the execution node receives enough signatures from the verification nodes, the execution node and the verification nodes reach a consensus.
[0256] S2070, The execution node constructs on-chain evidence and sends the on-chain evidence to the evidence contract in the blockchain network.
[0257] The execution node constructs on-chain evidence based on the signature and random number of the verification node, and sends the on-chain evidence, random number contract callback address and parameters to the evidence contract.
[0258] S2080, the evidence contract stores the on-chain evidence and submits the random number in the on-chain evidence to the random number contract.
[0259] The evidence contract stores on-chain evidence and submits the random number from the on-chain evidence to the random number contract according to the callback address and parameters of the random number contract.
[0260] S2090, the random number contract calls back to the business contract, delivering the random number to the business contract.
[0261] This completes the generation and acquisition of random numbers outside the blockchain network. In the above process, operations such as random number generation and acquisition by the execution node, verification between the execution node and the verification node, construction of on-chain evidence by the execution node, and storage of on-chain evidence in the evidence contract can be automatically executed by the random number network. Furthermore, the transmission of random numbers within the random number network is encrypted, ensuring security.
[0262] based on Figure 20 For the provided technical solutions, please refer to [link / reference]. Figure 21 , Figure 21 This is a flowchart illustrating the workflow of nodes in a random number network. The execution flow of the execution node and the verification node includes:
[0263] S2110, Execute the node to detect random number generation events in the blockchain network.
[0264] The system detects the random number generation event triggered by the invocation of the random number contract, matches the local ID of the execution node with the execution node ID specified in the random number generation event, and if the match is successful, it captures the information in the random number generation event, including the specified random number generation execution node ID, the seed source execution node ID list, the number of verification nodes required before on-chain or the specified list of verification node IDs, and whether to use a node allocator. The number of verification nodes must be at least two, and the specified list of verification node IDs must include at least two specified verification node IDs. If the number of verification nodes is specified, it is necessary to specify whether to use a node allocator.
[0265] S2120. The execution node generates a random number based on the random number generation event and generates a verification request.
[0266] The execution node obtains random seeds from the execution nodes corresponding to the seed source execution node ID list in the random number generation event, and aggregates multiple random seeds into one seed according to the rules. It then uses this seed to generate random numbers. After the random numbers are generated, the execution node packages the random numbers, the number of verification nodes required before uploading to the chain or the specified list of verification node IDs, whether to use the node allocator, and the execution node ID to generate the execution result (i.e., the random number generation result), signs the execution result, and assembles it into a verification request consisting of the execution result and the execution node signature.
[0267] S2130, The execution node sends the verification request to the node allocator.
[0268] If the random number generation result specifies the required number of verification nodes, the execution node needs to check whether the node allocator field is used. If not, the execution node can directly randomly select verification nodes to send verification requests, but this process may involve collusion and malicious behavior, depending on whether the business can bear it. If the node allocator is used, the execution node can send the verification request to the node allocator.
[0269] If the random number generation result specifies a list of verification node IDs, the execution node can directly send a verification request to the verification nodes in the list of verification node IDs.
[0270] S2140. The node allocator selects a verification node from the verification node cluster that matches the number of verification nodes, and forwards the verification request to the verification node.
[0271] The node allocator randomly selects verification nodes from the verification node cluster that match the number of verification nodes.
[0272] S2150. The verification node generates a verification random number and verifies the result of the random number generation.
[0273] The verification node queries a random seed from the corresponding execution node based on the seed source node ID list, generates a verification random number based on the random seed, and matches the verification random number with the random number in the data generation result.
[0274] S2160. If the random number generation result is successfully verified, the verification node signs the random number generation result and sends the signature to the node allocator.
[0275] If the verified random number matches the random number in the data generation result exactly, the random number generation result is verified successfully. The random number generation result is then signed and sent to the node allocator to indicate approval.
[0276] Optionally, if the verification of the random number generation result fails, the verification node can send the failure feedback to the node allocator.
[0277] S2170. The node allocator collects the verification results of each verification node and returns the results to the execution node.
[0278] The node allocator collects the signatures of the verification nodes and sends the signatures of the verification nodes to the execution nodes.
[0279] S2180. The execution node receives enough signatures, constructs on-chain evidence based on the signatures of the verification node and the random number generation result, and sends it to the evidence contract in the blockchain network.
[0280] The execution node assembles the random number generation result, the verification node's signature, and the execution node's signature into on-chain evidence and sends it to the evidence contract.
[0281] S2190, the evidence contract stores the on-chain evidence and delivers the random number from the random number generation result to the random number contract.
[0282] Optionally, step Sa1 is also involved, whereby the execution node can pledge virtual resources to the virtual resource processor when joining the random number network. Further, step Sa2 is also involved, whereby the virtual resource processor can send the pledged virtual resources, the signature of the virtual resource processor, and the signature of the execution node to the virtual resource contract of the blockchain network, so that the virtual resource contract can be associated, on-chain, and stored.
[0283] Optionally, step Sb1 involves the verification node staking virtual resources with the virtual resource processor when joining the random number network. Further, step Sb2 involves the virtual resource processor sending the staked virtual resources, its signature, and the verification node's signature to the virtual resource contract on the blockchain network, so that the virtual resource contract is associated, on-chain, and stored.
[0284] If an execution node or verification node wants to leave the random number network, it can apply to the virtual resource processor to unstake its virtual resources. After a challenge period, it can retrieve the corresponding virtual resources from the evidence contract and return them to the execution node or verification node. In practical applications, the random number network will form a system where high-reputation, technically capable, and financially strong node service providers compete and check each other, resulting in decentralization and ultimately network stability.
[0285] This invention proposes a random number generation method based on a decentralized random number network and a blockchain network. The business needs to deploy a seed source service, a random number generation service, and a random number verification service in the random number network. Execution nodes detect random number generation events on the blockchain, obtain random seeds from execution nodes that have deployed the seed source service, generate random numbers based on the random number generation service, and submit them to the verification node's random number verification service for verification. After successful verification, the execution node delivers the data to the blockchain contract, thus completing the generation and acquisition of random numbers outside the blockchain. The entire process is guaranteed by the random number network for security, stability, and decentralization.
[0286] The apparatus embodiments described herein can be used to execute the blockchain-based random number generation method in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the above embodiments of the blockchain-based random number generation method of this application.
[0287] This application provides a blockchain-based random number generation device, such as... Figure 22 As shown, this blockchain-based random number generation device can be configured in an execution node, and the device includes:
[0288] The detection and determination module 2210 is used to detect the random number generation event triggered by the business party, generate random numbers according to the random number generation event, and obtain the random number generation result;
[0289] The result generation module 2220 is used to obtain a random seed from the determined second execution node, generate random numbers based on the obtained random seed, and obtain the random number generation result.
[0290] The generation and sending module 2230 is used to generate a verification request for the random number generation result based on the random number generation result, and send the verification request to the verification node so that the verification node can verify the random number generation result contained in the verification request.
[0291] The first receiving module 2240 is used to receive the signature triggered by the verification node when the verification of the random number generation result is successful;
[0292] The generation and sending module 2230 is also used to: generate on-chain evidence based on the signature of the verification node and the random number generation result, and send the on-chain evidence to the blockchain network so as to send the on-chain evidence to the business party through the blockchain network.
[0293] In one embodiment of this application, based on the aforementioned scheme, the random number generation event includes a node identifier of a first execution node for generating random numbers and a node identifier of at least one second execution node; the detection and determination module 2210 includes a determination unit, which is used to determine the corresponding second execution node based on the node identifier of at least one second execution node if the local node identifier matches the node identifier of the first execution node in the random number generation event; the result generation module 2220 is specifically used to generate a random number generation result based on the random number, the local node identifier, and the node identifier of at least one second execution node.
[0294] In one embodiment of this application, based on the aforementioned scheme, the random number generation event includes a list of verification nodes, which includes at least two specified verification node identifiers; the generation and sending module 2230 includes a sending unit, which is used to send the verification request to the verification node in the verification node cluster that matches the at least two specified verification node identifiers.
[0295] In one embodiment of this application, based on the aforementioned scheme, the random number generation event includes the number of verification nodes, and the number of verification nodes is at least two; the generation and sending module 2230 includes a sending unit, which is used to select a verification node from the verification node cluster that matches the number of verification nodes, and send the verification request to the selected verification node.
[0296] In one embodiment of this application, based on the aforementioned scheme, the random number generation event includes the number of verification nodes, and the number of verification nodes is at least two; the generation and sending module 2230 includes a sending unit, which is used to send the number of verification nodes and the verification request to the node allocator, so that the node allocator selects a verification node from the verification node cluster that matches the number of verification nodes, and forwards the verification request to the selected verification node.
[0297] In one embodiment of this application, based on the aforementioned scheme, the generation and sending module 2230 includes a generation unit. The generation unit is used to encapsulate the signature of the verification node and the random number generation result if the number of received signatures exceeds a preset number threshold, and to sign the encapsulated data to obtain on-chain evidence.
[0298] In one embodiment of this application, based on the foregoing scheme, the apparatus further includes a first deployment module. The first deployment module is used to receive a generation service deployment request sent by the service provider. The generation service deployment request carries a seed source service identifier, a random number generation service identifier, a list of execution node identifiers to be deployed corresponding to the seed source service identifier, and a list of execution node identifiers to be deployed corresponding to the random number generation service identifier. If the list of execution node identifiers to be deployed corresponding to the seed source service identifier contains a local node identifier, then the seed source service corresponding to the seed source service identifier is deployed. The seed source service is used to provide a random seed. If the list of execution node identifiers to be deployed corresponding to the random number generation service identifier contains a local node identifier, then the random number generation service corresponding to the random number generation service identifier is deployed. The random number generation service is used to generate random numbers based on the random seed.
[0299] In one embodiment of this application, based on the foregoing scheme, the device further includes a first staking module. The first staking module is used by the first deployment module to pledge virtual resources to the virtual resource processor when deploying at least one of the seed source service and the random number generation service, so that the virtual resource processor sends the pledged virtual resources to the blockchain network for storage. If it is necessary to cancel at least one of the deployed random number generation service and the deployed seed source service, the module applies to the virtual resource processor for the return of the pledged virtual resources, so that other execution nodes can challenge the execution process of at least one service locally. If other execution nodes fail to challenge successfully during the challenge period, the module receives the virtual resources returned by the virtual resource processor through the blockchain network.
[0300] In one embodiment of this application, based on the aforementioned scheme, the generation and sending module 2230 includes a sending unit. The sending unit is used to deploy an evidence contract in the blockchain network if no deployed evidence contract exists in the blockchain network; if a deployed evidence contract exists in the blockchain network, the on-chain evidence is sent to the evidence contract in the blockchain network so that the evidence contract stores the on-chain evidence and sends the on-chain evidence to the business party according to the callback information from the business party.
[0301] In one embodiment of this application, based on the aforementioned scheme, the generation and sending module 2230 includes a generation unit, which is used to sign the random number generation result and encapsulate the signature and the random number generation result to generate a verification request.
[0302] This application provides a blockchain-based random number verification device, such as... Figure 23 As shown, this blockchain-based random number verification device can be configured in a verification node, and the device includes:
[0303] The second receiving module 2310 is used to receive a verification request from the execution node. The verification request carries the random number generation result obtained by the execution node based on the generated random number. The random number is generated by the execution node after detecting the random number generation event triggered by the business party, determining the second execution node to provide the seed source based on the random number generation event, obtaining the random seed from the determined second execution node, and generating the random number based on the obtained random seed.
[0304] The verification module 2320 is used to verify the random number generation result contained in the verification request;
[0305] The signature module 2330 is used to sign the random number generation result if the verification of the random number generation result is successful.
[0306] The sending module 2340 is used to send the signature to the execution node, so that the execution node can generate on-chain evidence based on the signature and the random number generation result, and send the on-chain evidence to the business party through the blockchain network.
[0307] In one embodiment of this application, based on the aforementioned scheme, the second receiving module 2310 is specifically used to receive a verification request sent by the execution node; or to receive a verification request forwarded by the node allocator from the execution node. The verification request is forwarded by the node allocator after selecting the corresponding verification node based on the verification request received from the execution node.
[0308] In one embodiment of this application, based on the foregoing scheme, the device further includes a second deployment module, which is used to receive a verification service deployment request sent by the business party. The verification service deployment request carries a random number verification service identifier and a list of verification node identifiers to be deployed. If the list of verification node identifiers to be deployed includes a local node identifier, then the random number verification service corresponding to the random number verification service identifier is deployed. The random number verification service is used to verify the random number generation result contained in the verification request.
[0309] In one embodiment of this application, based on the aforementioned scheme, the device further includes a second staking module. The second staking module is used to stake virtual resources with the virtual resource processor when deploying a random number verification service corresponding to the random number verification service identifier, so that the virtual resource processor sends the staked virtual resources to the blockchain network for storage; if it is necessary to cancel the deployed random number verification service, it applies to the virtual resource processor for the return of the staked virtual resources, so that other verification nodes can challenge the execution process of the local data verification service; if the verification execution node fails to challenge successfully during the challenge period, it receives the virtual resources returned by the virtual resource processor through the blockchain network.
[0310] In one embodiment of this application, based on the aforementioned scheme, the verification module 2320 is specifically used to obtain a verification random number based on the verification request, and to verify the random number generation result contained in the verification request based on the verification random number.
[0311] It should be noted that the apparatus provided in the above embodiments and the method provided in the above embodiments belong to the same concept, and the specific way in which each module and unit performs operations has been described in detail in the method embodiments, and will not be repeated here.
[0312] Embodiments of this application also provide an electronic device, including one or more processors and a storage device, wherein the storage device is used to store one or more computer programs, which, when executed by one or more processors, cause the electronic device to implement the blockchain-based random number generation method described above.
[0313] Figure 24 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0314] It should be noted that, Figure 24 The computer system 2400 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application, wherein the electronic device may be a terminal or a server.
[0315] like Figure 24 As shown, the computer system 2400 includes a central processing unit (CPU) 2401, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on a program stored in read-only memory (ROM) 2402 or a program loaded from storage portion 2408 into random access memory (RAM) 2403. The RAM 2403 also stores various programs and data required for system operation. The CPU 2401, ROM 2402, and RAM 2403 are interconnected via a bus 2404. An input / output (I / O) interface 2405 is also connected to the bus 2404.
[0316] In some embodiments, the following components are connected to the I / O interface 2405: an input section 2406 including a keyboard, mouse, etc.; an output section 2407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 2408 including a hard disk, etc.; and a communication section 2409 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 2409 performs communication processing via a network such as the Internet. A drive 2410 is also connected to the I / O interface 2405 as needed. A removable medium 2411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 2410 as needed so that computer programs read from it can be installed into the storage section 2408 as needed.
[0317] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 2409, and / or installed from removable medium 2411. When the computer program is executed by processor (CPU) 2401, it performs various functions defined in the system of this application.
[0318] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory, flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0319] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and a computer program.
[0320] The units or modules described in the embodiments of this application can be implemented in software or hardware, and can also be located in a processor. The names of these units or modules do not necessarily limit the specific unit or module itself.
[0321] Another aspect of this application provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the method described above. This computer-readable storage medium may be included in the electronic device described in the above embodiments, or it may exist independently and not assembled into the electronic device.
[0322] Another aspect of this application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer program from the computer-readable storage medium and executes the computer program, causing the electronic device to perform the methods described above in the various embodiments.
[0323] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0324] Other embodiments of this application will readily conceive of by considering the specification and practicing the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0325] The above content is merely a preferred exemplary embodiment of this application and is not intended to limit the implementation of this application. Those skilled in the art can easily make corresponding modifications or alterations based on the main concept and spirit of this application. Therefore, the scope of protection of this application should be determined by the scope of protection claimed in the claims.
Claims
1. A method for generating random numbers based on blockchain, characterized in that, An execution node applied in a decentralized random number network that communicates with a blockchain network, the method comprising: Subscribe to events on the blockchain network to obtain information from event records. These event records are generated on the blockchain network after the business party triggers a business contract and the business contract calls a random number contract. The information in the event records includes a second execution node identifier for providing a seed source and a first execution node identifier for generating random numbers. Detect the random number generation event triggered by the invocation of the random number contract, and capture the verification node information of the verification nodes in the random number generation event. The verification node information includes the number of verification nodes or a list of verification nodes with specified verification node identifiers. If the local execution node identifier is detected to match the first execution node identifier in the event record, then the second execution node identifier is obtained from the event record; Obtain a random seed from the second execution node corresponding to the second execution node identifier, generate a random number based on the obtained random seed, and generate a random number generation result based on the random number, the local execution node identifier, and the second execution node identifier; A verification request is generated based on the random number generation result, and the verification request is sent to the verification node corresponding to the verification node information, so that the verification node can verify the random number generation result contained in the verification request. Receive the signature triggered by the verification node when the random number generation result is successfully verified; Based on the signature of the verification node and the random number generation result, on-chain evidence is generated and sent to the blockchain network so that the on-chain evidence can be sent to the business party through the blockchain network.
2. The method according to claim 1, characterized in that, The list of verification nodes includes at least two specified verification node identifiers; sending the verification request to the verification node includes: The verification request is sent to the verification node in the node cluster that matches the identifiers of the at least two specified verification nodes.
3. The method according to claim 1, characterized in that, The number of verification nodes is at least two; sending the verification request to the verification nodes includes: Select a verification node from the verification node cluster that matches the number of verification nodes, and send the verification request to the selected verification node.
4. The method according to claim 1, characterized in that, The number of verification nodes is at least two; sending the verification request to the verification nodes includes: The number of verification nodes and the verification request are sent to the node allocator, so that the node allocator selects a verification node from the verification node cluster that matches the number of verification nodes, and forwards the verification request to the selected verification node.
5. The method according to claim 1, characterized in that, The step of generating on-chain evidence based on the signature of the verification node and the random number generation result includes: If the number of received signatures exceeds a preset threshold, the signature of the verification node and the random number generation result are encapsulated, and the encapsulated data is signed to obtain the on-chain evidence.
6. The method according to claim 1, characterized in that, The method further includes: Receive the generation service deployment request sent by the business party. The generation service deployment request carries a seed source service identifier, a random number generation service identifier, a list of execution node identifiers to be deployed corresponding to the seed source service identifier, and a list of execution node identifiers to be deployed corresponding to the random number generation service identifier. If the list of execution node identifiers to be deployed corresponding to the seed source service identifier contains a local node identifier, then the seed source service corresponding to the seed source service identifier is deployed; wherein, the seed source service is used to provide random seeds; If the list of execution node identifiers to be deployed corresponding to the random number generation service identifier contains a local node identifier, then the random number generation service corresponding to the random number generation service identifier is deployed; wherein, the random number generation service is used to generate random numbers based on a random seed.
7. The method according to claim 6, characterized in that, The method further includes: When deploying at least one of the seed source service and the random number generation service, virtual resources are pledged to the virtual resource processor so that the virtual resource processor sends the pledged virtual resources to the blockchain network for storage. If it is necessary to cancel at least one of the deployed random number generation service and the deployed seed source service, then apply to the virtual resource processor for the return of the pledged virtual resources so that other execution nodes can challenge the execution process of the at least one service locally. If other execution nodes fail to complete the challenge during the challenge period, the virtual resources will be returned by the virtual resource processor through the blockchain network.
8. The method according to claim 1, characterized in that, Sending the on-chain evidence to the blockchain network includes: If no deployed evidence contract exists in the blockchain network, then deploy the evidence contract in the blockchain network. If a deployed evidence contract exists in the blockchain network, the on-chain evidence is sent to the evidence contract in the blockchain network so that the evidence contract stores the on-chain evidence and sends the on-chain evidence to the business party according to the callback information of the business party.
9. The method according to any one of claims 1 to 8, characterized in that, The step of generating a verification request for the random number generation result includes: The random number generation result is signed, and the signature and the random number generation result are encapsulated to generate the verification request.
10. A method for generating random numbers based on blockchain, characterized in that, The method, applied to verification nodes in a decentralized random number network that communicates with a blockchain network, includes: The system receives a verification request from an execution node. This request carries the result of a random number generation by the execution node based on a generated random number, a local execution node identifier, and a second execution node identifier. The random number is generated by the execution node subscribing to events on the blockchain network to obtain information from event records. The system detects random number generation events triggered by the invocation of a random number contract, captures the verification node information of the verification nodes in the random number generation event, and if the local execution node identifier matches the first execution node identifier in the event record, it retrieves the second execution node identifier from the event record, obtains a random seed from the second execution node corresponding to the second execution node identifier, and generates the random number based on the obtained random seed. The event record is generated on the blockchain network after the business party triggers a business contract and the business contract invokes the random number contract. The information in the event record includes a second execution node identifier for providing the seed source, a first execution node identifier for generating the random number, and the verification node information includes the number of verification nodes or a list of verification nodes specifying verification node identifiers. Verify the random number generation result contained in the verification request; If the random number generation result is successfully verified, then the random number generation result is signed; The signature is sent to the execution node, so that the execution node generates on-chain evidence based on the signature and the random number generation result, and sends the on-chain evidence to the business party through the blockchain network.
11. The method according to claim 10, characterized in that, Receiving a verification request from the execution node includes: Receive the verification request sent by the execution node; or The receiving node allocator forwards a verification request from the execution node. The verification request is forwarded by the node allocator after selecting the corresponding verification node based on the verification request received from the execution node.
12. The method according to claim 10, characterized in that, The method further includes: Receive a verification service deployment request sent by the business party, wherein the verification service deployment request carries a random number verification service identifier and a list of verification node identifiers to be deployed; If the list of verification node identifiers to be deployed contains a local node identifier, then a random number verification service corresponding to the random number verification service identifier is deployed; wherein, the random number verification service is used to verify the random number generation result contained in the verification request.
13. The method according to claim 12, characterized in that, The method further includes: When deploying the random number verification service corresponding to the random number verification service identifier, virtual resources are pledged to the virtual resource processor so that the virtual resource processor sends the pledged virtual resources to the blockchain network for storage. If it is necessary to cancel the deployed random number verification service, apply to the virtual resource processor for the return of the pledged virtual resources so that other verification nodes can challenge the execution process of the local data verification service. If the verification execution node fails to complete the challenge during the challenge period, the virtual resources will be returned by the virtual resource processor through the blockchain network.
14. The method according to any one of claims 10 to 13, characterized in that, The verification of the random number generation result contained in the verification request includes: A verification random number is obtained based on the verification request, and the random number generation result contained in the verification request is verified based on the verification random number.
15. A random number generation device based on a blockchain network, characterized in that, The device is deployed as an execution node in a decentralized random number network that communicates with a blockchain network, including: The detection and determination module is used to subscribe to events on the blockchain network to obtain information from event records. These event records are generated on the blockchain network after a business party triggers a business contract and the business contract calls a random number contract. The information in the event records includes a second execution node identifier for providing a seed source and a first execution node identifier for generating random numbers. The module detects random number generation events triggered by the invocation of the random number contract, and captures verification node information from the verification nodes in the random number generation events. This verification node information includes the number of verification nodes or a list of verification nodes with specified verification node identifiers. If a local execution node identifier is detected to match the first execution node identifier in the event records, the second execution node identifier is obtained from the event records. The result generation module is used to obtain a random seed from the second execution node corresponding to the second execution node identifier, and generate a random number generation result based on the random number, the local execution node identifier, and the second execution node identifier; The generation and sending module is used to generate a verification request for the random number generation result based on the random number generation result, and send the verification request to the verification node corresponding to the verification node information, so that the verification node can verify the random number generation result contained in the verification request; The first receiving module is used to receive the signature triggered by the verification node when the verification of the random number generation result is successful; The generation and sending module is further configured to: generate on-chain evidence based on the signature of the verification node and the random number generation result, and send the on-chain evidence to the blockchain network so as to send the on-chain evidence to the business party through the blockchain network.
16. A random number verification device based on a blockchain network, characterized in that, The device is deployed as a verification node in a decentralized random number network that communicates with a blockchain network, including: The second receiving module is used to receive a verification request from the execution node. The verification request carries the random number generation result obtained by the execution node based on the generated random number, the local execution node identifier, and the second execution node identifier. The random number is generated by the execution node subscribing to events on the blockchain network to obtain information from event records, detecting random number generation events triggered by the invocation of the random number contract, and capturing the verification node information of the verification node in the random number generation event. If the local execution node identifier is detected to match the first execution node identifier in the event record, the second execution node identifier is obtained from the event record, a random seed is obtained from the second execution node corresponding to the second execution node identifier, and the random number is generated based on the obtained random seed. The event record is generated on the blockchain network after the business party triggers the business contract and the business contract calls the random number contract. The information in the event record includes the second execution node identifier used to provide the seed source, the first execution node identifier used to generate the random number, and the verification node information includes the number of verification nodes or a list of verification nodes with specified verification node identifiers. The verification module is used to verify the random number generation result contained in the verification request; The signature module is used to sign the random number generation result if the verification of the random number generation result is successful. The sending module is used to send the signature to the execution node, so that the execution node can generate on-chain evidence based on the signature and the random number generation result, and send the on-chain evidence to the business party through the blockchain network.
17. An electronic device, characterized in that, include: One or more processors; A storage device for storing one or more computer programs, which, when executed by the one or more processors, cause the electronic device to perform the method of any one of claims 1 to 9, or the method of any one of claims 10 to 14.
18. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by the processor of the electronic device, causes the electronic device to perform the method described in any one of claims 1 to 9, or the method described in any one of claims 10 to 14.
19. A computer program product, characterized in that, The computer program product includes a computer program stored in a computer-readable storage medium, wherein a processor of an electronic device reads from and executes the computer program, causing the electronic device to perform the method of any one of claims 1 to 9, or to perform the method of any one of claims 10 to 14.
Citation Information
Patent Citations
Random number generation method and device and storage medium
CN110213059A
Communication node, method of operating thereof and collaborative system
US20210258152A1