Random number generation method and device, storage medium for blockchain network service platform

By using private keys to decrypt and integrate encrypted seed parameters in the blockchain network and transmitting target seed parameters, the problem of low efficiency in generating random numbers on the chain is solved, and more efficient random number generation is achieved and bribery behavior is prevented by attacking nodes.

CN115694802BActive Publication Date: 2025-02-25WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211287462.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-20
Publication Date
2025-02-25
Estimated Expiration
2042-10-20

AI Technical Summary

Technical Problem

The random number generation mechanism on the chain in the blockchain network is inefficient, especially when attacking nodes bribe packaged nodes, resulting in a decrease in the delay and efficiency of random number generation.

Method used

When the seed generation node monitors the target block carrying the first random number seed value on the chain, the private key decrypts the fusion encrypted seed parameters, obtains the target seed parameters, and transmits them to the verification node to generate the random number. This method ensures that the seed generation node and the packaging node cannot predict the benefits of random number generation results by integrating the processing of encrypted seed parameters, and avoids only choosing favorable opportunities and seeds for packaging.

Benefits of technology

The generation efficiency of random numbers in the blockchain network is improved, and the attack nodes are prevented from delaying or reducing random number generation by bribing packaged nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115694802B_ABST
    Figure CN115694802B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a random number generation method and device, and a storage medium for a blockchain network service platform, including: when a seed generation node monitors that a target block carrying a first random number seed value is on the chain, using a private key to decrypt the fused encryption seed parameter in the target block to obtain the fused decryption seed parameter; the fused encryption seed parameter is a parameter obtained by the packaging node performing fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value; obtaining the block parameter of the target block; obtaining the target seed parameter based on the block parameter, the fused decryption seed parameter and the first transaction parameter of the first blockchain transaction carried in the target block; the first blockchain transaction is a transaction generated based on the first random number seed value and broadcast to the packaging node; transmitting the target seed parameter to the verification node so that the verification node generates a target random number based on the target seed parameter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a random number generation method and device, and a storage medium for a blockchain network service platform. Background Art

[0002] Generating random numbers is a common requirement on a type of blockchain, such as sampling according to a certain probability distribution in a statistical total sample, which requires a reliable random number generation mechanism. Since the blockchain itself does not have enough entropy, it is not possible to directly generate random number seeds on the blockchain. Therefore, it is necessary to use an external data source to generate random number seeds. There are currently three main types of on-chain random number generation mechanisms: VRF (verifiable random function), threshold signature mechanism, and distributed CR (Commit-Reveal).

[0003] The on-chain random number generation mechanism in the related technology is to first generate a random number seed, then broadcast the random number seed, and use the packaging node to package the random number seed, and finally generate a random number based on the random number seed. When the packaging node in the blockchain does evil, that is, some attacking nodes bribe the packaging node, the packaging node will only choose the time and random number seed that are favorable to itself for packaging, resulting in the failure to generate random numbers according to the random number seed in time, thereby reducing the efficiency of random number generation. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present application hope to provide a random number generation method and device, and a storage medium for a blockchain network service platform, which can improve the efficiency of random number generation.

[0005] The technical solution of this application is implemented as follows:

[0006] The present application provides a random number generation method for a blockchain network service platform, the method comprising:

[0007] When the seed generation node detects that the target block carrying the first random number seed value is on the chain, the fusion encryption seed parameter in the target block is decrypted using the private key to obtain the fusion decryption seed parameter; the fusion encryption seed parameter is a parameter obtained by the packaging node through fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value;

[0008] Obtaining block parameters of the target block;

[0009] Obtaining a target seed parameter according to the block parameter, the fused decryption seed parameter, and the first transaction parameter of the first blockchain transaction carried in the target block; the first blockchain transaction is a transaction generated according to the first random number seed value and broadcast to the packaging node;

[0010] The target seed parameter is transmitted to the verification node so that the verification node generates a target random number according to the target seed parameter.

[0011] An embodiment of the present application provides a blockchain network service platform, which is used to, when a seed generation node monitors that a target block carrying a first random number seed value is on the chain, use a private key to decrypt the fused encryption seed parameter in the target block to obtain a fused decryption seed parameter; the fused encryption seed parameter is a parameter obtained by the packaging node through fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value; obtain the block parameter of the target block; obtain the target seed parameter based on the block parameter, the fused decryption seed parameter and the first transaction parameter of the first blockchain transaction carried in the target block; the first blockchain transaction is a transaction generated based on the first random number seed value and broadcast to the packaging node; transmit the target seed parameter to the verification node so that the verification node generates a target random number based on the target seed parameter.

[0012] The present application embodiment provides a blockchain network service platform, and the blockchain network service platform includes:

[0013] at least one memory for storing executable instructions;

[0014] At least one processor is used to execute the executable instructions stored in the at least one memory to implement the random number generation method of the blockchain network service platform as described above.

[0015] An embodiment of the present application provides a storage medium storing executable instructions, which, when executed, are used to cause a processor to execute a random number generation method such as the above-mentioned blockchain network service platform.

[0016] The embodiments of the present application provide a random number generation method and device, and a storage medium for a blockchain network service platform. The random number generation method for the blockchain network service platform includes: when a seed generation node monitors that a target block carrying a first random number seed value is on the chain, using a private key to decrypt the fused encryption seed parameter in the target block to obtain a fused decryption seed parameter; the fused encryption seed parameter is a parameter obtained by the packaging node through fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value; obtaining the block parameter of the target block; obtaining the target seed parameter based on the block parameter, the fused decryption seed parameter and the first transaction parameter of the first blockchain transaction carried in the target block; the first blockchain transaction is a transaction generated based on the first random number seed value and broadcast to the packaging node; transmitting the target seed parameter to the verification node so that the verification node generates a target random number based on the target seed parameter. By adopting the above method to implement the scheme, the blockchain network service platform uses the seed generation node to generate the first random number seed value, uses the packaging node to generate the second random number seed value, and obtains the fused encryption seed parameter according to the first random number seed value and the second random number seed value, so that the seed generation node will not know the second random number seed value generated by the packaging node before the random number seed is put on the chain, nor can it know the block parameters of the target block. The packaging node cannot know the private key of the seed generator, that is, the seed generation node and the packaging node cannot determine whether the result used to generate the random number is beneficial to themselves before the random number seed is put on the chain, so that the node cannot only choose the time and random number seed that are beneficial to themselves for packaging, that is, the efficiency of random number generation is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A schematic diagram of the functional architecture of the blockchain network service platform provided in the embodiment of the present application;

[0018] Figure 2 The resource layer provided in the embodiment of the present application is constructed as a schematic diagram of the structure of a container cluster 200 by deploying a containerized management system;

[0019] Figure 3 A schematic diagram of a developer accessing a blockchain network service platform 100 through a terminal 300 provided in an embodiment of the present application;

[0020] FIG. 4A to FIG. 4Q It is a display schematic diagram of various function management pages of the blockchain network service platform provided in the embodiment of the present application;

[0021] Figure 5 A schematic diagram of the structure of an exemplary blockchain network deployed using a blockchain network service platform provided in an embodiment of the present application;

[0022] Figure 6An exemplary flowchart of using a blockchain network service platform to conduct transactions provided in an embodiment of the present application;

[0023] Figure 7 A flowchart of a random number generation method for a blockchain network service platform provided in an embodiment of the present application;

[0024] Figure 8 A schematic diagram of a random number generation method for an exemplary blockchain network service platform provided in an embodiment of the present application;

[0025] Fig. 9 A schematic diagram of the structure of a blockchain network service platform provided in an embodiment of the present application. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.

[0027] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following interpretations.

[0028] 1) Block: A data structure that records the updated ledger data of an exchange within a period of time. It is marked with a timestamp and a unique mark of the previous block (such as a digital fingerprint). After the block is verified by the consensus of the nodes in the blockchain network, it will be appended to the end of the blockchain to become a new block.

[0029] 2) Blockchain: A chain data structure composed of blocks connected in sequence. Each block references the hash value of the previous block or its subset, thereby ensuring that the recorded transactions cannot be tampered with or forged in a cryptographic way.

[0030] 3) Ledger: The sum of data recorded in the blockchain network in the account dimension, including elements such as ledger data, ledger status, ledger status proof and block index.

[0031] 4) Consensus is a process in the blockchain network used to reach agreement on transaction results among multiple nodes involved. The mechanisms for achieving consensus include Proof of Work (PoW), Proof of Stake (PoS), Delegated Proof-of-Stake (DPoS), Proof of Elapsed Time (PoET), etc.

[0032] 5) Smart Contracts, also known as chaincode, are program chains deployed in the blockchain network that are triggered and executed according to conditions. They run in a secure container to initialize and manage ledger data and ledger status.

[0033] The following describes an exemplary functional architecture of a blockchain network implementing an embodiment of the present invention. Figure 1 , Figure 1 The functional architecture diagram of the blockchain network provided by an embodiment of the present invention includes an application layer 101, a consensus layer 102, a network layer 103, a data layer 104 and a resource layer 105, which are described below respectively.

[0034] The resource layer 105 encapsulates various available computing resources and storage resources, such as computing resources and storage resources in computers, servers / clusters, and clouds, abstracts them, and provides a unified interface to the data layer 104 to shield the differences in the underlying hardware that implements the resource layer 105 .

[0035] Computing resources include various forms of processors, such as central processing units (CPUs), application specific integrated circuits (ASICs), application specific integrated circuits, and various forms of processors such as field-programmable gate arrays (FPGAs).

[0036] Storage resources include various types of storage media such as various volatile memories and non-volatile memories. Among them, non-volatile memories can be read-only memories (ROM) and programmable read-only memories (PROM). Volatile memories can be random access memories (RAM), which are used as external cache.

[0037] The computing resources and storage resources of the resource layer 105 can be mapped to various types of nodes in the blockchain network. The storage medium implementing the embodiment of the present invention stores executable instructions for implementing the blockchain network deployment method of the embodiment of the present invention. Once the executable instructions deployed to the node are executed, the underlying resources of the node (such as various types of processors) will realize the deployment of various types of nodes in the blockchain network and execute the functions of various types of nodes, thereby realizing the ledger for transactions in the business process and various applications based on the ledger.

[0038] As an example, executable instructions may be in the form of software (including system programs and applications), software modules, scripts, plug-ins, etc., written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, or other unit suitable for use in a computing environment.

[0039] The data layer 104 encapsulates various data structures for implementing the ledger, including ledger data implemented in the file system, and ledger status and existence proof implemented in the form of a database.

[0040] The network layer 103 encapsulates the peer-to-peer (P2P) network protocol, data transmission mechanism and data verification mechanism, access and authentication mechanism and business subject identity. The P2P network protocol realizes the communication between nodes in the blockchain network, the data transmission mechanism ensures the transmission of transactions / transaction results in the blockchain network, the data verification mechanism is used to realize the reliability of data transmission between nodes based on cryptographic methods (such as digital certificates, digital signatures, public / private key pairs); the access and authentication mechanism is used to manage the access and authentication of terminals based on the business subject identity.

[0041] The consensus layer 102 encapsulates the mechanism for reaching consistency in the transaction results propagated in the blockchain, including POS, POW and DPOS, and supports the pluggability of the consensus mechanism.

[0042] The application layer 101 encapsulates various services that can be implemented in the blockchain network, including transaction settlement, traceability, and evidence storage.

[0043] See also Figure 2 , is a schematic diagram of the structure of a resource layer provided by an embodiment of the present invention being constructed as a container cluster 200 by deploying a containerized management system. In the machine that provides resources to the resource layer, two types of nodes, namely, a management node (Master Server) 200 and a service node 300 (Node), are formed by deploying corresponding components of the containerized management system. The management node is used to manage the scheduling and operation of the container in the service node. The service node is mainly used to run various containers and provide an isolated operating environment for various applications in the blockchain network, for example, a chain code container for running chain codes, a node container for running node (i.e., the code of various types of nodes in the blockchain network) code, etc., which are explained below.

[0044] The management node (Master Server) 200 is responsible for managing the cluster and providing external access to cluster resource data in the form of a service. The management node includes several exemplary components.

[0045] 1) State component (etcd), used to save the state of the entire cluster.

[0046] 2) Application Programming Interface Service (API Server) component, which provides a unique entry point for resource operations and provides mechanisms such as authentication, authorization, access control, API registration and discovery.

[0047] 3) Scheduler component, responsible for resource scheduling, and scheduling containers to run on appropriate nodes according to the predetermined scheduling strategy. The container group (Pod) of the same set of resources in the shared machine (that is, the machine where the service node component is deployed) in the container running the service node is the smallest unit of call. For the application of the blockchain network, it can be implemented through one or more container groups. The resources shared by the containers in the container group include: application namespace, network namespace, host name and storage volume.

[0048] Taking shared storage volumes as an example, when a shared file system component is deployed on a node, such as a network file system (NFS), a cluster file system ( GlusterFS ), ceph file system (Cephfs), the scheduling component can easily schedule (mount) the container group mounted on the storage volume to the storage volume of other machines (nodes).

[0049] 4) The Controller Manager component is responsible for monitoring / maintaining the status of the cluster. Through the interface provided by the application interface service component, it monitors the current status of each resource object in the entire cluster in real time. When various failures occur and cause the system status to change, it will be repaired to the expected state.

[0050] 5) Replication Controller (RC) component controls the running of a certain number of Pod replicas within a certain period of time; for example, if the number of running Pod replicas exceeds the set value, some Pod replicas will be shut down; if the number of Pod replicas is less than the set value, new Pod replicas will be created.

[0051] 6) The Deployment Controller component is used to manage and maintain the resource object in the container cluster - the Deployment object, associate the Deployment object with the replica controller, provide declarative updates for the container group and the replica controller in the Deployment object, and declare the target state of the container group and the replica controller, so that when the Deployment object is updated, the update of the replica controller and the container group is controlled.

[0052] The service node 300 includes the following exemplary components.

[0053] 1) Container engine (referred to as Docker), which is responsible for all specific image downloads and container operations.

[0054] 2) The daemon component (referred to as Kubelet) is responsible for maintaining the life cycle of the container (creation, start, and stop), and is also responsible for the management of storage volumes and container network interface (CNI).

[0055] Taking storage volume management as an example, the daemon component uses the shared file system components deployed in the node, such as the Network File System (NFS), the Cluster File System ( GlusterFS ), ceph file system (Cephfs), mounts each container in a container group to the same storage volume, so that each container uses the same storage volume to store the data generated during the operation process. The data in the storage volume can be accessed by any container in the same container group.

[0056] 3) The load balancing component (referred to as Proxy) is responsible for providing service discovery and load balancing within the cluster for the Service.

[0057] based on Figure 2 In the cluster shown, an exemplary process of deploying an application of a blockchain network, in which an image is encapsulated into a container group (referred to as a target Pod in the following example) and runs on a node (referred to as a target Node in the following example) is described as follows.

[0058] First, the management tool (Kubectl) of the container cluster 200 submits a request to create a replication controller (RC), which includes the definition of the target Pod; the number of replicas of the target Pod that need to run; the target Pod label (Lable) to be monitored and other information.

[0059] Next, the request is written to etcd through the API Server. At this time, the Controller Manager listens to the RC event through the API Server's resource change monitoring interface and finds that there is no corresponding Pod instance in the current cluster. Therefore, a Pod object is generated according to the Pod template definition in the RC and written to etcd through the API Server.

[0060] Next, the RC event is discovered by the Scheduler, which immediately executes a scheduling process: it selects a node for the new Pod to reside in, and then writes the result to etcd through the API Server. Subsequently, the Kubelet process running on the target Node monitors the new Pod through the API Server and starts the new Pod according to its definition until the Pod's life ends.

[0061] Subsequently, Kubectl submits a new Service creation request mapped to the target Pod. The ControllerManager queries the associated Pod instance through the Label, generates the Service endpoint information (including address and port), and writes it to etcd through the API Server. The Proxy process running on all Nodes in the container cluster queries and listens to the Service object and its corresponding Endpoints information through the API Server, and establishes a software load balancer to implement the traffic forwarding function of the Service accessing the backend Pod.

[0062] In combination with the above, it can be seen that the blockchain network service platform of the embodiment of the present invention is implemented by deploying a container cluster at the resource layer and running a container encapsulated with a blockchain network application. Therefore, the blockchain network implementing the embodiment of the present invention can be provided in the form of a memory and a processor, and executable instructions are stored in the memory. When the executable instructions are executed by the processor, a container cluster is established on multiple nodes running the processor and the memory. By running the encapsulated application in the container, the chain code installation method in the blockchain service network platform of the embodiment of the present invention is implemented.

[0063] The blockchain network platform implementing the embodiment of the present invention connects with developers in various ways and provides various graphical methods for deployment and management of the blockchain network, which are explained below.

[0064] See also Figure 3 , Figure 3 It is a schematic diagram of a developer accessing a blockchain network service platform 100 through a terminal 300 provided by an embodiment of the present invention. The SDK / Web 320 interface of the developer terminal 300 is connected to the SDE / Web interface corresponding to the data layer 104 in the blockchain network service platform 100, and supports remote deployment of a blockchain network supporting a specific business locally on the developer's terminal 300. The management pages of various functions of the blockchain network service platform 100 are displayed in the graphical interface 310 of the terminal 300, including the creation of container clusters and the access of new container clusters, the management of storage resources, one-click deployment of blockchain networks, chain code management (running status viewing), application store management, etc.

[0065] See also FIG. 4A to FIG. 4Q , is a schematic diagram showing various function management pages of the blockchain network service platform provided by an embodiment of the present invention, which will be combined with FIG. 4A to FIG. 4Q An example description is as follows Figure 3 The function management page is displayed in the graphical interface 310 of the developer terminal 300.

[0066] Figure 4A The status viewing page of the blockchain network service platform 100 is shown, in which the operating status of the blockchain network, such as CPU usage, memory usage, and resource (node) usage, is displayed.

[0067] Figure 4B The one-click deployment console page of the blockchain network service platform 100 is shown, which supports developers to set the basic information of the blockchain network (including block domain name, version number) and organization (including organization name, number of nodes, number of users, etc.), and use default values ​​to set advanced options, including sorting node type, channel name and chain code name, etc.

[0068] Figure 4C The resource management console page of the resource layer 105 of the blockchain network service platform 100 is shown, which displays relevant information of the cluster that the developer can deploy through the blockchain network service platform 100, including whether the connection status, CPU / memory usage, etc.

[0069] exist Figure 4D It supports adding a container cluster to support the blockchain network and entering the cluster name. After the function option of creating a cluster is triggered, the creation page will be entered.

[0070] exist Figure 4E The console page of the query cluster of the blockchain network service platform 100 is shown in the figure. When the function button of the query cluster is triggered, the cluster list page will be entered, which supports operations such as adding clusters, querying clusters, deleting clusters, and editing clusters.

[0071] exist Figure 4F The console page of storage management of the blockchain network service platform 100 is shown in the figure. When the function button of storage management is triggered, the storage management list page will be entered to display the storage projects created in the cluster, which includes storage query and deletion functions.

[0072] exist Figure 4G The console page of the storage details of the blockchain network service platform 100 is shown in Figure 4H The storage details are displayed and dynamic storage space expansion is supported.

[0073] exist Fig. 4I The console page for adding storage of the blockchain network service platform 100 is shown in FIG. 1 , which supports setting the name and node of the added storage, adding the node to the container cluster according to the setting, and Figure 4J The following table shows detailed information after adding storage, including a list of nodes in the container cluster.

[0074] exist Figure 4K The figure shows the console page of the hyperledger of the blockchain network service platform 100, which displays the name, network version, status and creation time of the hyperledger used to deploy the blockchain network.

[0075] exist Figure 4L The figure shows the one-click deployment console page of the hyperledger of the blockchain network service platform 100, which provides configuration items for basic information of the hyperledger deployment, as well as advanced configuration items with default values, such as sorting node type, channel, default chain code, and initialization parameters.

[0076] exist Figure 4M / N shows the console page for uploading / installing the chain code of the blockchain network service platform 100. The upload console page provides setting items for the chain code name and version number; the installation console page provides configuration items for the chain code version, initialization parameters, organization and node.

[0077] exist Fig.4O The console page of the network details of the blockchain network service platform 100 is shown in the figure, which supports viewing information such as the organization members, block height, number of transactions and number of contracts of different channels, and can also display information such as the organization name of the viewed channel, the node name in the channel, the chain code name in the channel, etc.

[0078] exist Figure 4P The console page for chain code query of the blockchain network service platform 100 is shown in the figure, which supports querying the chain code by using the network name, chain code name, chain code parameters, account book name and chain code function, and the query dimensions include status, message and data.

[0079] exist Figure 4Q The console page of the application store of the blockchain network service platform 100 is shown in the figure, which supports developers to select the applications that need to be deployed. Once an application is determined to be deployed to the blockchain network, it will be quickly deployed to the container cluster of the resource layer 105 by reusing the application's image.

[0080] See also Figure 5, is an exemplary structure of a blockchain network deployed using a blockchain network service platform. The application obtains a legitimate identity certificate from the CA to join the application channel in the network. Before initiating a formal transaction, it is necessary to construct a transaction proposal (Proposal) and submit it to the endorsement nodes in Organization 1 and Organization 2 for endorsement; after the client collects enough endorsement support (the number is determined by the endorsement policy), it can use the endorsement to construct a legitimate transaction request (carrying the endorsement of the endorsement node) and send it to the sorting node (Orderer) in the sorting service for sorting, so as to encapsulate the transaction into a block.

[0081] See also Figure 6 , which is the transaction process between the application and the blockchain network. The functions of the client and each node in the transaction process are as follows:

[0082] Client (application): Use SDK to interact with the blockchain network. First, the client obtains a legitimate identity certificate from the CA to join the application channel in the network. Before initiating a formal transaction, it is necessary to construct a transaction proposal (Proposal) and submit it to the endorsement node for endorsement; after the client collects enough endorsement support (the number is determined by the endorsement policy), it can use the endorsement to construct a legitimate transaction request (carrying the endorsement of the endorsement node) and send it to the sorting node (Orderer) for sorting, so as to encapsulate the transaction into a block. The client can also monitor the messages in the network through the event mechanism to know whether the transaction has been successfully received.

[0083] Endorser: Mainly provides methods for clients to call to complete the endorsement (signature) processing of transaction proposals. After receiving a transaction proposal from a client, first perform a legitimacy and ACL permission check. If the check passes, simulate the transaction (the chain code name and parameters to be executed will be executed in the transaction. Executing the transaction is essentially executing the chain code specified in the transaction), endorse the state changes caused by the transaction (recorded in the form of a read-write set, including the key and version of the read state, and the key value of the written state) (that is, digitally sign) and return the result of whether the client supports it.

[0084] Orderer: Receives transactions containing endorsement signatures, sorts unpackaged transactions to generate blocks, and broadcasts them to Peer nodes.

[0085] Leader Peer: A node that communicates with the sorting node and is responsible for obtaining the latest blocks from the sorting node and synchronizing them within the blockchain network.

[0086] Committer: Maintains the structure of the blockchain and ledger (including state DB, history DB, index DB, etc.). The node will periodically obtain the sorted batch transaction block structure from the sorting node and check these transactions (including transaction message structure, signature integrity, duplication, read and write set version matching, etc.). After the check is passed, the legal transaction is executed, the result is written into the ledger, and a new block is constructed.

[0087] It should be noted that all peer nodes are accounting nodes, responsible for verifying transactions from the sorting node blocks, maintaining state data and copies of the ledger. Some peer nodes will execute transactions and sign and endorse the results, acting as endorsement nodes. Endorsement nodes are dynamic roles that are bound to specific chain codes. Each chain code in the chain code container will set an endorsement policy when it is instantiated, specifying which nodes will be valid after endorsing the transaction. It is only an endorsement node when the application initiates a transaction endorsement request to it. Otherwise, it is an ordinary accounting node, responsible only for verifying transactions and accounting.

[0088] Embodiment 1

[0089] The present application embodiment provides a random number generation method for a blockchain network service platform. Figure 7 A random number generation method process of a blockchain network service platform provided in an embodiment of the present application Figure 1 ,like Figure 7 As shown, the random number generation method may include:

[0090] S101. When the seed generation node detects that a target block carrying a first random number seed value is on the chain, the fusion encryption seed parameter in the target block is decrypted using a private key to obtain a fusion decryption seed parameter; the fusion encryption seed parameter is a parameter obtained by the packaging node through fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value.

[0091] A random number generation method provided in an embodiment of the present application is suitable for scenarios in which random numbers are generated.

[0092] In an embodiment of the present application, the fused encryption seed parameter is a parameter obtained by the packing node by performing fusion encryption processing on the generated second random number seed value and the received encrypted first random number seed value.

[0093] In the embodiment of the present application, the first random number seed value is a seed value generated by the seed generation node. It should be noted that the seed generation node may generate the first random number seed value upon receiving a random number seed generation instruction; the seed generation node may also generate the first random number seed value within a preset time period; the specific situation in which the seed generation node generates the first random number seed value may be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0094] It should be noted that the seed generation node can generate the first random number seed value by using an open source pseudo-random algorithm; it can also generate the first random number seed value by other methods; the specific method of generating the first random number seed value can be determined according to actual conditions, and the embodiments of the present application do not limit this.

[0095] It is determined based on actual conditions and is not limited in this embodiment of the present application.

[0096] In the embodiment of the present application, the seed generation node is a node in the blockchain, and specifically, the seed generation node is a node in the target blockchain. The seed generation node is used to generate a random number seed value.

[0097] In an embodiment of the present application, after the seed generation node generates the first blockchain transaction according to the first random number seed value and broadcasts the first blockchain transaction carrying the first random number seed value to the packaging node, the seed generation node begins to monitor whether there is a new block on the target blockchain, and detects whether the first random number seed value exists in the new block. If the first random number seed value exists in the new block, the seed generation node has detected that the target block is on the chain.

[0098] In the embodiment of the present application, the private key is also generated by the seed generation node. When the seed generation node generates the first random number seed value, the seed generation node also generates a pair of asymmetric encryption public key and private key pair.

[0099] In the embodiment of the present application, the fusion encryption seed parameter is a parameter obtained by encrypting the fusion decryption seed parameter using a public key, that is, the fusion decryption seed parameter is plain text, and the fusion encryption seed parameter is cipher text.

[0100] In an embodiment of the present application, when the seed generation node detects that a target block carrying a first random number seed value is on the chain, the fusion encryption seed parameter in the target block is decrypted using a private key. Before obtaining the fusion decryption seed parameter, the seed generation node will also generate a first random number seed value; and create a private key and a public key; encrypt the first random number seed value using a preset hash processing method and a public key to obtain a first encryption seed parameter; determine a packing parameter range for packing the first encryption seed parameter; generate a first blockchain transaction based on the packing parameter range, the first encryption seed parameter and the public key; broadcast the first blockchain transaction to the packaging node so that the packaging node can obtain the fusion decryption seed parameter based on the first blockchain transaction, and pack the fusion decryption seed parameter into the target block, and chain the target block to the target blockchain.

[0101] It should be noted that the public key and the private key are a pair of asymmetric encryption keys.

[0102] In an embodiment of the present application, the preset hash processing method can be a sha256 hash processing method; the preset hash processing method can also be a sha1; the preset hash processing method can also be an MD5 hash processing method; the specific preset hash processing method can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0103] In the embodiment of the present application, the first random number seed value is plain text, and the first encryption seed parameter is cipher text.

[0104] In the embodiment of the present application, the packaging parameter range includes a packaging block high threshold and at least one packaging node. Specifically, the seed generation node can determine the packaging parameter range by determining the service type to which the first encryption seed parameter belongs for the seed generation node, and determining the corresponding packaging parameter range according to the service type; the seed generation node can also determine the packaging parameter range according to the packaging quality of the packaging node; the seed generation node can also determine the packaging parameter range in other ways; the specific seed generation node can determine the packaging parameter range according to the actual situation, and the embodiment of the present application does not limit this.

[0105] It should be noted that the high threshold of the packaging block is the latest block height before which the first encryption seed parameter should be packaged on the chain, that is, the latest packaging block height deadline for the first encryption seed parameter, that is, the start time of the life cycle of the first random number seed value. At least one packaging node can be a whitelist of packaging nodes, and the whitelist includes the node information (such as node ID) of the blockchain consensus node selected by the seed generation node that can perform the packaging task.

[0106] It should be noted that the process in which the seed generation node determines the corresponding packing parameter range according to the business type to which the first encryption seed parameter belongs can determine the packing node associated with the business for the seed generation node, and determine the corresponding packing parameter range based on the packing node.

[0107] In an embodiment of the present application, the method in which the seed generation node broadcasts the first blockchain transaction to the packaging node is a prior art method; the specific embodiment of the present application is not limited.

[0108] In an embodiment of the present application, the process of the seed generation node broadcasting the first blockchain transaction to the packaging node can be that the seed generation node broadcasts the first blockchain transaction to the transaction pool of the packaging node for the packager to perform candidate packaging.

[0109] It should be noted that the first blockchain transaction may be tx1, and the Hash of tx1 is tx1Hash. Among them, tx1Hash is automatically generated when the blockchain creates a transaction. The first blockchain transaction carries tx1Hash information.

[0110] In an embodiment of the present application, the seed generation node uses a preset hash processing method and a public key to encrypt the first random number seed value to obtain a first encrypted seed parameter, including: processing the first random number seed value using the preset hash processing method to obtain a second hash parameter; encrypting the second hash parameter using the public key to obtain the first encrypted seed parameter.

[0111] In an embodiment of the present application, the seed generation node uses a preset hash processing method to process the first random number seed value to obtain a second hash parameter. The seed generation node can use a preset hash processing method to generate a hash value of the first random number seed value to obtain the second hash parameter.

[0112] For example, if the first random number seed value is G and the preset hash processing method is sha256, the sha256 hash generation algorithm is used to generate the hash value G of G. hash , that is, the G hash Is the second hash parameter.

[0113] In an embodiment of the present application, the seed generation node uses a public key to encrypt the second hash parameter to obtain the first encrypted seed parameter. The seed generation node can use a preset encryption algorithm to asymmetrically encrypt the second hash parameter using the public key to obtain the first encrypted seed parameter.

[0114] For example, G pub is the public key, G hashis the second Hash parameter, the preset encryption algorithm may be Encrypt is an asymmetric encryption function, and the preset encryption algorithm is used to asymmetrically encrypt the second Hash parameter using the public key to obtain the first encryption seed parameter G ENC The method is shown in formula (1):

[0115] G ENC =Encrypt(G hash ,G pub ) (1)

[0116] It should be noted that the preset encryption algorithm needs to meet the following conditions: the operation on the encrypted ciphertext needs to be numerically equal to the operation on the plaintext before encryption. The operation methods of the plaintext and the ciphertext can be different. The specific expression is shown in formula (2):

[0117]

[0118] in, is the operation operator (i.e., operation method). The operation methods of plaintext and ciphertext can be different or the same, and each Encrypt corresponds to a Decrypt as its inverse operation, which can decrypt the ciphertext into plaintext.

[0119] Exemplary, plaintext and ciphertext operation operators (operation methods) They can all be multiplications, such as: Encrypt is the e-th power of the plaintext, and Decrypt is the e-logarithm of the ciphertext; it is easy to see that this combination must satisfy formula (3)-formula (4):

[0120] Encrypt(A)=A e , Decrypt(Encrypt(A))=A (3)

[0121] Encrypt(A×B)=AB e =A e B e =Encrypt(A)×Encrypt(B) (4)

[0122] Exemplarily, the preset encryption algorithm may also be Encrypt(A)=g A r A N The encryption algorithm can be determined based on actual conditions and is not limited in the embodiments of the present application.

[0123] In an embodiment of the present application, the process of a seed generation node generating a first blockchain transaction according to a packaging parameter range, a first encrypted seed parameter and a public key includes: the seed generation node generates an initial blockchain transaction according to the packaging parameter range, the first encrypted seed parameter and the public key; the seed generation node signs the initial blockchain transaction using a private key to obtain a first blockchain transaction.

[0124] In an embodiment of the present application, the seed generation node initiates a blockchain transaction, and then adds the packaging parameter range, the first encryption seed parameter, and the public key to the accompanying field of the blockchain transaction to obtain an initial blockchain transaction.

[0125] In an embodiment of the present application, after the seed generation node broadcasts the first blockchain transaction to the packaging node, the blockchain network service platform uses the packaging node to determine whether to package the first encryption seed parameter in the first blockchain transaction according to the packaging parameter range carried in the first blockchain transaction; if it is determined that the first encryption seed parameter is packaged, a second random number seed value is generated; and the second random number seed value is processed using the public key in the first blockchain transaction and a preset hash processing method to obtain a second encryption seed parameter; based on the first encryption seed parameter and the second encryption seed parameter, a fused encryption seed parameter is obtained; based on the fused encryption seed parameter and the first blockchain transaction, a second blockchain transaction is generated; the second blockchain transaction is written into the target block, and the target block is linked to the target blockchain.

[0126] In an embodiment of the present application, the way in which the packaging node generates the second random number seed value is the same as the way in which the seed generation node generates the first random number seed value; the specific way in which the packaging node generates the second random number seed value can refer to the way in which the seed generation node generates the first random number seed value, which is not elaborated here.

[0127] In an embodiment of the present application, the process of the packaging node obtaining the fused encryption seed parameter based on the first encryption seed parameter and the second encryption seed parameter can be: processing the first encryption seed parameter and the second encryption seed parameter according to the operation method of the ciphertext domain corresponding to the preset encryption algorithm to obtain the fused encryption seed parameter.

[0128] In the embodiment of the present application, the packaging node encrypts the second seed parameter (U ENC ) and the first encryption seed parameter (G ENC ), and then perform the operation according to the ciphertext domain operation method (ciphertext domain operator) corresponding to the preset encryption algorithm (as shown in formula (5)), and then the combined seed ciphertext (the combined encryption seed parameter S ENC ). In this way, the packing node can convert the ciphertext (U ENC and G ENC) to complete the merge.

[0129]

[0130] It should be noted that since the preset encryption algorithm meets the conditions: the operation on the encrypted ciphertext needs to be numerically equal to the plaintext before encryption; so that the operation of this ciphertext domain can be obtained by encryption after the operation in the plaintext domain, it is convenient for subsequent verification nodes to perform verification, so as to generate the target random number when the verification passes.

[0131] In an embodiment of the present application, the packaging node initiates a new blockchain transaction, and then adds the fused encryption seed parameter and the first blockchain transaction to the accompanying field of the new blockchain transaction to obtain a second blockchain transaction.

[0132] It should be noted that the second blockchain transaction can be tx2, and the Hash of tx2 is tx2Hash. Among them, tx2Hash is automatically generated when the blockchain creates a transaction. The second blockchain transaction carries tx2Hash information.

[0133] It should be noted that the target block is the block to which the second blockchain transaction information is to be added, and the target blockchain is the blockchain to which the target block is to be added.

[0134] In the embodiment of the present application, the packaging node combines the encryption seed parameters (S ENC ), and the Hash of the transaction created by the seed generation node: tx1Hash, are attached to another transaction issued by itself (the second blockchain transaction, tx2), and are put into a block (the target block) together with the previous transaction (the first blockchain transaction, tx1), and are uploaded to the target blockchain.

[0135] Table (1) shows the accompanying information of the tx1 transaction (the first blockchain transaction); Table (2) shows the accompanying information of the tx2 transaction (the second blockchain transaction); both transactions will eventually be linked to a block (target block) by the packaging node.

[0136] Table (1)

[0137] General Trading Information <![CDATA[Ancillary information G ENC G pub BH MAX U set > tx1Hash tx1Sign

[0138] Table (2)

[0139] General Trading Information <![CDATA[Ancillary information S ENC tx1Hash of tx1]]> Tx2Hash Tx2Sign

[0140] It should be noted that these two transactions (tx1 and tx2) are one-to-one. If the packaging node processes more than one initialization request at this stage, a new transaction must be packaged and uploaded to the chain for each request.

[0141] In the embodiment of the present application, the process in which the packaging node writes the second blockchain transaction into the target block and links the target block to the target blockchain is a process in the prior art, and the specific embodiment of the present application is not limited to this.

[0142] In the embodiment of the present application, when the packaging node packages the transaction, it will see the seed ciphertext posted by the seed generator (the first encrypted seed parameter, G ENC ), public key G pub , and the high-term BH package block MAX (BH MAX for parameters carried in the packaged parameter range).

[0143] It should be noted that there is more than one packaging node on the target blockchain, and different packaging nodes may have preferences for different seed values ​​(first random number seed values), so not every packaging node will perform packaging, or immediately perform packaging. In order to prevent the packaging node from waiting too long before packaging, this application restricts the packaging node to be in BH MAX The block height of the transaction is guaranteed to be no later than BH MAX Otherwise, it cannot pass the verification. The packaging node determines whether it can MAX The packaging is completed within the time limit, and the packaging node belongs to U set (At least one packaging node (U set ) is a member of the parameter carried in the packed parameter range).

[0144] In an embodiment of the present application, the packaging parameter range includes a packaging block high threshold and at least one packaging node; the blockchain network service platform uses the packaging node to determine whether to package the first encrypted seed parameter in the first blockchain transaction according to the packaging parameter range carried in the first blockchain transaction, including: obtaining the number of transactions of the remaining blockchain transactions that have not been packaged in the transaction pool; determining the transaction packaging speed, and the current block high parameter; determining the first block high parameter when the packaging of the remaining blockchain transactions is completed according to the current block high parameter, the transaction packaging speed and the number of transactions; when the first block high parameter is less than or equal to the packaging block high threshold and at least one packaging node includes the packaging node, determining to package the first encrypted seed parameter; when the first block high parameter is greater than the packaging block high threshold, or at least one packaging node does not include the packaging node, determining not to package the first encrypted seed parameter.

[0145] In an embodiment of the present application, there are blockchain transactions that have not been packaged by the packaging nodes in the transaction pool. The number of transactions can be obtained by counting the number of blockchain transactions that have not been packaged.

[0146] It should be noted that there is a one-to-one correspondence between the transaction pool and the packaging node, that is, one transaction pool corresponds to one packaging node.

[0147] Exemplarily, the transaction pool corresponding to packaging node A is transaction pool a. By counting the number of unpackaged blockchain transactions in transaction pool a, the number of transactions corresponding to packaging node A can be obtained, so as to determine whether packaging node A can package the first encrypted seed parameter in the first blockchain transaction based on the number of transactions.

[0148] In the embodiment of the present application, the transaction packaging speed can be determined based on the average number of transactions consumed by the packaging node to complete a packaging in history. For example, the packaging node can consume 5 to 10 transactions per packaging in history.

[0149] In an embodiment of the present application, the current block height parameter is the block height information of the packaging node when the packaging node receives the first blockchain transaction.

[0150] In an embodiment of the present application, the process of determining the first block height parameter when the remaining blockchain transactions are packaged is based on the current block height parameter, transaction packaging speed and transaction number. The process can be to divide the transaction number by the packaging speed to obtain the block height requirement parameter required for packaging the remaining blockchain transactions; and obtain the first block height parameter by the sum of the block height requirement parameter and the current block height parameter.

[0151] Exemplarily, the current block height is 13, the packaging block height threshold (BHMAX) is 50, and the transaction pool has a total backlog of 100 transactions (i.e., the number of transactions is 100). The packager can consume 5 to 10 transactions per package on average in history (the packaging speed is 5 to 10). Then the expected block height (first block height parameter) is 13+(100 / 10)~13+(100 / 5)=23~33. Since the first block height parameter (23~33) is less than the packaging block height threshold (50), it is necessary to further determine whether at least one packaging node includes the packaging node. If included, the first encryption seed parameter is determined to be packaged. If not, it is determined not to package the first encryption seed parameter.

[0152] In an embodiment of the present application, the blockchain network service platform uses the public key in the first blockchain transaction and the preset hash processing method to process the second random number seed value to obtain the second encrypted seed parameter, including: processing the second random number seed value using the preset hash processing method to obtain a third hash parameter; encrypting the third hash parameter using the public key to obtain the second encrypted seed parameter.

[0153] In the embodiment of the present application, the process of processing the second random number seed value using a preset hash processing method to obtain a third hash parameter may be to generate a hash value of the second random number seed value using a preset hash processing method to obtain the third hash parameter.

[0154] For example, if the second random number seed value is U and the preset hash processing method is sha256, the sha256 hash generation algorithm is used to generate the hash value U of U. hash , that is, the U hash is the third hash parameter.

[0155] It should be noted that before the packaging node uses the preset hash processing method to process the second random number seed value to obtain the third hash parameter, the packaging node and the seed generation node agree on the preset hash processing method, that is, the preset hash processing method involved in the packaging node generating the third hash parameter is the same as the preset hash processing method involved in the seed generation node generating the second hash parameter.

[0156] In an embodiment of the present application, the third Hash parameter is encrypted using a public key to obtain a second encrypted seed parameter by using a preset encryption algorithm and asymmetrically encrypting the third Hash parameter using a public key to obtain a second encrypted seed parameter.

[0157] It should be noted that the method of using a preset encryption algorithm and a public key to asymmetrically encrypt the third hash parameter to obtain the second encrypted seed parameter is the same as the method of the seed generation node using a preset encryption algorithm and a public key to asymmetrically encrypt the second hash parameter to obtain the first encrypted seed parameter.

[0158] Exemplary, exemplary, G pub is the public key, U hash is the third Hash parameter, the preset encryption algorithm may be Encrypt is an asymmetric encryption function, and the preset encryption algorithm is used to asymmetrically encrypt the third Hash parameter using the public key to obtain the second encryption seed parameter U ENC The method is shown in formula (6):

[0159] U ENC =Encrypt(U hash ,G pub ) (6)

[0160] In an embodiment of the present application, the process of generating a second random number seed value by the blockchain network service platform when determining the first encryption seed parameter for packaging includes: determining the target packaging block when determining the first encryption seed parameter for packaging; and generating a second random number seed value using the target packaging block.

[0161] It should be noted that the block height of the target packaged block is less than or equal to the packaged block height threshold.

[0162] Exemplarily, if the first block high parameter is 33 and the packing block high threshold is 50, there are 50-33=17 packing blocks between the first block high parameter and the packing block high threshold. The packing node can determine the target packing block from these 17 packing blocks to pack the first encryption seed parameter in the target packing block.

[0163] In the embodiment of the present application, when there are multiple packaging blocks in the packaging node that can package the first encryption seed parameter, the packaging node can randomly select a packaging block as the target packaging block. The packaging node can also determine the target packaging block from multiple packaging blocks in other ways. The specific process of the packaging node determining the target packaging block from multiple packaging blocks can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0164] In an embodiment of the present application, the target packaging block generates a second random number seed value in the same manner as the seed generation node generates a first random number seed value, such as using an open source pseudo-random algorithm to generate the second random number seed value; other methods may also be used to generate the second random number seed value; the specific method for generating the second random number seed value may be determined based on actual conditions, and the embodiment of the present application does not limit this.

[0165] S102: Obtain block parameters of the target block.

[0166] In an embodiment of the present application, the seed generation node in the blockchain network service platform uses a private key to decrypt the fused encrypted seed parameters in the target block. After obtaining the fused decrypted seed parameters, the seed generation node obtains the block parameters of the target block.

[0167] It should be noted that the block parameter of the target block is the transaction Hash of the root of the Merkle tree of the target block.

[0168] S103. Obtain a target seed parameter according to the block parameter, the fused decryption seed parameter, and the first transaction parameter of the first blockchain transaction carried in the target block; the first blockchain transaction is a transaction generated according to the first random number seed value and broadcast to the packaging node.

[0169] In an embodiment of the present application, after the seed generation node obtains the block parameters of the target block, the seed generation node obtains the target seed parameters based on the block parameters, the fused decryption seed parameters, and the first transaction parameters of the first blockchain transaction carried in the target block.

[0170] In this embodiment of the present application, the first transaction parameter is the hash value of the first blockchain transaction, namely tx1Hash.

[0171] In an embodiment of the present application, the process of obtaining the target seed parameter by the seed generation node according to the block parameter, the fused decryption seed parameter and the first transaction parameter of the first blockchain transaction carried in the target block includes: splicing the block parameter and the first transaction parameter to obtain the first splicing parameter; processing the first splicing parameter using a preset hash processing method to obtain the first hash parameter; splicing the first hash parameter and the fused decryption seed parameter to obtain the second splicing parameter; processing the second splicing parameter using a preset hash processing method to obtain the target seed parameter.

[0172] In an embodiment of the present application, the seed generation node splices the block parameter and the first transaction parameter to obtain the first splicing parameter by adding the first transaction parameter after the block parameter to obtain the first splicing parameter; or by adding the block parameter after the first transaction parameter information to obtain the first splicing parameter; or by using other methods to splice the block parameter and the first transaction parameter to obtain the first splicing parameter; the specific method of splicing the block parameter and the first transaction parameter to obtain the first splicing parameter can be determined according to actual conditions, and the embodiment of the present application does not limit this.

[0173] In an embodiment of the present application, the seed generation node uses a preset hash processing method to process the first splicing parameter to obtain the first hash parameter. The seed generation node can use a preset hash processing method to generate a hash value of the first splicing parameter to obtain the first hash parameter.

[0174] In an embodiment of the present application, the seed generation node splices the first hash parameter and the fused decryption seed parameter to obtain the second splicing parameter by adding the fused decryption seed parameter after the first hash parameter to obtain the second splicing parameter; or by adding the first hash parameter after the fused decryption seed parameter to obtain the second splicing parameter; or other methods may be used to splice the first hash parameter and the fused decryption seed parameter to obtain the second splicing parameter; the specific method of splicing the first hash parameter and the fused decryption seed parameter to obtain the second splicing parameter can be determined according to actual conditions, and the embodiment of the present application is not limited to this.

[0175] In an embodiment of the present application, the second splicing parameter is processed using a preset hash processing method to obtain a target seed parameter. The seed generation node can use a preset hash processing method to generate a hash value of the second splicing parameter to obtain the target seed parameter.

[0176] In the embodiment of the present application, the seed generation node continuously monitors the target blockchain. If it finds that its transaction (the first blockchain transaction) is on the chain and appears in a certain block (the target block), it first uses the private key G privThe fusion encryption seed parameter (S ENC ) to decrypt and obtain the fused decryption seed parameter (merged seed original text S), where S = Decrypt(S ENC ,G priv ). Substituting the fusion decryption seed parameter into formula (7), the target seed parameter (seed value F) can be obtained;

[0177] F = hash(hash(merkle tree root hash, txHash), S) (7)

[0178] It should be noted that the Merkle tree root hash is the block parameter of the target block; txHash is the first transaction parameter. That is, the seed generation node splices the block parameter and the first transaction parameter to obtain the first splicing parameter; processes the first splicing parameter using a preset hash processing method to obtain the first hash parameter; splices the first hash parameter and the fusion decryption seed parameter to obtain the second splicing parameter; and processes the second splicing parameter using a preset hash processing method to obtain the target seed parameter.

[0179] S104. Transmit the target seed parameter to the verification node, so that the verification node generates a target random number according to the target seed parameter.

[0180] In an embodiment of the present application, after the seed generation node obtains the target seed parameter based on the block parameter, the fused decryption seed parameter and the first transaction parameter of the first blockchain transaction carried in the target block, the seed generation node transmits the target seed parameter to the verification node.

[0181] In an embodiment of the present application, the process of transmitting the target seed parameter from the seed generation node to the verification node includes: obtaining the target block high parameter of the first random number seed value packaged in the target block; obtaining the target parameter according to the target block high parameter, the target seed parameter and the fused decryption seed parameter; and transmitting the target parameter to the verification node.

[0182] In an embodiment of the present application, the process of the seed generation node obtaining the target parameter based on the target block height parameter, the target seed parameter and the fused decryption seed parameter can be to sequentially concatenate the target block height parameter, the target seed parameter and the fused decryption seed parameter to obtain the target parameter; or it can be to directly combine the target block height parameter, the target seed parameter and the fused decryption seed parameter to obtain an information packet, which is the target parameter; the seed generation node can also use other methods to obtain the target parameter based on the target block height parameter, the target seed parameter and the fused decryption seed parameter; the specific seed generation node can obtain the target parameter based on the target block height parameter, the target seed parameter and the fused decryption seed parameter according to the actual situation, and the embodiment of the present application does not limit this.

[0183] In an embodiment of the present application, the manner in which the seed generation node transmits the target parameters to the verification node can be determined based on actual conditions, and the embodiment of the present application does not limit this.

[0184] In an embodiment of the present application, after the seed generation node transmits the target seed parameter to the verification node, the verification node obtains the target block height parameter, the target seed parameter and the fused decryption seed parameter from the target seed parameter; the verification node obtains the packing parameter range, the fused encryption seed parameter, the public key, the block parameter and the first transaction parameter from the target block; when the target block height parameter is less than or equal to the packing block height threshold in the packing parameter range, and at least one packing node in the packing parameter range includes the packing node, the fused decryption seed parameter is encrypted using the public key to obtain the encryption parameter; when the encryption parameter and the fused encryption seed parameter are the same, the first seed parameter is determined according to the block parameter, the first transaction parameter and the fused decryption seed parameter; when the first seed parameter and the target seed parameter are the same, the target random number is generated according to the target seed parameter.

[0185] In an embodiment of the present application, the verification node uses a public key to encrypt the fusion decryption seed parameter to obtain the encryption parameter, including: the verification node uses a preset encryption algorithm and uses the public key to asymmetrically encrypt the fusion decryption seed parameter to obtain the encryption parameter.

[0186] For example, as shown in formula (8): the preset encryption algorithm is Encrypt; the fusion decryption seed parameter is S; the encryption parameter is S ENC ; The public key is G pub .

[0187] S ENC =Encrypt(S,G pub ) (8)

[0188] In an embodiment of the present application, a method for determining the first seed parameter according to the block parameter, the first transaction parameter and the fused decryption seed parameter can be to splice the block parameter and the first transaction parameter to obtain a third splicing parameter; when the third splicing parameter is the same as the first splicing parameter, the third splicing parameter is processed using a preset hash processing method to obtain a fourth hash parameter; when the fourth hash parameter is the same as the first hash parameter, the fourth hash parameter and the fused decryption seed parameter are spliced ​​to obtain a fourth splicing parameter; when the fourth splicing parameter is the same as the second splicing parameter, the fourth splicing parameter is processed using a preset hash processing method to obtain the first seed parameter.

[0189] It should be noted that, when the third splicing parameter is different from the first splicing parameter, the target seed parameter is discarded and the target random number is no longer generated using the target seed parameter. Alternatively, when the fourth hash parameter is different from the first hash parameter, the target seed parameter is discarded and the target random number is no longer generated using the target seed parameter. Alternatively, when the fourth splicing parameter is different from the second splicing parameter, the target seed parameter is discarded and the target random number is no longer generated using the target seed parameter.

[0190] In the embodiment of the present application, the method of generating the target random number according to the target seed parameter can be determined according to the actual situation, and the embodiment of the present application does not limit this.

[0191] For example, the entire process of creating a seed initialization request and packaging blocks on the chain Figure 8 As shown: the seed generation node generates a first random number seed value (G); and creates a private key (G priv ) and the public key (G pub ); encrypt the first random number seed value using a preset hash processing method and a public key to obtain a first encryption seed parameter (G ENC ); Determine the packaging parameter range (U of the first encryption seed parameter) for packaging set , BH MAX ); Generate a first blockchain transaction (tx1) according to the packaging parameter range, the first encryption seed parameter and the public key; Broadcast the first blockchain transaction to the packaging node. The packaging node determines whether to package the first encryption seed parameter in the first blockchain transaction according to the packaging parameter range carried in the first blockchain transaction; When determining to package the first encryption seed parameter, generate a second random number seed value (U); And use a preset hash processing method to process the second random number seed value to obtain a third hash parameter (U Hash ); Encrypt the third Hash parameter using the public key to obtain the second encryption seed parameter (U ENC); obtain the fusion encryption seed parameter according to the first encryption seed parameter and the second encryption seed parameter; generate the second blockchain transaction (tx2) according to the fusion encryption seed parameter and the first blockchain transaction; write the second blockchain transaction into the target block (the target block includes the block parameter, i.e., MerkleRootHash), and upload the target block to the target blockchain. When the seed generation node detects that the target block carrying the first random number seed value is uploaded, the fusion encryption seed parameter in the target block is decrypted using the private key to obtain the fusion decryption seed parameter; the fusion encryption seed parameter is a parameter obtained by the packaging node by fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value; obtain the block parameter of the target block; obtain the target seed parameter according to the block parameter, the fusion decryption seed parameter and the first transaction parameter of the first blockchain transaction carried in the target block (txHash of tx1); the first blockchain transaction is a transaction generated based on the first random number seed value and broadcast to the packaging node; transmit the target seed parameter to the verification node so that the verification node can generate the target random number based on the target seed parameter.

[0192] It should be noted that the target block includes not only txHash (tx1Hash) of tx1, but also tx2Hash, tx3Hash, …

[0193] It can be understood that the blockchain network service platform uses the seed generation node to generate a first random number seed value, and uses the packaging node to generate a second random number seed value, and obtains a fused encryption seed parameter based on the first random number seed value and the second random number seed value, so that the seed generation node will not know the second random number seed value generated by the packaging node before the random number seed is put on the chain, nor can it know the block parameters of the target block. The packaging node is also unable to know the private key of the seed generator, that is, the seed generation node and the packaging node cannot determine whether the result used to generate the random number is beneficial to themselves before the random number seed is put on the chain, so that the node cannot only choose the time and random number seeds that are beneficial to themselves for packaging, which improves the efficiency of random number generation.

[0194] Embodiment 2

[0195] Based on the same inventive concept of the first embodiment, the present application embodiment provides a blockchain network service platform 100, such as Figure 1As shown, the blockchain network service platform 100 is used to decrypt the fused encryption seed parameter in the target block using a private key to obtain the fused decryption seed parameter when the seed generation node detects that the target block carrying the first random number seed value is on the chain; the fused encryption seed parameter is a parameter obtained by the packaging node through fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value; obtain the block parameter of the target block; obtain the target seed parameter based on the block parameter, the fused decryption seed parameter and the first transaction parameter of the first blockchain transaction carried in the target block; the first blockchain transaction is a transaction generated based on the first random number seed value and broadcast to the packaging node; transmit the target seed parameter to the verification node so that the verification node generates a target random number based on the target seed parameter.

[0196] Optionally, the blockchain network service platform 100 is used to splice the block parameter and the first transaction parameter to obtain a first splicing parameter; process the first splicing parameter using a preset hash processing method to obtain a first hash parameter; splice the first hash parameter and the fusion decryption seed parameter to obtain a second splicing parameter; process the second splicing parameter using a preset hash processing method to obtain the target seed parameter.

[0197] Optionally, the blockchain network service platform 100 is used to obtain a target block height parameter that packs the first random number seed value in the target block; obtain a target parameter based on the target block height parameter, the target seed parameter and the fused decryption seed parameter; and transmit the target parameter to the verification node.

[0198] Optionally, the blockchain network service platform 100 is also used to generate a first random number seed value; and create a private key and a public key; use a preset hash processing method and the public key to encrypt the first random number seed value to obtain a first encryption seed parameter; determine a packing parameter range for packing the first encryption seed parameter; generate a first blockchain transaction according to the packing parameter range, the first encryption seed parameter and the public key; broadcast the first blockchain transaction to the packaging node, so that the packaging node can obtain a fusion decryption seed parameter according to the first blockchain transaction, and pack the fusion decryption seed parameter into the target block, and link the target block to the target blockchain.

[0199] Optionally, the blockchain network service platform 100 is used to process the first random number seed value using the preset hash processing method to obtain a second hash parameter; and encrypt the second hash parameter using the public key to obtain the first encrypted seed parameter.

[0200] Optionally, the blockchain network service platform 100 is used to generate an initial blockchain transaction according to the packaging parameter range, the first encryption seed parameter and the public key; and use the private key to sign the initial blockchain transaction to obtain the first blockchain transaction.

[0201] Optionally, the blockchain network service platform 100 is further used to use the packaging node to determine whether to package the first encryption seed parameter in the first blockchain transaction according to the packaging parameter range carried in the first blockchain transaction; when it is determined to package the first encryption seed parameter, generate the second random number seed value; and use the public key in the first blockchain transaction and a preset hash processing method to process the second random number seed value to obtain a second encryption seed parameter; obtain a fused encryption seed parameter based on the first encryption seed parameter and the second encryption seed parameter; generate a second blockchain transaction based on the fused encryption seed parameter and the first blockchain transaction; write the second blockchain transaction into the target block, and link the target block to the target blockchain.

[0202] Optionally, the blockchain network service platform 100 is used to obtain the number of transactions of the remaining blockchain transactions that have not been packaged in the transaction pool; determine the transaction packaging speed and the current block height parameter; determine the first block height parameter when the remaining blockchain transactions are packaged according to the current block height parameter, the transaction packaging speed and the number of transactions; when the first block height parameter is less than or equal to the packaging block height threshold and the at least one packaging node includes the packaging node, determine the first encryption seed parameter for packaging; when the first block height parameter is greater than the packaging block height threshold or the at least one packaging node does not include the packaging node, determine not to package the first encryption seed parameter. The packaging parameter range includes the packaging block height threshold and at least one packaging node.

[0203] Optionally, the blockchain network service platform 100 is used to process the second random number seed value using the preset hash processing method to obtain a third hash parameter; and encrypt the third hash parameter using the public key to obtain the second encrypted seed parameter.

[0204] Optionally, the blockchain network service platform 100 is used to determine a target packaged block when determining the first encryption seed parameter for packaging; the block height of the target packaged block is less than or equal to the packaged block height threshold; and the second random number seed value is generated using the target packaged block.

[0205] Optionally, the blockchain network service platform 100 is also used for the verification node to obtain the target block height parameter, the target seed parameter and the fused decryption seed parameter from the target seed parameter; the verification node obtains the packing parameter range, the fused encryption seed parameter, the public key, the block parameter and the first transaction parameter from the target block; when the target block height parameter is less than or equal to the packing block height threshold in the packing parameter range, and at least one packing node in the packing parameter range includes the packing node, the fused decryption seed parameter is encrypting the fused decryption seed parameter using the public key to obtain an encryption parameter; when the encryption parameter and the fused encryption seed parameter are the same, the first seed parameter is determined according to the block parameter, the first transaction parameter and the fused decryption seed parameter; when the first seed parameter and the target seed parameter are the same, a target random number is generated according to the target seed parameter.

[0206] Based on the same inventive concept of embodiment 1, the embodiment of the present application provides a blockchain network service platform, such as Fig. 9 As shown, Fig. 9 A schematic diagram of the composition structure of a blockchain network service platform proposed in this application embodiment Figure 2 , the blockchain network service platform 100 of the embodiment of the present application includes: at least one processor 10, at least one memory 11 and at least one communication bus 12. In the process of the specific embodiment, the at least one processor 10 can be at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing terminal (DSPD), a programmable logic terminal (PLD), a field programmable gate array (FPGA), a CPU, a controller, a microcontroller, and a microprocessor. It can be understood that for different devices, the electronic device used to implement the above-mentioned processor function can also be other, and the embodiment of the present application is not specifically limited.

[0207] In the embodiment of the present application, the at least one communication bus 12 is used to realize the connection and communication between at least one processor 10 and at least one memory 11; at least one memory 11 is used to store executable instructions;

[0208] At least one processor 10 is used to execute the executable instructions stored in the at least one memory 11 to implement the random number generation method as described in the first embodiment.

[0209] An embodiment of the present application provides a storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors and are applied to a blockchain network service platform. When the program is executed by at least one processor, the random number generation method described in Embodiment 1 is implemented.

[0210] It can be understood that the blockchain network service platform uses the seed generation node to generate a first random number seed value, and uses the packaging node to generate a second random number seed value, and obtains a fused encryption seed parameter based on the first random number seed value and the second random number seed value, so that the seed generation node will not know the second random number seed value generated by the packaging node before the random number seed is put on the chain, nor can it know the block parameters of the target block. The packaging node is also unable to know the private key of the seed generator, that is, the seed generation node and the packaging node cannot determine whether the result used to generate the random number is beneficial to themselves before the random number seed is put on the chain, so that the node cannot only choose the time and random number seeds that are beneficial to themselves for packaging, which improves the efficiency of random number generation.

[0211] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0212] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0213] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0214] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0215] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A random number generation method for a blockchain network service platform, characterized in that: The method comprises: When the seed generation node detects that the target block carrying the first random number seed value is on the chain, the fusion encryption seed parameter in the target block is decrypted using the private key to obtain the fusion decryption seed parameter; the fusion encryption seed parameter is a parameter obtained by the packaging node through fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value; Obtaining block parameters of the target block; Obtaining a target seed parameter according to the block parameter, the fused decryption seed parameter, and the first transaction parameter of the first blockchain transaction carried in the target block; the first blockchain transaction is a transaction generated according to the first random number seed value and broadcast to the packaging node; The target seed parameter is transmitted to the verification node so that the verification node generates a target random number according to the target seed parameter.

2. The method according to claim 1, characterized in that The obtaining a target seed parameter according to the block parameter, the fused decryption seed parameter, and the first transaction parameter of the first blockchain transaction carried in the target block includes: Concatenating the block parameter and the first transaction parameter to obtain a first concatenated parameter; Processing the first concatenation parameter using a preset hash processing method to obtain a first hash parameter; Concatenating the first hash parameter and the fused decryption seed parameter to obtain a second concatenated parameter; The second splicing parameter is processed by using a preset hash processing method to obtain the target seed parameter.

3. The method according to claim 1, characterized in that The transmitting the target seed parameter to the verification node comprises: Obtain a target block high parameter for packaging the first random number seed value in the target block; Obtaining a target parameter according to the target block height parameter, the target seed parameter and the fused decryption seed parameter; The target parameter is transmitted to the verification node.

4. The method according to claim 1, characterized in that: When the seed generation node detects that a target block carrying the first random number seed value is on the chain, before decrypting the fused encryption seed parameter in the target block using the private key to obtain the fused decryption seed parameter, the method further includes: Generate a first random number seed value; and create a private key and a public key; Encrypting the first random number seed value using a preset hash processing method and the public key to obtain a first encrypted seed parameter; Determining a packaging parameter range for packaging the first encryption seed parameter; Generate a first blockchain transaction according to the packaging parameter range, the first encryption seed parameter and the public key; The first blockchain transaction is broadcast to the packaging node, so that the packaging node obtains the fusion decryption seed parameter according to the first blockchain transaction, and packages the fusion decryption seed parameter into the target block, and links the target block to the target blockchain.

5. The method according to claim 4, characterized in that The step of encrypting the first random number seed value using a preset hash processing method and the public key to obtain a first encrypted seed parameter includes: Processing the first random number seed value using the preset hash processing method to obtain a second hash parameter; The second Hash parameter is encrypted using the public key to obtain the first encryption seed parameter.

6. The method according to claim 4, characterized in that The generating a first blockchain transaction according to the packaging parameter range, the first encryption seed parameter and the public key includes: Generate an initial blockchain transaction according to the packaging parameter range, the first encryption seed parameter and the public key; The initial blockchain transaction is signed using the private key to obtain the first blockchain transaction.

7. The method according to claim 4, characterized in that After broadcasting the first blockchain transaction to the packaging node, the method further includes: Determine, using the packaging node, whether to package the first encrypted seed parameter in the first blockchain transaction according to a packaging parameter range carried in the first blockchain transaction; In the case of determining to package the first encryption seed parameter, generating the second random number seed value; and processing the second random number seed value using the public key in the first blockchain transaction and a preset hash processing method to obtain a second encryption seed parameter; Obtaining a fused encryption seed parameter according to the first encryption seed parameter and the second encryption seed parameter; Generating a second blockchain transaction according to the fused encryption seed parameter and the first blockchain transaction; The second blockchain transaction is written into the target block, and the target block is linked to the target blockchain.

8. The method according to claim 7, characterized in that The packaging parameter range includes a packaging block high threshold and at least one packaging node; and using the packaging node to determine whether to package the first encrypted seed parameter in the first blockchain transaction according to the packaging parameter range carried in the first blockchain transaction includes: Get the number of remaining blockchain transactions that have not been packaged in the transaction pool; Determine the transaction packaging speed and the current block height parameters; Determine, according to the current block height parameter, the transaction packaging speed, and the transaction quantity, a first block height parameter when the remaining blockchain transactions are packaged; In a case where the first block high parameter is less than or equal to the packing block high threshold, and the at least one packing node includes the packing node, determining to pack the first encryption seed parameter; In a case where the first block high parameter is greater than the packing block high threshold, or the at least one packing node does not include the packing node, it is determined not to pack the first encryption seed parameter.

9. The method according to claim 7, characterized in that: The method of processing the second random number seed value using the public key in the first blockchain transaction and a preset hash processing method to obtain a second encryption seed parameter includes: Processing the second random number seed value using the preset hash processing method to obtain a third hash parameter; The third Hash parameter is encrypted using the public key to obtain the second encryption seed parameter.

10. The method according to claim 7, characterized in that The step of generating the second random number seed value when determining to package the first encryption seed parameter comprises: In the case of determining to pack the first encryption seed parameter, determining a target packing block; the block height of the target packing block is less than or equal to the packing block height threshold; The second random number seed value is generated using the target packaged block.

11. The method according to claim 3, characterized in that After transmitting the target seed parameter to the verification node, the method further includes: The verification node obtains the target block height parameter, the target seed parameter and the fusion decryption seed parameter from the target seed parameter; The verification node obtains a packaging parameter range, the fusion encryption seed parameter, a public key, the block parameter, and the first transaction parameter from the target block; When the target block height parameter is less than or equal to the packing block height threshold in the packing parameter range, and at least one packing node in the packing parameter range includes the packing node, encrypting the fused decryption seed parameter by using the public key to obtain an encrypted parameter; In the case where the encryption parameter and the fused encryption seed parameter are the same, determining a first seed parameter according to the block parameter, the first transaction parameter and the fused decryption seed parameter; When the first seed parameter and the target seed parameter are the same, a target random number is generated according to the target seed parameter.

12. A blockchain network service platform, characterized in that: The blockchain network service platform is used to decrypt the fusion encryption seed parameter in the target block using the private key to obtain the fusion decryption seed parameter when the seed generation node detects that the target block carrying the first random number seed value is on the chain; the fusion encryption seed parameter is a parameter obtained by the packaging node performing fusion encryption processing based on the generated second random number seed value and the received encrypted first random number seed value; Obtaining block parameters of the target block; obtaining target seed parameters according to the block parameters, the fused decryption seed parameters and the first transaction parameters of the first blockchain transaction carried in the target block; the first blockchain transaction is a transaction generated according to the first random number seed value and broadcast to the packaging node; The target seed parameter is transmitted to the verification node so that the verification node generates a target random number according to the target seed parameter.

13. A blockchain network service platform, characterized in that: The blockchain network service platform includes: at least one memory for storing executable instructions; At least one processor is used to execute the executable instructions stored in the at least one memory to implement the random number generation method of the blockchain network service platform as described in any one of claims 1-11.

14. A storage medium, characterized in that: Executable instructions are stored, and when the executable instructions are executed, they are used to cause a processor to execute the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Multi-party participated random number generation method and device

    CN111628862A

  • Method and system for generating random number on block chain based on threshold encryption

    CN114329566A