Blockchain-based pseudo-random number seed generation method and device

By generating and verifying pseudo-random number seeds on the blockchain, the security and efficiency issues of small-scale blockchain networks are solved, achieving unpredictable and tamper-resistant random seed generation, which is applicable to blockchains with various consensus mechanisms.

CN115765999BActive Publication Date: 2026-02-27HUNAN TIANHE WENLIAN TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211408125.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-10
Publication Date
2026-02-27
Estimated Expiration
2042-11-10

AI Technical Summary

Technical Problem

Existing blockchain random number generation schemes are vulnerable to attacks in small-scale blockchain networks, have high computational complexity, and cannot guarantee the confidentiality, tamper resistance, and collision resistance of random seeds.

Method used

High-quality pseudo-random numbers are generated by the transaction request node. Random number seeds are generated using hash and homomorphic encryption algorithms and signed and verified on the blockchain. Finally, unpredictable and tamper-resistant random seeds are generated. Validity is verified using transaction construction, seed retrieval and verification modules.

Benefits of technology

It enables the efficient generation of unpredictable, tamper-resistant, and publicly verifiable random seeds on the blockchain, avoiding 51% attacks and making it suitable for blockchain networks with various consensus mechanisms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115765999B_ABST
    Figure CN115765999B_ABST
Patent Text Reader

Abstract

The application provides a pseudo-random number seed generation method and device based on a blockchain, the method comprising: a transaction request node creating a high-quality pseudo-random number, hashing the pseudo-random number to obtain a random number seed, and attaching the random number seed to transaction data and signing the random number seed; the transaction request node publishing the transaction data signed by the digital signature to the blockchain, each transaction response node in the blockchain searching the random number seed to obtain a final random number seed, and verifying the validity of the final random number seed; and using the final random seed to generate a random number to participate in a block proposal process or as an input of a smart contract, and completing a complete transaction. Compared with related technologies, the pseudo-random number seed generation method and device based on the blockchain provided by the application can realize the generation of a secret, tamper-resistant, unpredictable, anti-collision and publicly verifiable random seed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of blockchains, and in particular to a method and device for generating pseudo-random number seeds based on blockchains. BACKGROUND

[0002] Random numbers play a very basic and important role in cryptography, and are often used for key and security parameter generation. In daily life, random numbers are also an important means of ensuring fairness and are widely used in sampling, drawing lots, and lotteries. Random numbers are also widely used in blockchains, in addition to traditional security scenarios such as key generation, and play an important role in popular scenarios such as consensus mechanisms and zero-knowledge proofs, protecting the security of blockchains. In a decentralized environment, it is easier to launch attacks on random numbers to gain benefits. So far, the security of blockchain random numbers remains a technical problem that needs to be addressed.

[0003] Patent CN201910980279.7 "Random number generation method, random number generation device and electronic equipment" discloses a random number generation method: generating a smart contract including an execution condition according to configuration information, and writing the smart contract to a blockchain; the blockchain system triggers the smart contract to execute when the execution condition is met; the random parameter in the blockchain is obtained according to the random seed generation method through the smart contract, and a random seed is generated based on the random parameter, and a random number is generated based on the random seed by calling the random function; random number generation method two: generating configuration information according to the input random seed generation method and random function; upload the configuration information to the blockchain network to generate a smart contract including an execution condition; the smart contract is used to automatically execute when the execution condition is met, to obtain the random parameter in the blockchain according to the random seed generation method, and to generate a random seed based on the random parameter and to generate a random number based on the random seed by calling the random function.

[0004] The above-mentioned random number generation scheme is to obtain a random seed based on a random parameter of a blockchain. For a distributed blockchain based on a PoS consensus mechanism, when the size and members of the chain are relatively small, an attacker may be able to control 51% of the computing power to determine the result of the next block write, thereby predicting the random seed obtained based on subsequent blockchain parameters and artificially controlling or tampering with it

[0005] Patent CN202010301113.0 "a kind of method, equipment and medium based on distributed protocol's block chain random number seed generation" discloses respectively receiving multiple user sent random number information, and the random number information is saved to block chain;Based on a certain order splicing multiple random number information, form new information;The new information is operated through hash function, obtains the hash value of the new information, and the hash value is used as random number seed.

[0006] When the number of selected target blocks is multiple, the calculation of random seed based on the random parameters of each target block can be nonlinear, and the patent does not detail the calculation time of nonlinearity, which means that the time of generating random seed can increase sharply with the increase of the number of participating blocks, leading to more complex calculation, thereby reducing the convenience of public verification of the remaining blockchain nodes.

[0007] Therefore, it is necessary to provide a new type of pseudo-random number seed generation method and device based on block chain to overcome the above defects. SUMMARY

[0008] The purpose of the present application is to provide a new type of pseudo-random number seed generation method and device based on block chain, which realizes the generation of secret, tamper-resistant, unpredictable, anti-collision and publicly verifiable random seed.

[0009] In order to achieve the above purpose, the present application provides a pseudo-random number seed generation method based on block chain, comprising:

[0010] The transaction request node creates a high-quality pseudo-random number, hashes the pseudo-random number to obtain a random number seed, and attaches the random number seed to the transaction data and signs it;

[0011] The transaction request node publishes the transaction data after digital signature to the block chain, and each transaction response node in the block chain retrieves the final random number seed to obtain the final random number seed, and verifies the validity of the final random number seed;

[0012] The final random seed is used to generate random number to participate in block proposal process or as input of smart contract, to complete complete transaction.

[0013] The present application also provides a device for generating pseudo-random number seed based on block chain, which comprises:

[0014] Transaction building module, for generating random number seed and performing encryption operation to generate encrypted seed;

[0015] A seed retrieval module is configured to calculate a random number seed and a Merkel seed, and generate a final random number seed by using the random number seed and the Merkel seed.

[0016] A seed verification module is configured to verify the validity of the final random number seed.

[0017] A block construction module is configured to generate a random number by using the final random number seed, participate in block construction, and thus complete a complete transaction data transaction.

[0018] The application further provides a computer readable storage medium storing a computer program, and the computer program is executed by a processor to implement the steps of the pseudo-random number seed generation method based on a block chain.

[0019] The application further provides a computer terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the pseudo-random number seed generation method based on a block chain when executing the computer program.

[0020] Compared with the related art, the application generates a random seed by registering a locally generated secret on a block chain, guarantees the secrecy of the random seed generation, and guarantees the unpredictability of the random seed generation; the mature hash algorithm and homomorphic encryption algorithm are adopted to guarantee the tamper resistance and collision resistance of the generated random seed; and the secret is attached to transaction data, so that the secret can be verified publicly. BRIEF DESCRIPTION OF DRAWINGS

[0021] In order to more clearly illustrate the technical solutions in the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiment description, and the drawings in the following description are only some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings, wherein:

[0022] Figure 1 The flowchart of the pseudo-random number seed generation method based on a block chain of the application;

[0023] Figure 2 The transaction construction flowchart of the pseudo-random number seed generation method based on a block chain of the application. DETAILED DESCRIPTION

[0024] The technical solutions in the embodiments of the application will be described clearly and completely below, obviously, the described embodiments are only some of the embodiments of the application, but not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the application.

[0025] Referring to Figure 1 and Figure 2 The application provides a pseudo-random number seed generation method based on a blockchain, comprising:

[0026] S1, a transaction request node creates a high-quality pseudo-random number, hashes the pseudo-random number to obtain a random number seed, and appends the random number seed to transaction data and signs the transaction data;

[0027] The method includes a single-secret random seed generation method and a double-secret random seed generation method.

[0028] A, based on the single-secret random seed generation method, the transaction request node is required to insert a secret in the transaction when creating, and once confirmed on the blockchain, it will be used as an immutable and publicly verifiable seed generator in the future.

[0029] Transaction construction: a transaction usually corresponds to a minimum business work unit, and in the blockchain, a transaction refers to a transaction, which is the most basic data structure in the blockchain. The single-secret random seed generation method includes three steps: the transaction request node uses the Schindler technology (a technology for quickly generating random numbers using a random number generator) to create a high-quality pseudo-random number (the most initial random seed); the pseudo-random number is hashed by a hash function to obtain a random number seed hash; the random number seed hash is appended to the transaction data, and the transaction data after appending is signed.

[0030] B, based on the double-secret random seed generation method, comprising:

[0031] Transaction construction:

[0032] 1) The transaction request node uses the Schindler technology to create a high-quality pseudo-random number (the most initial random seed).

[0033] 2) The transaction response node encrypts the encrypted random number seed using its public key (the same key as the transaction request node).

[0034] 3) The transaction response node calculates the encrypted seed of the transaction request node and adds it to the encrypted seed of the transaction response node. The calculation formula is:

[0035] SumEncr = OwnerSeedEncr + ProposerSeedEncr = encrypt(OwnerSeed) + encrypt(ProposerSeed);

[0036] SumEncr = Encrypt(OwnerSeedEncr, ProposerSeedEncr), OwnerSeedEncr: Owner Seed Encrypted, ProposerSeedEncr: Proposer Seed Encrypted, OwnerSeed: Owner Seed, ProposerSeed: Proposer Seed, Encrypt(): Encrypt.

[0037] 4) The transaction response node appends the accumulated encrypted seed data at the end of the transaction block.

[0038] S2, the transaction request node publishes the digitally signed transaction data to the blockchain, each transaction response node in the blockchain retrieves the final random number seed from the random number seed, and verifies the validity of the final random number seed;

[0039] Seed Retrieval: When the transaction record is on the blockchain, the random number seed hash is also published to the blockchain, and the seed retrieval is completed through the next two steps.

[0040] The transaction request node first hashes the Merkle root directory using the transaction identifier, and then calculates the Merkle seed from the transaction Merkle tree data;

[0041] The calculation formula of the transaction identifier is: OwnerSeedHash = Hash(OwnerSeed);

[0042] TransHash = Hash(TransData, OwnerSeedHash);

[0043] TransSign = Sign(TransHash, OwnerPrivK);

[0044] OwnerSeedHash: transaction owner seed hash, calculated by hashing the high-quality random seed generated by the owner, OwnerSeed: high-quality random seed generated by the transaction owner, TransHash: transaction hash, calculated by hashing the transaction data and the owner seed hash, TransData: transaction data, TransSign: transaction identifier, obtained by signing the transaction hash with a private key, Hash(): specifies the hash calculation, Sign(): refers to the signature calculation.

[0045] The final random seed is generated using the random number seed and the Merkle seed.

[0046] Once the transaction record is on the blockchain, each owner in the blockchain can retrieve its random seed, the owner uses its own private key to decrypt SumEncr, obtains the final random seed plaintext, and the decryption formula is: FinalSeed = decrypt (SumEncr) = OwnerSeed + ProposerSeed;

[0047] Wherein FinalSeed: final random seed, obtained by decrypting the encrypted cumulative value, SumEncr: encrypted cumulative value, OwnerSeed: owner seed, ProposerSeed: block proposer seed, Decrypt(): refers to the decryption calculation.

[0048] Seed public verification: when the transaction request node uses the final seed in the process of public verification, it must simultaneously disclose the random number seed and the final seed. The remaining nodes in the blockchain network verify the validity of the random number in the following steps:

[0049] The verification node first checks whether the random number seed is indeed the random number seed of the transaction request node;

[0050] Then the verification node will continue to check whether the final node seed is the hash of the random number seed and the Merkel seed;

[0051] The results of the above two steps are aggregated, and if both are true, the verification is successful, otherwise the verification fails.

[0052] In the single secret generation random seed method, part of the information of the final random seed (i.e. the Merkel seed) is put into the public domain, and the random number seed is always "kept secret" by the transaction request node until the transaction request node chooses to disclose it to the public domain for verification.

[0053] Block construction: using the generated final random seed to generate random numbers to participate in the block proposal process or as the input of the smart contract, complete the complete transaction

[0054] S3, using the final random seed to generate random numbers to participate in the block proposal process or as the input of the smart contract, complete the complete transaction.

[0055] Block construction uses the generated final random seed to generate random numbers to participate in the block proposal process or as the input of the smart contract, complete the complete transaction

[0056] The application also provides a pseudo-random number seed generation device based on a blockchain, which comprises:

[0057] A transaction construction module for generating a random number seed and performing an encryption operation to generate an encrypted seed;

[0058] A seed retrieval module is configured to calculate a random number seed and a Merkel seed, and generate a final random number seed by using the random number seed and the Merkel seed;

[0059] A seed verification module is configured to verify the validity of the final random number seed;

[0060] A block construction module is configured to generate a random number by using the final random number seed, participate in block construction, and complete a complete transaction data transaction.

[0061] Compared with the related art, the present application generates a random number based on a generated random number seed for each node, and provides a consensus node in a blockchain system, wherein the consensus algorithm adopted by the blockchain system outputs a consensus result by broadcasting a message from a transaction request node / transaction response node in the last stage, the consensus node encrypts and signs the random number seed and the Merkel seed by using a private key of the consensus node, and attaches the signature to a transaction block to be submitted, and the remaining nodes can obtain the complete random number seed by decryption through a broadcasted public key for verification, and the unique value of the original transaction list can include the original transaction list itself or a hash value of the original transaction list, a block number and / or a timestamp, and a random number seed generated in a previous transaction proposal block; the consensus node puts the obtained random number seed into a block header of a generated current block.

[0062] The present application generates a random seed based on a minimum execution unit transaction in a blockchain system, can run on a blockchain that cannot deploy a smart contract, can also run on a blockchain that can deploy a smart contract, and can achieve the generation of a secret, tamper-resistant, unpredictable, collision-resistant, and publicly verifiable random seed; the idea of registering a locally generated secret on a blockchain is used to generate a random seed, which can ensure the secrecy of the random seed generation, and the random seed generation is run in a completely decentralized manner, which ensures the unpredictability of the random seed generation, and the use of current mature hash algorithms and homomorphic encryption algorithms can ensure the tamper resistance and collision resistance of the generated random seed; the secret itself is attached to the transaction block, and can be publicly verified; in the step of generating a random seed, transaction generation, seed retrieval, and seed verification are all operations with a space complexity of O(n) and a time complexity of O(1), and the overall time complexity is O(1); the smallest complete data mechanism of all blockchain systems is a transaction, and no additional configuration information or service is required to ensure the generation of a random seed, so the random seed generation process will not encounter problems such as "51% attack"; the present application is not only suitable for a blockchain adopting a proof-of-work consensus mechanism, but also suitable for a blockchain adopting a consensus mechanism including but not limited to proof-of-stake and delegated proof-of-stake.

[0063] The application further provides a computer readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the blockchain-based pseudo-random number seed generation method.

[0064] The application further provides a computer terminal comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the blockchain-based pseudo-random number seed generation method when executing the computer program.

[0065] The processor implements the functions of each module / unit in the above-described device embodiments when executing the computer program. For example, the computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the application. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program in the terminal device.

[0066] The computer terminal can be a desktop computer, a notebook computer, a palm computer, a cloud server, or other computing devices. It can include, but is not limited to, a processor and a memory. It can include more or fewer components, or combine certain components, or different components, for example, it can also include an input / output device, a network access device, a bus, etc.

[0067] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0068] The memory can be an internal storage unit such as a hard disk or a memory. The memory can also be an external storage device such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like. Further, the memory can include both an internal storage unit and an external storage device. The memory is used to store the computer program and other programs and data. The memory can also be used to temporarily store data that has been output or is to be output.

[0069] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is taken as an example for description, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of mutual distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the system can refer to the corresponding process in the foregoing method embodiments, which will not be described here.

[0070] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0071] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0072] In the embodiments of the present application, it should be understood that the disclosed apparatus / terminal device and method can be implemented in other manners. For example, the embodiments of the apparatus / terminal device described above are merely schematic, and the division of the modules or units is merely logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0073] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments.

[0074] In addition, each functional unit in the various embodiments of the present application can be integrated into a processing unit, or each unit can be a physically independent unit, or two or more units can be integrated into a unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0075] The integrated module / unit, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the above-mentioned embodiment methods can be completed by a computer program instructing related hardware, and the computer program can be stored in a computer readable storage medium. When the processor executes the computer program, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable file or some intermediate form. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the computer readable medium can include appropriate contents according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.

[0076] The above merely illustrates the embodiments of the present application, and is not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process conversion, or direct or indirect application in other related technical fields, which is made according to the content of the present application, shall be included in the patent protection scope of the present application.

Claims

1. A method for generating pseudo-random number seeds based on blockchain, characterized in that, include: The transaction request node creates a high-quality pseudo-random number, hashes the pseudo-random number to obtain a pseudo-random number seed, appends the pseudo-random number seed to the transaction data, and signs it. The transaction request node publishes the digitally signed transaction data to the blockchain. Each transaction response node in the blockchain retrieves the pseudo-random number seed to obtain the final pseudo-random number seed and verifies the validity of the final pseudo-random number seed. Each transaction response node in the blockchain retrieves the seed by: hashing the Merkle root directory of the encrypted seed using a transaction identifier, and then calculating the Merkle seed from the transaction Merkle tree data; generating the final random seed using a pseudo-random number seed and the Merkle seed; and obtaining the plaintext of the final random seed by decryption by each transaction response node in the blockchain. The final random seed is used to generate pseudo-random numbers to participate in the block proposal process or as input to a smart contract to complete a full transaction.

2. The method for generating pseudo-random number seeds based on blockchain according to claim 1, characterized in that, The process of creating a high-quality pseudo-random number, hashing the pseudo-random number to obtain a pseudo-random number seed, appending the pseudo-random number seed to the transaction data, and signing it includes: The transaction request node uses Schindler technology to create a high-quality pseudo-random number and encrypts it with its public key to generate a cryptographic seed. The transaction response node calculates the cryptographic seed of the transaction request node and adds it to its own cryptographic seed; The transaction response node appends accumulated cryptographic seed data to the end of the transaction data and signs the appended transaction data.

3. The method for generating pseudo-random number seeds based on blockchain according to claim 1, characterized in that, The validity verification of the pseudo-random number seed includes: Check whether the pseudo-random number seed is indeed the pseudo-random number seed of the node that issued the transaction request; Check if the final node seed is a hash of the pseudo-random number seed and the Merkel seed; Combine the results of the two steps above. If both are true, the verification is successful; otherwise, the verification fails.

4. The method for generating pseudo-random number seeds based on blockchain according to claim 1, characterized in that, The formula for calculating the transaction identifier is as follows: OwnerSeedHash = Hash(OwnerSeed); TransHash = Hash(TransData,OwnerSeedHash); TransSign = Sign(TransHash, OwnerPrivK); OwnerSeedHash: Owner seed hash, obtained by hashing the high-quality random seed generated by the owner; OwnerSeed: High-quality random seed generated by the owner; TransHash: Transaction hash, obtained by hashing the transaction data and the owner seed hash; TransData: Transaction data; TransSign: Transaction identifier, obtained by signing the transaction hash with the private key; Hash(): Specifies to perform hash calculation; Sign(): Specifies to perform signature calculation.

5. An apparatus for applying the blockchain-based pseudo-random number seed generation method as described in any one of claims 1-4, characterized in that, The device includes: The transaction building module is used to generate pseudo-random number seeds and perform encryption operations to generate encryption seeds; The seed retrieval module is used to calculate the pseudo-random number seed and the Merkel seed, and to generate the final pseudo-random number seed using the pseudo-random number seed and the Merkel seed. The seed verification module is used to verify the validity of the final pseudo-random number seed; The block building module is used to generate pseudo-random numbers through the final pseudo-random number seed, which participate in block building to complete the complete transaction data transaction.

6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the blockchain-based pseudo-random number seed generation method as described in any one of claims 1 to 4.

7. A computer terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the blockchain-based pseudo-random number seed generation method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Random number generation methods, random number generation devices and electronic equipment

    CN110780847B

  • Distributed mining method, mining machine and block chain system

    CN109242299A

  • Block chain random number seed generation method and device based on distributed protocol, and medium

    CN111596890A