Method, device and medium for obtaining and generating random numbers

The hashing processing of timestamps and transaction IDs generates a random number of preset digits, which solves the problem of inconsistency between random numbers between nodes and realizes the successful execution of write chain operations.

CN111930343BActive Publication Date: 2025-08-29INSPUR YUNZHOU (SHANDONG) IND INTERNET CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010517185.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-09
Publication Date
2025-08-29
Estimated Expiration
2040-06-09

AI Technical Summary

Technical Problem

In the prior art, the random numbers obtained by each node are different, resulting in inconsistent chain code operation results and failure of chain write operation.

Method used

By splicing the timestamp with the transaction ID and hashing calculations, a number with a preset number is generated, and the corresponding random number number is determined in the random number library to ensure that each node obtains the same random number.

Benefits of technology

It ensures that the random numbers obtained by each node are consistent and ensures that the write chain operation is successful.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111930343B_ABST
    Figure CN111930343B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device and medium for obtaining and generating random numbers, including: when each node needs a random number, calling the random number acquisition method in the random number chain code, inputting the timestamp and transaction ID into the random number chain code, and outputting a number with a preset number of digits; using the number with the preset number of digits as the serial number corresponding to the random number in the pre-stored random number library; determining the first random number corresponding to the serial number in the random number library, and sending the first random number to each node. The embodiment of the present application determines the corresponding random number in the pre-stored random number library through the timestamp and transaction ID, and sends the random number to each node. Due to the uniqueness of the timestamp and transaction ID, the random number obtained by each node is also the same, which can ensure the success of the write chain operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, and medium for obtaining and generating random numbers. Background Art

[0002] Random numbers are the cornerstone of information security systems based on modern cryptography. They are widely used in blockchain-based transactions.

[0003] In the prior art, when each node obtains a random number, since each node obtains a different random number when executing the chain code, the results of the chain code operation may be inconsistent, and the chain write operation will fail. Summary of the Invention

[0004] In view of this, the embodiments of the present application provide a method, device and medium for obtaining and generating random numbers, which are used to solve the problem in the prior art that the random numbers obtained by each node may be different, resulting in the failure of the write chain operation.

[0005] The embodiments of this application adopt the following technical solutions:

[0006] This embodiment of the present application provides a method for obtaining a random number, the method comprising:

[0007] When each node needs a random number, it calls the get random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number with a preset number of digits;

[0008] Using the number of the preset digits as the serial number corresponding to the random number in the pre-stored random number library;

[0009] A first random number corresponding to the serial number is determined in the random number library, and the first random number is sent to each node.

[0010] Furthermore, the step of inputting the timestamp and transaction ID into the random number chain code and outputting a number of preset digits specifically includes:

[0011] Inputting the timestamp and the transaction ID into the random number chain code so that the random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID to obtain a first hash value; processing the first hash value and outputting it as a number with a preset number of digits.

[0012] Furthermore, the random number chain code concatenates the input timestamp and the transaction ID, performs hash calculation on the concatenated timestamp and the transaction ID to obtain a first hash value; and processes the first hash value and outputs it as a number of preset digits, specifically including:

[0013] The random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID, and obtains a first hexadecimal hash value; intercepts the last five digits of the first hash value, converts the intercepted first hash value into a decimal number, divides it by 10000, and obtains the remainder, and then adds 1 to the remainder to obtain the number of the preset number of digits.

[0014] Furthermore, the transaction ID is a second hash value obtained by performing a hash calculation on the identity information of the transaction initiating node and a second random number, wherein the second random number is generated by a random number generator.

[0015] The present invention also provides a method for generating a random number, wherein the method includes:

[0016] Within a preset period, call the write random number method in the random number chain code, input the timestamp and transaction ID into the random number chain code, generate multiple random numbers, and mark each random number with a corresponding serial number;

[0017] A plurality of random numbers and a serial number corresponding to each random number are stored in a random number library.

[0018] Furthermore, before marking each random number with a corresponding serial number, the method further includes:

[0019] The number of serial numbers is set, and when the generated random number exceeds the number of serial numbers, the random number is marked by the first serial number.

[0020] Furthermore, the timestamp and transaction ID are input into the random number chain code to generate multiple random numbers, specifically including:

[0021] The timestamp and the transaction ID are input into the random number chain code, so that the random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID, and generates multiple random numbers.

[0022] An embodiment of the present application further provides a device for obtaining a random number, the device comprising:

[0023] at least one processor; and,

[0024] a memory communicatively connected to the at least one processor; wherein,

[0025] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0026] When each node needs a random number, it calls the get random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number with a preset number of digits;

[0027] Using the number of the preset digits as the serial number corresponding to the random number in the pre-stored random number library;

[0028] A first random number corresponding to the serial number is determined in the random number library, and the first random number is sent to each node.

[0029] The embodiment of the present application further provides a medium for obtaining a random number, which stores computer-executable instructions, wherein the computer-executable instructions are configured to:

[0030] When each node needs a random number, it calls the get random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number with a preset number of digits;

[0031] Using the number of the preset digits as the serial number corresponding to the random number in the pre-stored random number library;

[0032] A first random number corresponding to the serial number is determined in the random number library, and the first random number is sent to each node.

[0033] An embodiment of the present application further provides a device for generating a random number, the device comprising:

[0034] at least one processor; and,

[0035] a memory communicatively connected to the at least one processor; wherein,

[0036] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0037] Within a preset period, call the write random number method in the random number chain code, input the timestamp and transaction ID into the random number chain code, generate multiple random numbers, and mark each random number with a corresponding serial number;

[0038] A plurality of random numbers and a serial number corresponding to each random number are stored in a random number library.

[0039] At least one of the above technical solutions employed in the embodiments of this application can achieve the following beneficial effects: The embodiments of this application use the timestamp and transaction ID to determine the corresponding random number from a pre-stored random number library and send the random number to each node. Due to the uniqueness of the timestamp and transaction ID, the random number obtained by each node is the same, ensuring the success of the write chain operation. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0041] Figure 1 A flowchart of a method for obtaining a random number provided in Example 1 of this specification;

[0042] Figure 2 This is a flowchart of a method for generating random numbers provided in Example 2 of this specification. DETAILED DESCRIPTION

[0043] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0044] The following describes in detail the technical solutions provided by various embodiments of the present application in conjunction with the accompanying drawings.

[0045] Figure 1 This is a flowchart of a method for obtaining a random number provided in Example 1 of this specification. In this embodiment of the specification, the random number acquisition system may perform the following steps, specifically including:

[0046] Step S101: When each node needs a random number, the random number acquisition system calls the random number acquisition method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number of preset digits.

[0047] In step S101 of the embodiment of this specification, each node may include a transaction initiating node and a participating node, and the timestamp is set by the transaction initiating node. For example, the transaction initiating node may set the timestamp to 14:13:12 on May 15, 2020.

[0048] In step S101 of the embodiments of this specification, the transaction ID is a second hash value obtained by hashing the identity information of the transaction initiating node with a second random number, where the second random number can be generated by a random number generator. This indicates that the transaction ID is unique. The identity information of the transaction initiating node can be its identification information or private key.

[0049] In step S101 of the embodiment of this specification, the timestamp and transaction ID are input into the random number chain code, and a number of preset digits is output, which may specifically include:

[0050] Inputting the timestamp and the transaction ID into the random number chain code so that the random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID to obtain a first hash value; processing the first hash value and outputting it as a number with a preset number of digits.

[0051] Furthermore, the number of preset digits may be a number between 1 and 10000. The random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID, and obtains a first hash value. Processing the first hash value and outputting it as a number of preset digits may specifically include:

[0052] The random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID, and obtains a first hexadecimal hash value; intercepts the last five digits of the first hash value, converts the intercepted first hash value into a decimal number, divides it by 10000, and obtains the remainder, and then adds 1 to the remainder to obtain the number of the preset number of digits.

[0053] In step S102, the random number acquisition system uses the number of preset digits as a serial number corresponding to a random number in a pre-stored random number library.

[0054] In step S102 of the embodiment of this specification, each random number in the random number library has a serial number, and a number with a preset number of digits can be used as the serial number corresponding to the random number in the random number library. For example, if the number with the preset number of digits is 9456, 9456 can be used as the serial number corresponding to the random number in the random number library.

[0055] In step S103 , the random number acquisition system determines a first random number corresponding to the serial number in the random number library, and sends the first random number to each node.

[0056] In step S103 of the embodiment of this specification, for example, the determined serial number is 9456, and a corresponding random number can be determined in the random number library based on the serial number.

[0057] It should be noted that since the timestamp and transaction ID of each node are the same, the random numbers generated are also the same.

[0058] This embodiment of the application uses the timestamp and transaction ID to determine the corresponding random number from a pre-stored random number library and sends the random number to each node. Due to the uniqueness of the timestamp and transaction ID, the random number obtained by each node is also the same, which can ensure the success of the write chain operation.

[0059] Corresponding to the first embodiment of the specification, Figure 2 This is a flow chart of a method for generating random numbers provided in Example 2 of this specification. In this embodiment of the specification, the random number generation system can perform the following steps, specifically including:

[0060] Step S201: Within a preset period, the random number generation system calls the write random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, generates multiple random numbers, and marks each random number with a corresponding serial number.

[0061] In step S201 of the embodiment of this specification, the preset period can be set by a timer. For example, the timer can be set to call the write random number method in the random number chain code through the random number generation system every 10 seconds.

[0062] In step S201 of the embodiment of this specification, the timestamp is set by the transaction initiating node. For example, the transaction initiating node can set the timestamp to 14:13:12 on May 15, 2020.

[0063] In step S201 of the embodiments of this specification, the transaction ID is a second hash value obtained by hashing the identity information of the transaction initiating node with a second random number, where the second random number can be generated by a random number generator. This indicates that the transaction ID is unique. The identity information of the transaction initiating node can be its identification information or private key.

[0064] In step S201 of the embodiment of this specification, before labeling each random number with a corresponding serial number, the method further includes: setting a number of serial numbers, and when the generated random numbers exceed the number of serial numbers, labeling the random number with the first serial number. For example, the number of serial numbers is set to an upper limit of 10,000. When the random number generation system generates more than 10,000 random numbers, the 10001st random number is labeled with serial number 1.

[0065] In step S201 of the embodiment of this specification, the timestamp and transaction ID are input into the random number chain code to generate multiple random numbers, specifically including:

[0066] The timestamp and transaction ID are input into the random number chain code, which then concatenates the input timestamp and transaction ID and hashes the concatenated timestamp and transaction ID to generate multiple random numbers. The hashing of the concatenated timestamp and transaction ID generates a string that can be converted into a corresponding random number.

[0067] It should be noted that the timestamp cannot be set arbitrarily and should be equal to the current time as much as possible. The random number chain code will verify whether the error between the incoming timestamp and the current time exceeds the preset value. If it exceeds the preset value, the timestamp can be determined to be invalid. The preset value can be 1 minute.

[0068] In step S202, the random number generator stores a plurality of random numbers and a serial number corresponding to each random number in a random number library.

[0069] This embodiment of the application uses the timestamp and transaction ID to determine the corresponding random number from a pre-stored random number library and sends the random number to each node. Due to the uniqueness of the timestamp and transaction ID, the random number obtained by each node is also the same, which can ensure the success of the write chain operation.

[0070] An embodiment of the present application further provides a device for obtaining a random number, the device comprising:

[0071] at least one processor; and,

[0072] a memory communicatively connected to the at least one processor; wherein,

[0073] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0074] When each node needs a random number, it calls the get random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number with a preset number of digits;

[0075] Using the number of the preset digits as the serial number corresponding to the random number in the pre-stored random number library;

[0076] A first random number corresponding to the serial number is determined in the random number library, and the first random number is sent to each node.

[0077] The embodiment of the present application further provides a medium for obtaining a random number, which stores computer-executable instructions, wherein the computer-executable instructions are configured to:

[0078] When each node needs a random number, it calls the get random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number with a preset number of digits;

[0079] Using the number of the preset digits as the serial number corresponding to the random number in the pre-stored random number library;

[0080] A first random number corresponding to the serial number is determined in the random number library, and the first random number is sent to each node.

[0081] An embodiment of the present application further provides a device for generating a random number, the device comprising:

[0082] at least one processor; and,

[0083] a memory communicatively connected to the at least one processor; wherein,

[0084] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0085] Within a preset period, call the write random number method in the random number chain code, input the timestamp and transaction ID into the random number chain code, generate multiple random numbers, and mark each random number with a corresponding serial number;

[0086] A plurality of random numbers and a serial number corresponding to each random number are stored in a random number library.

[0087] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages ​​and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.

[0088] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.

[0089] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0090] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0091] It will be understood by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0092] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, 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 produce 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 flowcharts and / or block diagrams. 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.

[0093] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work 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 The function specified in one or more boxes.

[0094] 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 the instructions executed on the computer or other programmable device 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.

[0095] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.

[0096] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0097] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.

[0098] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.

[0099] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0100] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.

[0101] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.

Claims

1. A method for obtaining a random number, characterized in that: The method comprises: When each node needs a random number, it calls the get random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number with a preset number of digits; Using the number of the preset digits as the serial number corresponding to the random number in the pre-stored random number library; A first random number corresponding to the serial number is determined in the random number library, and the first random number is sent to each node.

2. The method for obtaining a random number according to claim 1, wherein: Inputting the timestamp and transaction ID into the random number chain code and outputting a number with a preset number of digits specifically includes: Inputting the timestamp and the transaction ID into the random number chain code so that the random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID to obtain a first hash value; processing the first hash value and outputting it as a number with a preset number of digits.

3. The method for obtaining a random number according to claim 2, wherein: The random number chain code concatenates the input timestamp and the transaction ID, and performs a hash calculation on the concatenated timestamp and the transaction ID to obtain a first hash value; Processing the first hash value and outputting it as a number with a preset number of digits specifically includes: The random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID, and obtains a first hexadecimal hash value; intercepts the last five digits of the first hash value, converts the intercepted first hash value into a decimal number, divides it by 10000, and obtains the remainder, and then adds 1 to the remainder to obtain the number of the preset number of digits.

4. The method for obtaining a random number according to any one of claims 1 to 3, wherein: The transaction ID is a second hash value obtained by performing a hash calculation on the identity information of the transaction initiating node and a second random number, wherein the second random number is generated by a random number generator.

5. A method for generating random numbers, characterized in that, The method comprises: Within a preset period, call the write random number method in the random number chain code, input the timestamp and transaction ID into the random number chain code, generate multiple random numbers, and mark each random number with a corresponding serial number; A plurality of random numbers and a serial number corresponding to each random number are stored in a random number library.

6. The method for generating random numbers according to claim 5, wherein: Before marking each random number with a corresponding serial number, the method further includes: The number of serial numbers is set, and when the generated random number exceeds the number of serial numbers, the random number is marked by the first serial number.

7. The method for generating random numbers according to claim 5, wherein: Inputting the timestamp and transaction ID into the random number chain code to generate multiple random numbers specifically includes: The timestamp and the transaction ID are input into the random number chain code, so that the random number chain code concatenates the input timestamp and the transaction ID, performs a hash calculation on the concatenated timestamp and the transaction ID, and generates multiple random numbers.

8. A device for obtaining a random number, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: When each node needs a random number, it calls the get random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number with a preset number of digits; Using the number of the preset digits as the serial number corresponding to the random number in the pre-stored random number library; A first random number corresponding to the serial number is determined in the random number library, and the first random number is sent to each node.

9. A medium for obtaining random numbers, storing computer-executable instructions, characterized in that: The computer executable instructions are configured to: When each node needs a random number, it calls the get random number method in the random number chain code, inputs the timestamp and transaction ID into the random number chain code, and outputs a number with a preset number of digits; Using the number of the preset digits as the serial number corresponding to the random number in the pre-stored random number library; A first random number corresponding to the serial number is determined in the random number library, and the first random number is sent to each node.

10. A device for generating random numbers, characterized in that The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Within a preset period, call the write random number method in the random number chain code, input the timestamp and transaction ID into the random number chain code, generate multiple random numbers, and mark each random number with a corresponding serial number; A plurality of random numbers and a serial number corresponding to each random number are stored in a random number library.

Citation Information

Patent Citations

  • Method and apparatus for generating private keys in batches based on block chains

    CN107276754A

  • Server testing method, system and device and computer readable storage medium

    CN111176918A