WO2023103689A1 - 一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品 - Google Patents

一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品 Download PDF

Info

Publication number
WO2023103689A1
WO2023103689A1 PCT/CN2022/130671 CN2022130671W WO2023103689A1 WO 2023103689 A1 WO2023103689 A1 WO 2023103689A1 CN 2022130671 W CN2022130671 W CN 2022130671W WO 2023103689 A1 WO2023103689 A1 WO 2023103689A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
random
generating
factor
random factor
Prior art date
Application number
PCT/CN2022/130671
Other languages
English (en)
French (fr)
Inventor
黄昊天
Original Assignee
中移(上海)信息通信科技有限公司
中移智行网络科技有限公司
中国移动通信集团有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中移(上海)信息通信科技有限公司, 中移智行网络科技有限公司, 中国移动通信集团有限公司 filed Critical 中移(上海)信息通信科技有限公司
Publication of WO2023103689A1 publication Critical patent/WO2023103689A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • G06F21/33User authentication using certificates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/45Structures or tools for the administration of authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Definitions

  • the embodiment of the present disclosure is based on a Chinese patent application with the application number 202111480022.9, the application date is December 07, 2021, and the application name is "a random number generation method, device and blockchain node in the blockchain", and Priority is claimed from this Chinese patent application, the entire contents of which are hereby incorporated by reference into this disclosure.
  • the present disclosure relates to but not limited to the technical field of block chain, and in particular relates to a method, device, block chain node, storage medium and computer program product for generating random numbers in block chain.
  • the most commonly used access identity information authentication method in blockchain technology is to issue certificates to admitted nodes through the Identity Authentication Center (Certificate Authority, CA). Random number is an important factor in the certificate authentication process, and its randomness and fairness directly affect the degree of decentralization of the blockchain.
  • the current random number generation methods usually include: Let a trusted third party provide a random number for the contract; multiple nodes participating in the process preset a random number, and then submit its hash value to the blockchain, and all nodes submit After completion, all parties broadcast their own random numbers, and generate a final random number by merging their respective random numbers; use public information on the chain, such as using block hash values, timestamps, difficulty coefficients, etc. as random numbers source.
  • the randomness and fairness of each random number generation method are insufficient to realize the decentralization of the blockchain.
  • the present disclosure provides a method and device for generating random numbers in a blockchain, a blockchain node, a storage medium, and a computer program product.
  • Embodiments of the present disclosure provide a method for generating random numbers in a blockchain, which is applied to the first node in the blockchain network, including:
  • the first random number is a random number related to a generation node
  • the generation node is a node that generates the identity certificate of the first node.
  • Embodiments of the present disclosure provide a method for generating random numbers in a blockchain, which is applied to a target second node in a blockchain network, including:
  • a second random factor is generated according to the stored block information and the number of nodes in the blockchain network;
  • the target random factor includes the first random factor or the first random factor and a third random factor broadcast by the third node;
  • the third node is a node in the block chain network except the first node and the target second node; the second random number is a random number related to the generation node, and the The generation node is a node that generates the identity certificate of the first node.
  • Embodiments of the present disclosure also provide a device for generating random numbers in the blockchain, which is applied to the first node in the blockchain network, including:
  • the first generation module is used to generate a first random factor according to the stored block information and the number of nodes in the blockchain network and broadcast the first random factor;
  • a first acquisition module configured to acquire a second random factor generated by at least one second node in the blockchain network after receiving the first random factor
  • a second generating module configured to generate a first random number according to the first random factor and the second random factor
  • the first random number is a random number related to a generation node
  • the generation node is a node that generates the identity certificate of the first node.
  • Embodiments of the present disclosure also provide a device for generating random numbers in the blockchain, which is applied to the target second node in the blockchain network, including:
  • the third generation module is used to generate a second random factor according to the stored block information and the number of nodes in the blockchain network after receiving the first random factor broadcast by the first node;
  • a fourth generating module configured to generate a second random number according to the second random factor and a target random factor; the target random factor includes the first random factor or the first random factor and the third random number broadcast by the third node random factor;
  • the third node is a node in the block chain network except the first node and the target second node; the second random number is a random number related to the generation node, and the The generation node is a node that generates the identity certificate of the first node.
  • Embodiments of the present disclosure also provide a block chain node, including: a first transceiver and a first processor;
  • the first processor is configured to generate a first random factor according to the stored block information and the number of nodes in the blockchain network;
  • the first transceiver configured to broadcast the first random factor
  • the first processor is further configured to generate a first random number according to the first random factor and the second random factor;
  • the first random number is a random number related to a generation node
  • the generation node is a node that generates the identity certificate of the first node.
  • Embodiments of the present disclosure also provide a blockchain node, including: a second transceiver and a second processor;
  • the second transceiver is configured to receive the first random factor broadcast by the first node
  • the second processor is configured to generate a second random factor according to the stored block information and the number of nodes in the blockchain network after receiving the first random factor broadcast by the first node;
  • the target random factor includes the first random factor or the first random factor and a third random factor broadcast by the third node;
  • the third node is a node in the block chain network except the first node and the target second node; the second random number is a random number related to the generation node, and the The generation node is a node that generates the identity certificate of the first node.
  • An embodiment of the present disclosure provides a terminal device, including a transceiver, a processor, a memory, and a program or instruction stored on the memory and operable on the processor; when the processor executes the program or instruction Implement the method for generating random numbers in the blockchain as described above.
  • Embodiments of the present disclosure provide a readable storage medium on which programs or instructions are stored, and when the programs or instructions are executed by a processor, the steps in the method for generating random numbers in the blockchain described above are implemented.
  • An embodiment of the present disclosure provides a computer program product, the computer program product includes computer instructions, and when the computer instructions run on a computer device, the computer device executes the above random Steps in the generation method of the number.
  • the first node In the method for generating random numbers in the blockchain in the embodiment of the present disclosure, the first node generates the first random factor according to the block information stored by itself and the number of nodes in the blockchain network, and broadcasts the first random factor; according to the first node A random factor and the received second random factor generated by the second node generate the first random number.
  • the rights of each participating node in the block chain network are the same, and the respective random factors are independently generated by each node's own state information and group shared information, and according to The random factors of all participating nodes generate random numbers, which improves the randomness, fairness and security of the random number generation method.
  • FIG. 1 is a flow diagram of a method for generating random numbers in a blockchain applied to a first node in a blockchain network according to an embodiment of the present disclosure
  • FIG. 2 is a schematic diagram of a method for generating random numbers in a block chain with the first node as an example of an identity certificate application node according to an embodiment of the present disclosure
  • FIG. 3 is a flow diagram of a method for generating random numbers in a blockchain applied to a target second node in a blockchain network according to an embodiment of the present disclosure
  • FIG. 4 is a schematic diagram of a device for generating random numbers in a blockchain applied to a first node in a blockchain network according to an embodiment of the present disclosure
  • FIG. 5 is a schematic diagram of a device for generating random numbers in a block chain applied to a target second node in a block chain network according to an embodiment of the present disclosure
  • FIG. 6 is a schematic structural diagram of a terminal device according to an embodiment of the present disclosure.
  • sequence numbers of the following processes do not mean the order of execution, and the execution order of each process should be determined by its functions and internal logic, and should not be implemented in the present disclosure.
  • the implementation of the examples constitutes no limitation.
  • system and “network” are often used interchangeably herein.
  • B corresponding to A means that B is associated with A, and B can be determined according to A.
  • determining B according to A does not mean determining B only according to A, and B may also be determined according to A and/or other information.
  • the embodiment of the present disclosure provides a method for generating random numbers in the blockchain, which is applied to the first node in the blockchain network, including:
  • Step 101 generating a first random factor according to the stored block information and the number of nodes in the blockchain network and broadcasting the first random factor;
  • Step 102 acquiring a second random factor generated by at least one second node in the blockchain network after receiving the first random factor
  • Step 103 generating a first random number according to the first random factor and the second random factor
  • the first random number is a random number related to a generation node
  • the generation node is a node that generates the identity certificate of the first node.
  • the first node is any node in the blockchain network that initiates a certificate request
  • the second node is a node in the blockchain network other than the first node.
  • the block information only includes a block number.
  • the first node In the method for generating random numbers in the blockchain in the embodiment of the present disclosure, the first node generates the first random factor according to the block information stored by itself and the number of nodes in the blockchain network, and broadcasts the first random factor; according to the first node A random factor and the received second random factor generated by the second node generate the first random number.
  • the rights of each participating node in the block chain network are the same, and the respective random factors are independently generated by each node's own state information and group shared information, and according to The random factors of all participating nodes generate random numbers, which improves the randomness, fairness and security of the random number generation method.
  • the method before generating the random factor according to the first block information and the number of nodes in the blockchain network, the method further includes:
  • multiple initial nodes are directly connected to each other to form a network, and each initial node initiates an identity certificate request to the network to obtain its own identity certificate. It should be noted that the subsequent nodes that want to join the network only need to initiate a certificate request to the initial node that has obtained the identity certificate.
  • the identity certificate is generated after the initial node is networked, and the random factor related to the generation of the identity certificate is generated by each node according to its own information, Improved security and reliability of identity certificates.
  • the generating the first random number includes:
  • the first random number is generated according to the first random factor and the second random factor.
  • the first node verifies the second random factor according to the stored block information, and uses the verified second random factor to verify the signature.
  • both the first random number and the second random number are generated according to the first random factor and the second random factor, so the first random number is equal to the second random number . Therefore, the second random number may be verified by judging whether the second random number is equal to the first random number.
  • the method also includes:
  • the modulo calculation is performed on the first random number, and the obtained calculation result is the node number of the generating node, and it is determined that the node number in the blockchain network is the same as the node number of the generating node
  • the node is the generating node, and the generating node generates the identity certificate.
  • the determination of the random number related to the generation node of the identity certificate is jointly determined by the random factors calculated by all participating nodes in the block chain network, and the change of any node will The random factor changes, thus ensuring the randomness of the generated nodes. Therefore, the solutions of the embodiments of the present disclosure guarantee the randomness and security of random number generation, thereby improving the randomness of the generation nodes and ensuring the decentralization of the blockchain network.
  • the method before performing the modulo calculation on the first random number, the method further includes:
  • the second random number is generated according to the first random factor and the second random factor.
  • the first random number and the second random number are both generated according to the first random factor and the second random factor, so the first random number is equal to the second random number. Therefore, the first random number may be verified by judging whether the second random number is equal to the second random number.
  • each node compares and verifies the random numbers generated by itself and the random numbers generated by other nodes before taking the modulus of the random numbers, so as to avoid The wrong random number is generated due to malicious tampering during the transmission process, which improves the security of determining the generation node.
  • the acquiring the identity certificate according to the node number includes:
  • the node number of the generating node is the same as the node number of the first node, then generate the identity certificate
  • the node number of the generating node is different from the node number of the first node, acquiring the identity certificate generated by the generating node.
  • the rights of each participating node in the block chain network are the same, and the respective random factors are independently generated by each node's own state information and group shared information, and according to The random factors of all participating nodes generate random numbers, and each node may be used as a generating node, which ensures the randomness of the generating node determination and improves the fairness of the rights of each node in the blockchain.
  • the preceding information of the identity certificate includes the block number of the generating node.
  • the production node stores its own block number and integer serial number in the pre-issued information of the identity certificate, and verifies the signature together with the node information of the identity certificate application node to obtain the generated identity certificate.
  • a new block is generated when the identity certificate is generated, and the random factors, random numbers, and generated identity certificates in the process of generating the identity certificate are all attached to a newly generated block, and the information sent in conjunction with the identity certificate The block number recorded in , can be verified forward or backward, thus avoiding the problem of needing to verify through the root certificate in each verification.
  • Each node sends an identity certificate request to the blockchain network
  • Each node generates a random factor according to the block information stored by itself and the number of nodes in the blockchain network, and broadcasts the generated random factor;
  • the node whose node number is the same as the calculated result is the generating node
  • an identity certificate is generated; if the generating node is another node, the identity certificate generated by the generating node is received.
  • FIG. 2 it is a schematic diagram of a random number generation method in a block chain with node 1 as an example of an identity certificate application node, wherein node 1 is the first node, that is, the application node of the identity certificate, and node 2 and node 3 are respectively It is other nodes in the blockchain network except node 1.
  • Node 1 initiates an identity certificate request to the network, generates its own random factor, broadcasts the random factor of node 1, and receives the random factor generated by node 2 and node 3, and node 1 generates its own random factor based on the random factor received by node 2 and node 3.
  • a random factor of 3 generates random numbers.
  • the random number generation process may include: 1) node 1 (an example of the first node) generates its own random number factor (or called random factor); 2) node 1 broadcasts node 1's Random number factor; 3) Other nodes (such as node 2 and node 3) generate random number factors of their own nodes; 4) Other nodes broadcast their own random number factors; 5) All nodes collect random number factors of other nodes except this node Number factor and verify signature; 6) Each collects the news that the random number factors of other nodes have been collected, and upgrades the final random number; 7) Each broadcasts the final random number, and collects the final random number of the remaining nodes; 8) Calculates from the final random number After the model obtains the generation node, the generation node generates a certificate and records it.
  • a method for generating random numbers in a block chain is applied to the target second node in the block chain network, including:
  • Step 301 after receiving the first random factor broadcast by the first node, generating a second random factor according to the stored block information and the number of nodes in the blockchain network;
  • Step 302 generating a second random number according to the second random factor and a target random factor;
  • the target random factor includes the first random factor or the first random factor and a third random factor broadcast by a third node;
  • the third node is a node in the block chain network except the first node and the target second node; the second random number is a random number related to the generation node, and the The generation node is a node that generates the identity certificate of the first node.
  • the target random factor is the first random factor
  • the target random number is the first random factor and the third random factor.
  • the rights of each participating node in the block chain network are the same, and the respective random factors are independently generated by each node's own state information and group shared information, and according to The random factors of all participating nodes generate random numbers, which improves the randomness, fairness and security of the random number generation method.
  • the generating a second random number includes:
  • the second random number is generated according to the first random factor and the target random factor.
  • the method for generating random numbers in the block chain of the disclosed embodiment first verifies the received first random factor of the first node, and generates the second random number according to the second random factor and the first random factor generated by itself , ensuring the security of random number generation.
  • the method also includes:
  • the node number of the generating node is the same as the node number of the second node, then generate the identity certificate.
  • the rights of each participating node in the block chain network are the same, and the respective random factors are independently generated by each node's own state information and group shared information, and according to The random factors of all participating nodes generate random numbers, and each node may be used as a generating node, which ensures the randomness of the generating node determination and improves the fairness of the rights of each node in the blockchain.
  • the first random number is generated according to the first random factor and the second random factor.
  • the first random number and the second random number are both generated according to the first random factor and the second random factor, so the first random number is equal to the second random number. Therefore, the first random number may be verified by judging whether the second random number is equal to the second random number.
  • each node compares and verifies the random numbers generated by itself and the random numbers generated by other nodes before taking the modulus of the random numbers, so as to avoid The wrong random number is generated due to malicious tampering during the transmission process, which improves the security of the node determination of the identity certificate.
  • the embodiment of the present disclosure also provides a random number generation device 400 in the blockchain, which is applied to the first node in the blockchain network, including:
  • the first generating module 401 is configured to generate a first random factor according to the stored block information and the number of nodes in the blockchain network and broadcast the first random factor;
  • a first acquiring module 402 configured to acquire a second random factor generated by at least one second node in the blockchain network after receiving the first random factor
  • the second generating module 403 is used to generate a first random number according to the first random factor and the second random factor;
  • the first random number is a random number related to a generation node
  • the generation node is a node that generates the identity certificate of the first node.
  • the rights of each participating node in the block chain network are the same, and the respective random factors are independently generated by each node's own state information and group shared information, and according to The random factors of all participating nodes generate random numbers, which improves the randomness, fairness and security of the random number generation method.
  • the device also includes:
  • a connection module configured to connect with at least one second node to generate the blockchain network
  • An initiating module configured to initiate an identity certificate request to the blockchain network.
  • the generating module is also used for:
  • the first random number is generated according to the first random factor and the second random factor.
  • the device also includes:
  • a first calculation module configured to perform modulo calculation on the first random number to obtain the node number of the generation node
  • the second acquiring module is configured to acquire the identity certificate according to the node number.
  • the first computing module is also used for:
  • the second random number is generated according to the first random factor and the second random factor.
  • the second acquisition module is also used for:
  • the node number of the generating node is the same as the node number of the first node, then generate the identity certificate
  • the node number of the generating node is different from the node number of the first node, acquiring the identity certificate generated by the generating node.
  • the embodiment of the present disclosure also provides a random number generation device 500 in the blockchain, which is applied to the target second node in the blockchain network, including:
  • the third generating module 501 is configured to generate a second random factor according to the stored block information and the number of nodes in the blockchain network after receiving the first random factor broadcast by the first node;
  • the fourth generating module 502 is configured to generate a second random number according to the second random factor and a target random factor; the target random factor includes the first random factor or the first random factor and the first random factor broadcast by the third node Three random factors;
  • the third node is a node in the block chain network except the first node and the target second node; the second random number is a random number related to the generation node, and the The generation node is a node that generates the identity certificate of the first node.
  • the rights of each participating node in the block chain network are the same, and the respective random factors are independently generated by each node's own state information and group shared information, and according to The random factors of all participating nodes generate random numbers, which improves the randomness, fairness and security of the random number generation method.
  • the fourth generation module is also used for:
  • the second random number is generated according to the first random factor and the second random factor.
  • the device also includes:
  • the second calculation module is used to perform modulo calculation on the second random number to obtain the node number of the generation node;
  • a fifth generating module configured to generate the identity certificate if the node number of the generating node is the same as the node number of the second node.
  • the second calculation module is also used for:
  • the first random number is generated according to the first random factor and the second random factor.
  • the embodiment of the present disclosure also provides a block chain node, including: a first transceiver and a first processor;
  • the first processor is configured to generate a first random factor according to the stored block information and the number of nodes in the blockchain network;
  • the first transceiver configured to broadcast the first random factor
  • the first processor is further configured to generate a first random number according to the first random factor and the second random factor;
  • the first random number is a random number related to a generation node
  • the generation node is a node that generates the identity certificate of the first node.
  • the first processor is further configured to connect with at least one second node to generate the blockchain network
  • the first transceiver is further configured to initiate an identity certificate request to the blockchain network.
  • the first processor is further configured to verify the second random factor
  • the first random number is generated according to the first random factor and the second random factor.
  • the first processor is further configured to perform modulo calculation on the first random number to obtain the node number of the generating node;
  • the first processor is further configured to generate the identity certificate if the node number of the generating node is the same as the node number of the first node;
  • the first transceiver is further configured to obtain the identity certificate generated by the generation node if the node number of the generation node is different from the node number of the first node.
  • the blockchain node is the above-mentioned first node.
  • An embodiment of the present disclosure also provides a blockchain node, including: a second transceiver and a second processor;
  • the second transceiver is configured to receive the first random factor broadcast by the first node
  • the second processor is configured to generate a second random factor according to the stored block information and the number of nodes in the blockchain network after receiving the first random factor broadcast by the first node;
  • the target random factor includes the first random factor or the first random factor and a third random factor broadcast by the third node;
  • the third node is a node other than the first node and the target second node in the blockchain network; the second random number is a random number related to the generation node, and the generation node is the node that generates the identity certificate of the first node.
  • the second processor is further configured to verify the first random factor
  • the second random number is generated according to the first random factor and the target random factor.
  • the second processor is further configured to perform modulo calculation on the second random number to obtain the node number of the generating node;
  • the node number of the generating node is the same as the node number of the second node, then generate the identity certificate.
  • the blockchain node is the above-mentioned target second node.
  • a terminal device includes a transceiver 610, a processor 600, a memory 620, and a program or Instructions; when the processor 600 executes the programs or instructions, the above method for generating random numbers applied in the blockchain is realized.
  • the transceiver 610 is used for receiving and sending data under the control of the processor 600 .
  • the bus architecture may include any number of interconnected buses and bridges, specifically one or more processors represented by the processor 600 and various circuits of the memory represented by the memory 620 are linked together.
  • the bus architecture can also link together various other circuits such as peripherals, voltage regulators, and power management circuits, etc., which are well known in the art and therefore will not be further described herein.
  • the bus interface provides the interface.
  • Transceiver 610 may be a plurality of elements, including a transmitter and a receiver, providing a means for communicating with various other devices over transmission media.
  • the processor 600 is responsible for managing the bus architecture and general processing, and the memory 620 can store data used by the processor 600 when performing operations.
  • a readable storage medium on which programs or instructions are stored, and when the programs or instructions are executed by the processor, the steps in the method for generating random numbers in the blockchain as described above are implemented, and can To achieve the same technical effect, in order to avoid repetition, no more details are given here.
  • the readable storage medium includes computer readable storage medium, such as computer read-only memory (Read-Only Memory, ROM for short), random access memory (Random Access Memory, RAM for short), magnetic disk or optical disk, etc.
  • computer readable storage medium such as computer read-only memory (Read-Only Memory, ROM for short), random access memory (Random Access Memory, RAM for short), magnetic disk or optical disk, etc.
  • An embodiment of the present disclosure also provides a computer program, including computer readable codes.
  • the computer readable codes run in a block chain node (such as a first node; another example is a target second node)
  • the A processor in a blockchain node executes part or all of the steps for realizing the above method.
  • An embodiment of the present disclosure also provides a computer program product
  • the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, it realizes part of the above method or all steps.
  • the computer program product can be specifically realized by means of hardware, software or a combination thereof.
  • the computer program product is embodied as a computer storage medium, and in other embodiments, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK) and the like.
  • terminals described in this manual include but are not limited to smartphones, tablet computers, etc., and many of the described functional components are called modules, in order to more particularly emphasize the independence of their implementation.
  • the modules may be implemented in software so as to be executed by various types of processors.
  • An identified module of executable code may, by way of example, comprise one or more physical or logical blocks of computer instructions which may, for example, be structured as an object, procedure, or function. Notwithstanding, the executable code of an identified module need not be physically located together, but may include distinct instructions stored in different bits which, when logically combined, constitute the module and implement the specified Purpose.
  • a module of executable code may be a single instruction, or many instructions, and may even be distributed over several different code segments, among different programs and across multiple memory devices.
  • operational data may be identified within modules, and may be implemented in any suitable form and organized within any suitable type of data structure. The operational data may be collected as a single data set, or may be distributed in different locations (including on different storage devices), and may exist, at least in part, only as electronic signals on a system or network.
  • the hardware circuit includes conventional very large scale integration (VLSI) circuits or gate arrays as well as existing semiconductors such as logic chips, transistors, or other discrete components.
  • VLSI very large scale integration
  • a module may also be implemented in programmable hardware devices such as field programmable gate arrays, programmable array logic, programmable logic devices, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品,涉及区块链技术领域。该方法包括:根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子并广播所述第一随机因子;获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;根据所述第一随机因子以及所述第二随机因子,生成第一随机数。

Description

一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品
相关申请的交叉引用
本公开实施例基于申请号为202111480022.9、申请日为2021年12月07日、申请名称为“一种区块链中随机数的生成方法、装置及区块链节点”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本公开作为参考。
技术领域
本公开涉及但不限于区块链技术领域,尤其涉及一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品。
背景技术
在区块链技术中最常用的准入身份信息认证手段就是通过身份认证中心(Certificate Authority,CA)颁发给准入的节点证书。随机数作为证书认证过程中的一个重要因素,它的随机性和公平性直接影响了区块链的去中心化程度。
目前的随机数生成方法通常有:让可信第三方为合约提供随机数;参与过程的多个节点预先预设一个随机数,然后将其哈希值递交到区块链上,所有节点都递交完毕后,各方广播自己的随机数,通过将各自的随机数合并产生一个最终的随机数;采用链上的公开信息,比如使用区块的哈希值、时间戳、难度系数等作为随机数源。但每一种随机数生成方法的随机性和公平性不足,无法实现区块链的去中心化。
发明内容
本公开提供一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品。
本公开的实施例提供一种区块链中随机数的生成方法,应用于区块链网络中的第一节点,包括:
根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子并广播所述第一随机因子;
获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
根据所述第一随机因子以及所述第二随机因子,生成第一随机数;
其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开的实施例提供一种区块链中随机数的生成方法,应用于区块链网络中的目标第二节点,包括:
在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;
根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括所述第一随机因子或第一随机因子和第三节点广播的第三随机因子;
其中,所述第三节点为所述区块链网络中除了所述第一节点和所述目标第二节点之外的 节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开的实施例还提供一种区块链中随机数的生成装置,应用于区块链网络中的第一节点,包括:
第一生成模块,用于根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子并广播所述第一随机因子;
第一获取模块,用于获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
第二生成模块,用于根据所述第一随机因子以及所述第二随机因子,生成第一随机数;
其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开的实施例还提供一种区块链中随机数的生成装置,应用于区块链网络中的目标第二节点,包括:
第三生成模块,用于在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;
第四生成模块,用于根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括所述第一随机因子或第一随机因子和第三节点广播的第三随机因子;
其中,所述第三节点为所述区块链网络中除了所述第一节点和所述目标第二节点之外的节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开的实施例还提供一种区块链节点,包括:第一收发机和第一处理机;
所述第一处理机,用于根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子;
所述第一收发机,用于广播所述第一随机因子;
获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
所述第一处理机,还用于根据所述第一随机因子以及所述第二随机因子,生成第一随机数;
其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开的实施例还提供一种区块链节点,包括:第二收发机和第二处理机;
所述第二收发机,用于接收第一节点广播的第一随机因子;
所述第二处理机,用于在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;
根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括所述第一随机因子或第一随机因子和第三节点广播的第三随机因子;
其中,所述第三节点为所述区块链网络中除了所述第一节点和所述目标第二节点之外的节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开的实施例提供一种终端设备,包括收发器、处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令;所述处理器执行所程序或指令时实现如上所述的区块链中随机数的生成方法。
本公开的实施例提供一种可读存储介质,其上存储有程序或指令,所述程序或指令被处理器执行时实现如上所述的区块链中随机数的生成方法中的步骤。
本公开的实施例提供一种计算机程序产品,所述计算机程序产品包括计算机指令,在所述计算机指令在计算机设备上运行的情况下,使得所述计算机设备执行如上所述的区块链中随机数的生成方法中的步骤。
本公开的上述技术方案的有益效果如下:
本公开实施例的区块链中随机数的生成方法,通过第一节点根据自身存储的区块信息以及区块链网络中的节点数量生成第一随机因子,并广播第一随机因子;根据第一随机因子和接收到的第二节点生成的第二随机因子生成第一随机数。本公开实施例的区块链中随机数的生成方法,区块链网络中每个参与节点的权利都相同,通过各个节点自身的状态信息和群组共有信息独立产生各自的随机因子,并且根据所有参与节点的随机因子生成随机数,提高了随机数生成方法的随机性、公平性和安全性。
附图说明
图1为本公开实施例的一种应用于区块链网络中的第一节点的区块链中随机数的生成方法的流程示意;
图2为本公开实施例的一种以第一节点为身份证书申请节点为例的区块链中随机数生成方法的示意图;
图3为本公开实施例的一种应用于区块链网络中的目标第二节点的区块链中随机数的生成方法的流程示意;
图4为本公开实施例的一种应用于区块链网络中的第一节点的区块链中随机数的生成装置的示意图;
图5为本公开实施例的一种应用于区块链网络中的目标第二节点的区块链中随机数的生成装置的示意图;
图6为本公开实施例的一种终端设备的结构示意图。
具体实施方式
为使本公开要解决的技术问题、技术方案和优点更加清楚,下面将结合附图及具体实施例进行详细描述。
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本公开的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。
在本公开的各种实施例中,应理解,下述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本公开实施例的实施过程构成任何限定。
另外,本文中术语“系统”和“网络”在本文中常可互换使用。
在本公开所提供的实施例中,应理解,“与A相应的B”表示B与A相关联,根据A可以确定B。但还应理解,根据A确定B并不意味着仅仅根据A确定B,还可以根据A和/或其它信息确定B。
如图1所示,本公开实施例提供一种区块链中随机数的生成方法,应用于区块链网络中的第一节点,包括:
步骤101,根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子并广播所述第一随机因子;
步骤102,获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
步骤103,根据所述第一随机因子以及所述第二随机因子,生成第一随机数;
其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
需要说明的是,所述第一节点为区块链网络中的任意一个发起证书请求的节点,所述第 二节点为所述区块链网络中除了所述第一节点外的节点。
在一些实施方式中,所述区块信息只包括区块号。
本公开实施例的区块链中随机数的生成方法,通过第一节点根据自身存储的区块信息以及区块链网络中的节点数量生成第一随机因子,并广播第一随机因子;根据第一随机因子和接收到的第二节点生成的第二随机因子生成第一随机数。本公开实施例的区块链中随机数的生成方法,区块链网络中每个参与节点的权利都相同,通过各个节点自身的状态信息和群组共有信息独立产生各自的随机因子,并且根据所有参与节点的随机因子生成随机数,提高了随机数生成方法的随机性、公平性和安全性。
在一些实施方式中,所述根据第一区块信息以及所述区块链网络中节点的数量生成随机因子之前,所述方法还包括:
与至少一个第二节点连接生成所述区块链网络;
向所述区块链网络发起身份证书请求。
本公开一实施例中,多个初始节点直接相互连接组成网络,每个初始节点向网络发起身份证书请求,获得各自的身份证书。需要说明的是,后续要加入网络的节点只需要向已经获得身份证书的初始节点发起证书请求。
本公开实施例的区块链中随机数的生成方法,在初始节点组网后才进行身份证书的生成,且与所述身份证书的生成相关的随机因子由每个节点根据自身的信息生成,提高了身份证书的安全性和可靠性。
在一些实施方式中,所述生成第一随机数,包括:
对所述第二随机因子进行验证;
在所述第二随机因子通过验证后,根据所述第一随机因子以及所述第二随机因子生成所述第一随机数。
在一些实施方式中,所述的第一节点根据存储的区块信息对第二随机因子进行验证,并通过验证的第二随机因子进行验证签名。
在一些实施方式中,所述第一随机数与所述第二随机数均根据所述第一随机因子和所述第二随机因子生成的,所以第一随机数与所述第二随机数相等。因此,可以通过判断所述第二随机数是否等于所述第一随机数来对所述第二随机数进行验证。
在一些实施方式中,所述方法还包括:
对所述第一随机数进行取模计算,得到所述生成节点的节点编号;
根据所述节点编号获取所述身份证书。
在一些实施方式中,对所述第一随机数进行取模计算,得到的计算结果即为生成节点的节点编号,确定所述区块链网络中节点号与所述生成节点的节点编号相同的节点即为所述生成节点,所述生成节点生成所述身份证书。
本公开实施例的区块链中随机数的生成方法,与身份证书的生成节点相关的随机数的确定由区块链网络中的所有参与节点计算的随机因子共同决定,任意一个节点的变化都会造成随机因子变化,从而保证了生成节点的随机性。因此,本公开实施例的方案保证了随机数生成的随机性和安全性,从而提高了生成节点的随机性,保证了区块链网络的去中心化。
在一些实施方式中,所述对所述第一随机数进行取模计算之前,所述方法还包括:
广播所述第一随机数;
接收所述第二节点生成的第二随机数;
对所述第一随机数和所述第二随机数进行验证;
其中,所述第二随机数根据所述第一随机因子和所述第二随机因子生成。
示例性地,所述第一随机数与所述第二随机数均根据所述第一随机因子和所述第二随机因子生成的,所以第一随机数与所述第二随机数相等。因此,可以通过判断所述第以随机数是否等于所述第二随机数来对所述第一随机数进行验证。
本公开实施例的区块链中随机数的生成方法,各个节点在对随机数进行取模之前,对自身生成的随机数与其余节点生成的随机数进行比对验证,避免了在随机因子的传输过程中被 恶意篡改而导致生成错误的随机数,提高了确定生成节点的安全性。在一些实施方式中,所述根据所述节点编号获取所述身份证书,包括:
若所述生成节点的节点编号与所述第一节点的节点号相同,则生成所述身份证书;
若所述生成节点的节点编号与所述第一节点的节点号不同,则获取所述生成节点生成的所述身份证书。
本公开实施例的区块链中随机数的生成方法,区块链网络中每个参与节点的权利都相同,通过各个节点自身的状态信息和群组共有信息独立产生各自的随机因子,并且根据所有参与节点的随机因子生成随机数,每个节点都可能作为生成节点,保证了生成节点确定的随机性,提高了区块链中每个节点权利的公平性。
在一些实施方式中,所述身份证书的前发信息中包括所述生成节点的区块号。
本公开一实施例中,生产节点将自身的区块号以及整数序列号存储于身份证书的前发信息中,并配合身份证书申请节点的节点信息一起验证签名后获得生成的身份证书。
需要说明的是,在生成身份证书时产生新的区块,身份证书生成的过程中的随机因子、随机数以及生成的身份证书都附在新产生的一个区块中,配合身份证书前发信息中记录的区块号,可以正向或反向溯源验证,从而避免了每次验证中需要通过根证书来验证的问题。
本公开实施例的区块链中随机数的生成方法,在每次节点申请身份证书的过程中,只产生一个区块,且不存在伴随节点集多个步骤的时间开销,提高了证书生成的效率,降低了运算开销。
本公开一实施例的区块链中随机数的生成方法、生成节点确定的方法以及身份证书生成的方法的逻辑:
多个初始节点相互连接组成区块链网络;
每个节点向区块链网络发送身份证书请求;
每个节点根据自身存储的区块信息以及所述区块链网络中节点的数量生成随机因子,并广播生成的随机因子;
对接收到的其他节点的随机因子进行验证;
在接收到区块链网络中其他全部节点的随机因子均通过验证后,生成随机数,并广播生成的随机数;
对接收到的其他节点的随机数进行验证;
在确定接收到的其他节点的随机数与自身生成的随机数相同后,对随机数进行取模运算;
节点号与计算得到的结果相同的节点即为生成节点;
若生成节点为自身,则生成身份证书;若生成节点为其他节点,则接收生成节点生成的身份证书。
如图2所示为以节点1为身份证书申请节点为例的区块链中随机数生成方法的示意图,其中,节点1为第一节点,即身份证书的申请节点,节点2和节点3分别为区块链网络中的除了节点1以外的其他节点。节点1向网络发起身份证书请求,生成自身的随机因子,广播节点1的随机因子,并接收节点2和节点3生成的随机因子,节点1根据自身生成的随机因子以及接收到的节点2和节点3的随机因子,生成随机数。
在一些实施方式中,参见图2,随机数生成流程可包括:1)节点1(第一节点的一例)生成自身的随机数因子(或者称为随机因子);2)节点1广播节点1的随机数因子;3)其余节点(如节点2和节点3)生成自身节点的随机数因子;4)其余节点广播自身的随机数因子;5)所有节点收集除该节点之外的其余节点的随机数因子并验证签名;6)各自收集其他节点的随机数因子收集完毕的消息,升级最终随机数;7)各自广播最终随机数,并收集其余节点的最终随机数;8)由最终随机数求模获得生成节点后,由生成节点产生证书并落块记录。通过上述的流程,由于随机产生的过程由所有参与方一起决定,从而全面地保护了整个过程中各个节点权力的公平一致性。
如图3所示,本公开实施例的一种区块链中随机数的生成方法,应用于区块链网络中的 目标第二节点,包括:
步骤301,在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;
步骤302,根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括所述第一随机因子或第一随机因子和第三节点广播的第三随机因子;
其中,所述第三节点为所述区块链网络中除了所述第一节点和所述目标第二节点之外的节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开一实施例中,在所述随机数生成方法的过程中,参与的所述第二节点只有一个时,所述目标随机因子为所述第一随机因子;
参与的所述第二节点有多个时,所述目标随机数为所述第一随机因子和所述第三随机因子。
本公开实施例的区块链中随机数的生成方法,区块链网络中每个参与节点的权利都相同,通过各个节点自身的状态信息和群组共有信息独立产生各自的随机因子,并且根据所有参与节点的随机因子生成随机数,提高了随机数生成方法的随机性、公平性和安全性。
在一些实施方式中,所述生成第二随机数,包括:
对所述第一随机因子进行验证;
在所述第一随机因子通过验证后,根据所述第一随机因子以及所述目标随机因子生成所述第二随机数。
本公开实施例的区块链中随机数的生成方法,首先对收到的第一节点的第一随机因子进行验证,并根据自身生成的第二随机因子和第一随机因子生成第二随机数,保证了随机数生成的安全性。
在一些实施方式中,所述方法还包括:
对所述第二随机数进行取模计算,得到所述生成节点的节点编号;
若所述生成节点的节点编号与所述第二节点的节点号相同,则生成所述身份证书。
本公开实施例的区块链中随机数的生成方法,区块链网络中每个参与节点的权利都相同,通过各个节点自身的状态信息和群组共有信息独立产生各自的随机因子,并且根据所有参与节点的随机因子生成随机数,每个节点都可能作为生成节点,保证了生成节点确定的随机性,提高了区块链中每个节点权利的公平性。
在一些实施方式中,所述对所述第二随机数进行取模计算之前,还包括:
广播所述第二随机数;
接收所述第一节点生成的第一随机数;
对所述第一随机数和所述第二随机数进行验证;
其中,所述第一随机数根据所述第一随机因子和所述第二随机因子生成。
示例性地,所述第一随机数与所述第二随机数均根据所述第一随机因子和所述第二随机因子生成的,所以第一随机数与所述第二随机数相等。因此,可以通过判断所述第以随机数是否等于所述第二随机数来对所述第一随机数进行验证。
本公开实施例的区块链中随机数的生成方法,各个节点在对随机数进行取模之前,对自身生成的随机数与其余节点生成的随机数进行比对验证,避免了在随机因子的传输过程中被恶意篡改而导致生成错误的随机数,提高了身份证书的节点确定的安全性。
如图4所示,本公开实施例还提供一种区块链中随机数的生成装置400,应用于区块链网络中的第一节点,包括:
第一生成模块401,用于根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子并广播所述第一随机因子;
第一获取模块402,用于获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
第二生成模块403,用于根据所述第一随机因子以及所述第二随机因子,生成第一随机 数;
其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开实施例的区块链中随机数的生成装置,区块链网络中每个参与节点的权利都相同,通过各个节点自身的状态信息和群组共有信息独立产生各自的随机因子,并且根据所有参与节点的随机因子生成随机数,提高了随机数生成方法的随机性、公平性和安全性。
在一些实施方式中,所述装置还包括:
连接模块,用于与至少一个第二节点连接生成所述区块链网络;
发起模块,用于向所述区块链网络发起身份证书请求。
在一些实施方式中,所述生成模块,还用于:
对所述第二随机因子进行验证;
在所述第二随机因子通过验证后,根据所述第一随机因子以及所述第二随机因子生成所述第一随机数。
在一些实施方式中,所述装置还包括:
第一计算模块,用于对所述第一随机数进行取模计算,得到所述生成节点的节点编号;
第二获取模块,用于根据所述节点编号获取所述身份证书。
在一些实施方式中,所述第一计算模块,还用于:
广播所述第一随机数;
接收所述第二节点生成的第二随机数;
对所述第一随机数和所述第二随机数进行验证;
其中,所述第二随机数根据所述第一随机因子和所述第二随机因子生成。
在一些实施方式中,所述第二获取模块,还用于:
若所述生成节点的节点编号与所述第一节点的节点号相同,则生成所述身份证书;
若所述生成节点的节点编号与所述第一节点的节点号不同,则获取所述生成节点生成的所述身份证书。
如图5所示,本公开实施例还提供一种区块链中随机数的生成装置500,应用于区块链网络中的目标第二节点,包括:
第三生成模块501,用于在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;
第四生成模块502,用于根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括所述第一随机因子或第一随机因子和第三节点广播的第三随机因子;
其中,所述第三节点为所述区块链网络中除了所述第一节点和所述目标第二节点之外的节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
本公开实施例的区块链中随机数的生成装置,区块链网络中每个参与节点的权利都相同,通过各个节点自身的状态信息和群组共有信息独立产生各自的随机因子,并且根据所有参与节点的随机因子生成随机数,提高了随机数生成方法的随机性、公平性和安全性。
在一些实施方式中,所述第四生成模块,还用于:
对所述第一随机因子进行验证;
在所述第一随机因子通过验证后,根据所述第一随机因子以及所述第二随机因子生成所述第二随机数。
在一些实施方式中,所述装置还包括:
第二计算模块,用于对所述第二随机数进行取模计算,得到所述生成节点的节点编号;
第五生成模块,用于若所述生成节点的节点编号与所述第二节点的节点号相同,则生成所述身份证书。
在一些实施方式中,所述第二计算模块,还用于:
广播所述第二随机数;
接收所述第一节点生成的第一随机数;
对所述第一随机数和所述第二随机数进行验证;
其中,所述第一随机数根据所述第一随机因子和所述第二随机因子生成。
本公开实施例还提供一种区块链节点,包括:第一收发机和第一处理机;
所述第一处理机,用于根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子;
所述第一收发机,用于广播所述第一随机因子;
获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
所述第一处理机,还用于根据所述第一随机因子以及所述第二随机因子,生成第一随机数;
其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
在一些实施方式中,所述第一处理机,还用于与至少一个第二节点连接生成所述区块链网络;
所述第一收发机,还用于向所述区块链网络发起身份证书请求。
在一些实施方式中,所述第一处理机,还用于对所述第二随机因子进行验证;
在所述第二随机因子通过验证后,根据所述第一随机因子以及所述第二随机因子生成所述第一随机数。
在一些实施方式中,所述第一处理机,还用于对所述第一随机数进行取模计算,得到所述生成节点的节点编号;
根据所述节点编号获取所述身份证书。
在一些实施方式中,所述第一处理机,还用于若所述生成节点的节点编号与所述第一节点的节点号相同,则生成所述身份证书;
所述第一收发机,还用于若所述生成节点的节点编号与所述第一节点的节点号不同,则获取所述生成节点生成的所述身份证书。
在一些实施方式中,所述区块链节点为上述第一节点。
本公开实施例还提供一种区块链节点,包括:第二收发机和第二处理机;
所述第二收发机,用于接收第一节点广播的第一随机因子;
所述第二处理机,用于在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;
根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括所述第一随机因子或第一随机因子和第三节点广播的第三随机因子;
其中,所述第三节点为所述区块链网络中除了所述第一节点和目标第二节点之外的节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
在一些实施方式中,所述第二处理机,还用于对所述第一随机因子进行验证;
在所述第一随机因子通过验证后,根据所述第一随机因子以及所述目标随机因子生成所述第二随机数。
在一些实施方式中,所述第二处理机,还用于对所述第二随机数进行取模计算,得到所述生成节点的节点编号;
若所述生成节点的节点编号与所述第二节点的节点号相同,则生成所述身份证书。
在一些实施方式中,所述区块链节点为上述目标第二节点。
本公开另一实施例的一种终端设备,如图6所示,包括收发机610、处理器600、存储器620及存储在所述存储器620上并可在所述处理器600上运行的程序或指令;所述处理器600执行所述程序或指令时实现上述应用于区块链中随机数的生成方法。
所述收发机610,用于在处理器600的控制下接收和发送数据。
其中,在图6中,总线架构可以包括任意数量的互联的总线和桥,具体由处理器600代表的一个或多个处理器和存储器620代表的存储器的各种电路链接在一起。总线架构还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路链接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口提供接口。收发机610可以是多个元件,即包括发送机和接收机,提供用于在传输介质上与各种其他装置通信的单元。
处理器600负责管理总线架构和通常的处理,存储器620可以存储处理器600在执行操作时所使用的数据。
本公开实施例的一种可读存储介质,其上存储有程序或指令,所述程序或指令被处理器执行时实现如上所述的区块链中随机数的生成方法中的步骤,且能达到相同的技术效果,为避免重复,这里不再赘述。
其中,所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器(Read-Only Memory,简称ROM)、随机存取存储器(Random Access Memory,简称RAM)、磁碟或者光盘等。
本公开实施例还提供一种计算机程序,包括计算机可读代码,在所述计算机可读代码在区块链节点(如第一节点;又如目标第二节点)中运行的情况下,所述区块链节点(如第一节点;又如目标第二节点)中的处理器执行用于实现上述方法中的部分或全部步骤。
本公开实施例还提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序被计算机读取并执行时,实现上述方法中的部分或全部步骤。该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一些实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一些实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。
进一步需要说明的是,此说明书中所描述的终端包括但不限于智能手机、平板电脑等,且所描述的许多功能部件都被称为模块,以便更加特别地强调其实现方式的独立性。
本公开实施例中,模块可以用软件实现,以便由各种类型的处理器执行。举例来说,一个标识的可执行代码模块可以包括计算机指令的一个或多个物理或者逻辑块,举例来说,其可以被构建为对象、过程或函数。尽管如此,所标识模块的可执行代码无需物理地位于一起,而是可以包括存储在不同位里上的不同的指令,当这些指令逻辑上结合在一起时,其构成模块并且实现该模块的规定目的。
实际上,可执行代码模块可以是单条指令或者是许多条指令,并且甚至可以分布在多个不同的代码段上,分布在不同程序当中,以及跨越多个存储器设备分布。同样地,操作数据可以在模块内被识别,并且可以依照任何适当的形式实现并且被组织在任何适当类型的数据结构内。所述操作数据可以作为单个数据集被收集,或者可以分布在不同位置上(包括在不同存储设备上),并且至少部分地可以仅作为电子信号存在于系统或网络上。
在模块可以利用软件实现时,考虑到现有硬件工艺的水平,所以可以以软件实现的模块,在不考虑成本的情况下,本领域技术人员都可以搭建对应的硬件电路来实现对应的功能,所述硬件电路包括常规的超大规模集成(VLSI)电路或者门阵列以及诸如逻辑芯片、晶体管之类的现有半导体或者是其它分立的元件。模块还可以用可编程硬件设备,诸如现场可编程门阵列、可编程阵列逻辑、可编程逻辑设备等实现。
上述范例性实施例是参考该些附图来描述的,许多不同的形式和实施例是可行而不偏离本公开精神及教示,因此,本公开不应被建构成为在此所提出范例性实施例的限制。更确切地说,这些范例性实施例被提供以使得本公开会是完善又完整,且会将本公开范围传达给那些熟知此项技术的人士。在该些图式中,组件尺寸及相对尺寸也许基于清晰起见而被夸大。在此所使用的术语只是基于描述特定范例性实施例目的,并无意成为限制用。如在此所使用地,除非该内文清楚地另有所指,否则该单数形式“一”、“一个”和“该”是意欲将该些多个形式也纳入。会进一步了解到该些术语“包含”及/或“包括”在使用于本说明书时,表示所述特征、整数、步骤、操作、构件及/或组件的存在,但不排除一或更多其它特征、整数、步骤、操作、构件、组件及/或其族群的存在或增加。除非另有所示,陈述时,一值范围包含 该范围的上下限及其间的任何子范围。
以上所述是本公开的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本公开所述原理的前提下,还可以作出若干改进和润饰,这些改进和润饰也应视为本公开的保护范围。

Claims (26)

  1. 一种区块链中随机数的生成方法,应用于区块链网络中的第一节点,所述方法包括:
    根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子并广播所述第一随机因子;
    获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
    根据所述第一随机因子以及所述第二随机因子,生成第一随机数;
    其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
  2. 根据权利要求1所述的区块链中随机数的生成方法,其中,所述根据第一区块信息以及所述区块链网络中节点的数量生成随机因子之前,所述方法还包括:
    与至少一个第二节点连接生成所述区块链网络;
    向所述区块链网络发起身份证书请求。
  3. 根据权利要求1所述的区块链中随机数的生成方法,其中,所述生成第一随机数,包括:
    对所述第二随机因子进行验证;
    在所述第二随机因子通过验证后,根据所述第一随机因子以及所述第二随机因子生成所述第一随机数。
  4. 根据权利要求1所述的区块链中随机数的生成方法,其中,所述方法还包括:
    对所述第一随机数进行取模计算,得到所述生成节点的节点编号;
    根据所述节点编号获取所述身份证书。
  5. 根据权利要求4所述的区块链中随机数的生成方法,其中,所述对所述第一随机数进行取模计算之前,所述方法还包括:
    广播所述第一随机数;
    接收所述第二节点生成的第二随机数;
    对所述第一随机数和所述第二随机数进行验证;
    其中,所述第二随机数根据所述第一随机因子和所述第二随机因子生成。
  6. 根据权利要求5所述的区块链中随机数的生成方法,其中,所述根据所述节点编号获取所述身份证书,包括:
    若所述生成节点的节点编号与所述第一节点的节点号相同,则生成所述身份证书;
    若所述生成节点的节点编号与所述第一节点的节点号不同,则获取所述生成节点生成的所述身份证书。
  7. 根据权利要求5所述的区块链中随机数的生成方法,其中,所述身份证书的前发信息中包括所述生成节点的区块号。
  8. 一种区块链中随机数的生成方法,应用于区块链网络中的目标第二节点,所述方法包括:
    在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括所述第一随机因子或第一随机因子和第三节点广播的第三随机因子;
    其中,所述第三节点为所述区块链网络中除了所述第一节点和所述目标第二节点之外的节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
  9. 根据权利要求8所述的区块链中随机数的生成方法,其中,所述生成第二随机数,包括:
    对所述第一随机因子进行验证;
    在所述第一随机因子通过验证后,根据所述第一随机因子以及所述目标随机因子生成所 述第二随机数。
  10. 根据权利要求8所述的区块链中随机数的生成方法,其中,所述方法还包括:
    对所述第二随机数进行取模计算,得到所述生成节点的节点编号;
    若所述生成节点的节点编号与所述第二节点的节点号相同,则生成所述身份证书。
  11. 根据权利要求10所述的区块链中随机数的生成方法,其中,所述对所述第二随机数进行取模计算之前,所述方法还包括:
    广播所述第二随机数;
    接收所述第一节点生成的第一随机数;
    对所述第一随机数和所述第二随机数进行验证;
    其中,所述第一随机数根据所述第一随机因子和所述第二随机因子生成。
  12. 一种区块链中随机数的生成装置,应用于区块链网络中的第一节点,所述装置包括:
    第一生成模块,用于根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子并广播所述第一随机因子;
    第一获取模块,用于获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
    第二生成模块,用于根据所述第一随机因子以及所述第二随机因子,生成第一随机数;
    其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
  13. 根据权利要求12所述的区块链中随机数的生成装置,其中,所述装置还包括:
    连接模块,用于与至少一个第二节点连接生成所述区块链网络;
    发起模块,用于向所述区块链网络发起身份证书请求。
  14. 根据权利要求12所述的区块链中随机数的生成装置,其中,所述生成模块,还用于:
    对所述第二随机因子进行验证;
    在所述第二随机因子通过验证后,根据所述第一随机因子以及所述第二随机因子生成所述第一随机数。
  15. 根据权利要求12所述的区块链中随机数的生成装置,其中,所述装置还包括:
    第一计算模块,用于对所述第一随机数进行取模计算,得到所述生成节点的节点编号;
    第二获取模块,用于根据所述节点编号获取所述身份证书。
  16. 根据权利要求15所述的区块链中随机数的生成装置,其中,所述第一计算模块,还用于:
    广播所述第一随机数;
    接收所述第二节点生成的第二随机数;
    对所述第一随机数和所述第二随机数进行验证;
    其中,所述第二随机数根据所述第一随机因子和所述第二随机因子生成。
  17. 根据权利要求15所述的区块链中随机数的生成装置,其中,所述第二获取模块,还用于:
    若所述生成节点的节点编号与所述第一节点的节点号相同,则生成所述身份证书;
    若所述生成节点的节点编号与所述第一节点的节点号不同,则获取所述生成节点生成的所述身份证书。
  18. 一种区块链中随机数的生成装置,应用于区块链网络中的目标第二节点,所述装置包括:
    第三生成模块,用于在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;
    第四生成模块,用于根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括第一随机因子或第一随机因子和第三节点广播的第三随机因子;
    其中,所述第三节点为所述区块链网络中除了所述第一节点和所述目标第二节点之外的 节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
  19. 根据权利要求18所述的区块链中随机数的生成装置,其中,所述第四生成模块,还用于:
    对所述第一随机因子进行验证;
    在所述第一随机因子通过验证后,根据所述第一随机因子以及所述目标随机因子生成所述第二随机数。
  20. 根据权利要求18所述的区块链中随机数的生成装置,其中,所述装置还包括:
    第二计算模块,用于对所述第二随机数进行取模计算,得到所述生成节点的节点编号;
    第五生成模块,用于若所述生成节点的节点编号与所述第二节点的节点号相同,则生成所述身份证书。
  21. 根据权利要求20所述的区块链中随机数的生成装置,其中,所述第二计算模块,还用于:
    广播所述第二随机数;
    接收所述第一节点生成的第一随机数;
    对所述第一随机数和所述第二随机数进行验证;
    其中,所述第一随机数根据所述第一随机因子和所述第二随机因子生成。
  22. 一种区块链节点,所述区块链节点为第一节点,包括:第一收发机和第一处理机;
    所述第一处理机,用于根据存储的区块信息以及所述区块链网络中节点的数量生成第一随机因子;
    所述第一收发机,用于广播所述第一随机因子;
    获取所述区块链网络中的至少一个第二节点在接收到所述第一随机因子之后生成的第二随机因子;
    所述第一处理机,还用于根据所述第一随机因子以及所述第二随机因子,生成第一随机数;
    其中,所述第一随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
  23. 一种区块链节点,所述区块链节点为目标第二节点,包括:第二收发机和第二处理机;
    所述第二收发机,用于接收第一节点广播的第一随机因子;
    所述第二处理机,用于在接收到第一节点广播的第一随机因子后,根据存储的区块信息以及所述区块链网络中节点的数量生成第二随机因子;
    根据所述第二随机因子以及目标随机因子,生成第二随机数;所述目标随机因子包括所述第一随机因子或第一随机因子和第三节点广播的第三随机因子;
    其中,所述第三节点为所述区块链网络中除了所述第一节点和所述目标第二节点之外的节点;所述第二随机数为与生成节点相关的随机数,所述生成节点为生成所述第一节点的身份证书的节点。
  24. 一种终端设备,包括:收发器、处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序或指令;其中,所述处理器执行所述程序或指令时实现如权利要求1-7任一项所述的区块链中随机数的生成方法,或者实现如权利要求8-11任一项所述的区块链中随机数的生成方法。
  25. 一种可读存储介质,其上存储有程序或指令,所述程序或指令被处理器执行时实现如权利要求1-7任一项所述的区块链中随机数的生成方法中的步骤,或者实现如权利要求8-11任一项所述的区块链中随机数的生成方法。
  26. 一种计算机程序产品,所述计算机程序产品包括计算机指令,在所述计算机指令在计算机设备上运行的情况下,使得所述计算机设备执行如权利要求1-7任一项所述的区块链 中随机数的生成方法,或者,使得所述计算机设备执行如权利要求8-11任一项所述的区块链中随机数的生成方法。
PCT/CN2022/130671 2021-12-07 2022-11-08 一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品 WO2023103689A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111480022.9 2021-12-07
CN202111480022.9A CN113867690B (zh) 2021-12-07 2021-12-07 一种区块链中随机数的生成方法、装置及区块链节点

Publications (1)

Publication Number Publication Date
WO2023103689A1 true WO2023103689A1 (zh) 2023-06-15

Family

ID=78986004

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/130671 WO2023103689A1 (zh) 2021-12-07 2022-11-08 一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品

Country Status (2)

Country Link
CN (1) CN113867690B (zh)
WO (1) WO2023103689A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113867690B (zh) * 2021-12-07 2022-03-04 中移(上海)信息通信科技有限公司 一种区块链中随机数的生成方法、装置及区块链节点

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200252211A1 (en) * 2019-01-31 2020-08-06 Cobinhood Ltd. Method for generating secure randomness on blockchain
CN112182612A (zh) * 2020-09-28 2021-01-05 平安科技(深圳)有限公司 一种随机数生成方法、装置、终端设备及存储介质
CN112636904A (zh) * 2020-11-17 2021-04-09 中信银行股份有限公司 随机数生成与验证方法、装置、电子设备及可读存储介质
CN113489584A (zh) * 2021-07-02 2021-10-08 北京泛融科技有限公司 一种区块链中随机数的处理方法、装置和电子设备
CN113867690A (zh) * 2021-12-07 2021-12-31 中移(上海)信息通信科技有限公司 一种区块链中随机数的生成方法、装置及区块链节点

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11449864B2 (en) * 2017-10-31 2022-09-20 R3 Ltd. Reissuing obligations to preserve privacy
CN108924252B (zh) * 2018-07-31 2021-06-04 泰链(厦门)科技有限公司 区块链系统中减轻节点存储负荷的方法、介质及区块链系统
CN109948371B (zh) * 2019-03-07 2021-06-25 深圳市智税链科技有限公司 为区块链节点发放身份证书的方法及相关装置
CN110348830B (zh) * 2019-06-20 2022-09-27 国家信息中心 一种基于区块链的网络系统、认证方法、设备及存储介质
CN110505305B (zh) * 2019-08-27 2022-04-01 深圳市迅雷网络技术有限公司 一种区块链分片方法、装置及区块链系统
CN110941418B (zh) * 2019-11-26 2022-04-01 杭州浮云网络科技有限公司 一种随机数生成的方法、装置、设备及可读存储介质
CN111159288B (zh) * 2019-12-16 2023-04-28 郑杰骞 链式结构数据存储、验证、实现方法、系统、装置及介质
CN113010894B (zh) * 2020-06-12 2022-12-09 腾讯科技(深圳)有限公司 一种数据处理方法、装置及计算机可读存储介质
CN111865587B (zh) * 2020-08-07 2021-08-31 腾讯科技(深圳)有限公司 数据处理方法、区块链节点设备、电子设备及计算机程序
CN112347453B (zh) * 2020-11-11 2022-05-24 公安部交通管理科学研究所 一种汽车电子标识内嵌nfc芯片的数据安全写入方法及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200252211A1 (en) * 2019-01-31 2020-08-06 Cobinhood Ltd. Method for generating secure randomness on blockchain
CN112182612A (zh) * 2020-09-28 2021-01-05 平安科技(深圳)有限公司 一种随机数生成方法、装置、终端设备及存储介质
CN112636904A (zh) * 2020-11-17 2021-04-09 中信银行股份有限公司 随机数生成与验证方法、装置、电子设备及可读存储介质
CN113489584A (zh) * 2021-07-02 2021-10-08 北京泛融科技有限公司 一种区块链中随机数的处理方法、装置和电子设备
CN113867690A (zh) * 2021-12-07 2021-12-31 中移(上海)信息通信科技有限公司 一种区块链中随机数的生成方法、装置及区块链节点

Also Published As

Publication number Publication date
CN113867690A (zh) 2021-12-31
CN113867690B (zh) 2022-03-04

Similar Documents

Publication Publication Date Title
CN108881187B (zh) 一种适用于许可链场景的跨链数据传递方法及设备
US11522698B2 (en) Method and system for byzantine fault-tolerance replicating of data
US20210256007A1 (en) Blockchain system and blockchain transaction data processing method based on ethereum
WO2022095244A1 (zh) 跨链交易方法、系统、装置、设备和存储介质
US20220239496A1 (en) Blockchain consensus method, device and system
CN112651037B (zh) 区块链系统的链外数据访问方法和系统
CN112615915B (zh) 一种在私有链之间构建联盟链的方法
WO2021031741A1 (zh) 网络电话处理方法、装置及终端
CN113127569A (zh) 用于区块链系统的共识方法、装置、电子设备及存储介质
WO2023103689A1 (zh) 一种区块链中随机数的生成方法、装置、区块链节点、存储介质和计算机程序产品
JP6920442B2 (ja) ブロックチェーンシステムのノード間の通信を確立するための方法及びデバイス
WO2023184881A1 (zh) 提案共识执行方法、区块链系统、设备和存储介质
WO2022041902A1 (zh) 数据处理方法及装置
CN114338715A (zh) 数据同步方法、区块链系统、终端设备及存储介质
WO2018032817A1 (zh) 一种一致性数据累积协同组装方法
US20220294637A1 (en) System and Method of Establishing a Trusted Relationship in a Distributed System
CN113904854B (zh) 一种基于商密算法的区块链数据加密方法及装置
CN110990790A (zh) 一种数据处理方法及设备
CN111385096B (zh) 一种区块链网络系统、签名处理方法、终端及存储介质
US20240073045A1 (en) Blockchain-based data processing method and apparatus, device, medium, and product
CN112261427B (zh) 恶意节点的识别方法及装置、电子设备
CN111061813B (zh) 用于区块链网络中的数据同步的方法、装置和计算设备
WO2024103854A1 (zh) 跨链交易方法、系统、电子设备及存储介质
CN117370460A (zh) 基于双链存储的区块链存储优化方法及装置
CN112131602B (zh) 基于可信计算进行节点间信任关系快速扩展的方法、装置及相关产品

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22903112

Country of ref document: EP

Kind code of ref document: A1