CN109450629B - Random number generation method based on block chain - Google Patents
Random number generation method based on block chain Download PDFInfo
- Publication number
- CN109450629B CN109450629B CN201811569340.0A CN201811569340A CN109450629B CN 109450629 B CN109450629 B CN 109450629B CN 201811569340 A CN201811569340 A CN 201811569340A CN 109450629 B CN109450629 B CN 109450629B
- Authority
- CN
- China
- Prior art keywords
- random number
- block
- hash
- random
- block chain
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0861—Generation of secret information including derivation or calculation of cryptographic keys or passwords
- H04L9/0869—Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/06—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
- H04L9/0643—Hash functions, e.g. MD5, SHA, HMAC or f9 MAC
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/08—Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
- H04L9/0816—Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
- H04L9/0819—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s)
- H04L9/083—Key transport or distribution, i.e. key establishment techniques where one party creates or otherwise obtains a secret value, and securely transfers it to the other(s) involving central third party, e.g. key distribution center [KDC] or trusted third party [TTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/30—Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
- H04L9/3066—Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy involving algebraic varieties, e.g. elliptic or hyper-elliptic curves
Abstract
The invention discloses a block chain-based random number generation method, which comprises the following steps: 1) searching random numbers for block chain link points; 2) traversing the next block from the current block to the front; 3) confirming whether the block has random numbers; if not, entering the next step; 4) confirming whether the block has been accumulatively traversed to the X block; if yes, entering the next step; 5) the random number is generated by calculation. The invention provides a random number generation method based on a block chain, which has high safety and can verify the correctness of random numbers.
Description
Technical Field
The invention relates to the technical field of random number generation, in particular to a block chain-based random number generation method.
Background
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. The consensus mechanism is a mathematical algorithm for establishing trust and obtaining rights and interests among different nodes in the blockchain system. The blockchain is the underlying technology of bitcoin, like a database ledger, which records all transaction records. The technology is also gradually paid attention to the banking and financial industries due to the characteristics of safety and convenience.
In the existing block chain technology, a future block Hash is generally used as a random number seed of the block chain, and a scheme for generating random numbers by itself is the most used scheme in the past months, and the problem of the scheme is that: the tile producer may "control" the generated random numbers by adding or discarding packed portions of the transaction. So far, the logic of the prediction machine has remained at the discussion level, there is no practical application, and a "trusted prediction machine" is more difficult to persuade the consumer than a "trusted block producer".
A few block chain backbones employ random numbers that are generated into the cost block by a trusted block producer. This scheme is more suitable for alliance chain and private chain, because all block producers are trusted in alliance, but not all block producers are good in public chain, and a certain verification mechanism is needed on a secure public chain to ensure the trustworthiness of the block producers.
Chinese patent application No.: 201710676105.2, filing date: 08 month 09, 2017, published day: 24/11/2017, the patent names are: the invention discloses a random number generation method and a system of a block chain, and the random number generation method of the block chain comprises the steps that each authorization node of the block chain generates a sub-random number; dividing the generated sub-random numbers into N fragments; each authorization node of the block chain sends the N fragments to the block chain authorization nodes respectively; encrypting the N fragments of the sub-random number; respectively sending the encrypted results to N block chain authorization nodes; the block chain authorization node decrypts the block chain authorization node; sending the decrypted sub-random number fragments to an authorization node for assembling random numbers; the authorization node for assembling the random number recovers the sub-random number which arrives first; the authorization node assembling the random number assembles the recovered sub-random numbers into a final random number. The invention can ensure that producer nodes of a plurality of sub-random numbers can not generate random numbers under the condition that other nodes generate sub-random numbers, and the assembly node is recovered preferentially and assembles the final random number by using the sub-random number which arrives first, so as to achieve the aim of being incapable of tampering data.
Although the above patent document discloses a random number generation method based on a block chain, the random number generated by the method is unstable and not high enough in security, and it is impossible to verify whether the generated random number is valid, which affects the operation of the random number.
Disclosure of Invention
In view of the above, the present invention provides a random number generation method based on block chain, which is highly safe and can verify the correctness of the random number.
In order to realize the purpose of the invention, the following technical scheme can be adopted:
a block chain-based random number generation method comprises the following steps:
step 1) searching random numbers for block chain link points;
step 2) traversing the next block from the current block to the front;
step 3) confirming whether the block has the random number or not; if not, entering the next step;
step 4) confirming whether the block has been accumulated and traversed the X block; if yes, entering the next step;
and 5) generating a random number through calculation.
The step 2) comprises searching a block;
the step 3) includes collecting the random number if the random number exists in the block.
The step 5) is to calculate the random number by an elliptic function F.
The step 5) further includes writing the calculated random number into the current block.
The random number generation method also comprises the step that other blockchain nodes verify whether the random number generated by the current block is correct.
The verification method comprises the following steps:
step 1) receiving a block produced by a current block producer node, and acquiring a random number in the block;
step 2) obtaining a characteristic value of a previous block of the node production block;
step 3) calculating v _ hash by using the random number and the committed previous block characteristic value;
step 4) comparing whether the v _ hash is consistent with the commitment next _ random _ hash; if yes, entering the next step;
and 5) confirming that the random number is a valid random number.
Said step 1) comprises querying the block chain for the next _ random _ hash commitment of the random number.
The step 3) of calculating the v _ hash is to calculate the v _ hash through an elliptic function F.
The step 4) further comprises confirming as an invalid random number if not.
The technical scheme provided by the invention has the beneficial effects that 1) the block chain random number-based generation method is generated by all nodes of a generated block together, has strong public confidence and is not easy to predict; 2) the invention ensures the correctness of the random number by a consensus mechanism of the block chain, and ensures that the random number cannot be manipulated when all nodes participate in the production process of the random number; 3) the invention adopts the characteristic value of the previous block of the commitment and the random number to calculate the commitment through the elliptic function F, thereby effectively preventing rainbow attack and making other people difficult to predict the value of the random number; the random number is already incorporated into the blockchain system as part of the blockchain.
Drawings
FIG. 1 is a timing diagram of random number generation based on a blockchain random number generation method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a method for generating random numbers based on block chains according to an embodiment of the present invention;
fig. 3 is a flowchart of a verification method based on a block chain random number generation method according to an embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and embodiments thereof.
Definition of key terms of the invention:
block chains: distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and other computer technologies.
The block producer: the node in the blockchain responsible for generating the block is typically chosen from some consensus on the blockchain.
Random number commitment: this document refers to the certificate used to verify the random number, and in general, the result of the calculation of the random number and its committed feature value of the previous block by the elliptic function F.
Rainbow table: a large dictionary with pre-computed hashes and passwords to compute them
Rainbow attack: and (3) cracking the behavior of the password by using the rainbow table, and reversely deducing the value corresponding to the hash by using the pre-calculated rainbow table by an attacker.
Random number: a different random number on each tile.
Contract random number: and finally providing the random numbers for the random number consumers to use.
Random number consumer: a contract or object of random numbers is required.
Example 1
Referring to fig. 1 and 2, the block chain-based random number generation method includes the following steps:
step 1) searching a random number S1 for a block link point;
step 2) traversing the next block from the current block onward S2;
step 3) determining whether the block has the random number S4; if not, entering the next step;
step 4) confirming whether the block has been accumulatively traversed the X block S5; if yes, entering the next step;
step 5) generates a random number S6 by calculation.
In this embodiment, the step 2) includes searching a block S3;
the step 3) includes collecting the random number if the random number exists in the block S41.
The step 5) is to calculate the random number by an elliptic function F.
Said step 5) above generates a final random number R by counting all the collected random numbers.
The step 5) further includes writing the calculated random number into the current block.
The writing of the calculated random number into the current block is writing the random number R into the current block and providing to a desired contract or object.
The prior art has the following implementation schemes:
1) the random number consumer uses the block Hash of the future as the random number seed of the consumer, and self-generates the random number.
2) A block chain is introduced with a prediction machine mechanism, a trusted third party contract generates random numbers and broadcasts the random numbers to all nodes.
3) The block producer self-generates the random number scheme of the block.
The invention ensures the safe generation of the random number, does not need to introduce a credible third party, can generate the safe random number by the block producer, and other verification nodes can verify the block-out behavior of the block producer, thereby preventing the block producer from cheating. And the random number is always stored in each block, and no one can modify the random number. Also, it is not necessary for the random number consumer to wait a particularly long time, and at any time, the random number can be taken in a very fast time.
The random number consumer of the invention must acquire the random number of a certain block in the future, so that fairness and unpredictability can be ensured. Since in this algorithm, anyone does not know what the random number of a block will be in the future, which is also our desired result.
The block producer of the present invention needs to provide a commitment next _ random _ hash when generating the block. The purpose is to make it impossible for others to know what the random number the block producer will provide, while also ensuring that it cannot replace the random number provided by itself. Only when the block producer publishes its random number, other nodes know the random number and verify that the random number is correct by committing to it.
In order to prevent rainbow attack, the commitment of the random number is the result calculated by an elliptic function F according to the random number and the characteristics of a block before the commitment. Because the characteristics of the previous block committed by the random number are in a very large range, an attacker has difficulty in generating a rainbow table in advance to carry out rainbow attack on the random number.
The block producer of the invention traverses the X blocks forward from the current block to obtain all random numbers (including the random number of the current block), and finally obtains the final random number result _ random through calculation. Because as many random numbers of block producers as possible are acquired, the risk of manipulating the random numbers by a few nodes in a serial manner is reduced.
Example 2
Referring to fig. 1, fig. 3 is different from the above-described embodiment in that the random number generation method further includes verifying whether the random number generated by the current block is correct by other block chain nodes.
The verification method comprises the following steps:
step 1) verification node P provides random number PRS11
Step 2) receiving the block produced by the current block producer node, and acquiring a random number S12 in the block; the method comprises the steps of obtaining a last block A produced by a node, and obtaining the next _ random _ hash of the block;
the step 2) also comprises inquiring the commitment next _ random _ hash of the random number on the block chain;
step 3) inquiring the characteristic value S13 of the previous block of the commitment next _ random _ hash on the block chain;
step 4), calculating v _ hashS14 by using the random number and the committed previous block characteristic value;
step 5) comparing the v _ hash with the commitment next _ random _ hash to determine whether the v _ hash and the commitment next _ random _ hash are consistent S15; if yes, entering the next step;
step 6) confirms the random number as a valid random number S16.
Preferably, the step 4) of calculating v _ hash is to calculate v _ hash by an elliptic function F.
Preferably, the step 5) confirms that the random number is the valid random number S151.
The random numbers in the current blockchain are either generated by the contract itself or by a third party, both of which have problems. The seed of the contract's own generated random number is easily discovered by others, eventually leading to the random number being predicted. The random numbers generated by the third party have no good credibility, so that people cannot be convinced.
The random number generation method of the invention is that the block chain is generated by all nodes of the generated block together, has strong public confidence and is not easy to be predicted. The block chain consensus mechanism ensures the correctness of the random number, and all nodes participate in the production process of the random number, thereby ensuring that the random number cannot be manipulated. The commitment is calculated by the characteristic value of the previous block of the commitment and the random number through the elliptic function F, so that rainbow attack is effectively prevented, and other people can hardly predict the value of the random number. The random number is already incorporated into the blockchain system as part of the blockchain.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention.
Claims (8)
1. A block chain-based random number generation method is characterized in that: the method comprises the following steps:
step 1) searching random numbers for block chain link points;
step 2) traversing the next block from the current block to the front;
step 3) confirming whether the block has the random number or not; if not, entering the next step;
step 4) confirming whether the block has been accumulated and traversed the X block; if yes, entering the next step;
step 5), generating a random number through calculation; the random number generation method also comprises the steps that other block chain nodes verify whether the random number generated by the current block is correct; the verification method comprises the following steps:
step 1) receiving a block produced by a current block producer node, and acquiring a random number in the block;
step 2) obtaining a characteristic value of a previous block of the node production block;
step 3) calculating v _ hash by using the random number and the committed previous block characteristic value;
step 4) comparing whether the v _ hash is consistent with the commitment next _ random _ hash; if yes, entering the next step;
and 5) confirming that the random number is a valid random number.
2. The method of claim 1, wherein: the step 2) comprises searching a block forward.
3. The method of claim 1, wherein: the step 3) includes collecting the random number if the random number exists in the block.
4. The method of claim 1, wherein: and in the step 5), the random number is calculated through an elliptic function F.
5. The method of claim 1, wherein: the step 5) further comprises writing the calculated random number into the current block.
6. The method of claim 1, wherein: said step 1) comprises querying the block chain for the next _ random _ hash commitment of the random number.
7. The method of claim 1, wherein: the step 3) of calculating the v _ hash is to calculate the v _ hash through an elliptic function F.
8. The method of claim 1, wherein: the step 4) further comprises confirming as an invalid random number if not.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811569340.0A CN109450629B (en) | 2018-12-21 | 2018-12-21 | Random number generation method based on block chain |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811569340.0A CN109450629B (en) | 2018-12-21 | 2018-12-21 | Random number generation method based on block chain |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109450629A CN109450629A (en) | 2019-03-08 |
CN109450629B true CN109450629B (en) | 2021-06-15 |
Family
ID=65560320
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811569340.0A Active CN109450629B (en) | 2018-12-21 | 2018-12-21 | Random number generation method based on block chain |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109450629B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109961550A (en) * | 2019-03-29 | 2019-07-02 | 北京金山安全软件有限公司 | Method and device for determining random number in block chain, electronic equipment and storage medium |
CN111488134B (en) * | 2020-04-09 | 2021-04-27 | 堡垒科技有限公司 | Public random number generation method and device based on block chain |
CN111488618B (en) * | 2020-04-13 | 2021-05-18 | 深圳信息职业技术学院 | Block chain-based one-time pad encryption method, device and storage medium |
CN111562902B (en) * | 2020-05-07 | 2023-08-11 | 成都库珀创新科技有限公司 | Block chain-based random number generation method and device |
CN112182612A (en) * | 2020-09-28 | 2021-01-05 | 平安科技(深圳)有限公司 | Random number generation method and device, terminal equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107392770A (en) * | 2017-08-09 | 2017-11-24 | 北京云知科技有限公司 | A kind of random-number generating method and system based on block chain |
WO2018115567A1 (en) * | 2016-12-19 | 2018-06-28 | Nokia Technologies Oy | Method and apparatus for private data transfer between parties |
CN108365960A (en) * | 2017-12-29 | 2018-08-03 | 北京欧链科技有限公司 | Random number providing method and device |
CN108845790A (en) * | 2018-06-20 | 2018-11-20 | 胡晓东 | A kind of application block chain generates the method and relevant apparatus of credible random number |
-
2018
- 2018-12-21 CN CN201811569340.0A patent/CN109450629B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2018115567A1 (en) * | 2016-12-19 | 2018-06-28 | Nokia Technologies Oy | Method and apparatus for private data transfer between parties |
CN107392770A (en) * | 2017-08-09 | 2017-11-24 | 北京云知科技有限公司 | A kind of random-number generating method and system based on block chain |
CN108365960A (en) * | 2017-12-29 | 2018-08-03 | 北京欧链科技有限公司 | Random number providing method and device |
CN108845790A (en) * | 2018-06-20 | 2018-11-20 | 胡晓东 | A kind of application block chain generates the method and relevant apparatus of credible random number |
Also Published As
Publication number | Publication date |
---|---|
CN109450629A (en) | 2019-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109450629B (en) | Random number generation method based on block chain | |
US20220417025A1 (en) | Computer-implemented system and method providing a decentralised protocol for the recovery of cryptographic assets | |
EP3896898B1 (en) | Methods and systems for blockchain-implemented event-lock encryption | |
US20210192512A1 (en) | Method and apparatus for storing and obtaining merchant authentication data in blockchain network | |
US11128522B2 (en) | Changing a master node in a blockchain system | |
CN111242617B (en) | Method and apparatus for performing transaction correctness verification | |
CN110458560B (en) | Method and apparatus for transaction verification | |
JP6756041B2 (en) | Information protection systems and methods | |
CN110998580A (en) | Method and apparatus for confirming transaction validity in blockchain system | |
CN109146479B (en) | Data encryption method based on block chain | |
US10756896B2 (en) | Trustless account recovery | |
CN111066019A (en) | Processing data elements stored in a blockchain network | |
CN111241593A (en) | Data synchronization method and device for block chain nodes | |
CN108540447B (en) | Block chain-based certificate verification method and system | |
US20230237437A1 (en) | Apparatuses and methods for determining and processing dormant user data in a job resume immutable sequential listing | |
CN116599669A (en) | Data processing method, device, computer equipment and storage medium | |
CN111143381B (en) | Method and device for updating trust points in multi-layer block chain structure | |
US20230316241A1 (en) | Partitioning a request into transactions for a blockchain | |
Konashevych | Data insertion in blockchain for legal purposes. How to sign contracts using blockchain | |
CN115643047A (en) | Block chain identity authentication method based on honest rewards | |
CN111159286B (en) | Method and apparatus for generating multi-layer block chain structure | |
CN109146684B (en) | Decentralized transaction verification method | |
CN113393241A (en) | Editing method and device of block chain account book data | |
CN114846765A (en) | Method and apparatus for providing decentralized identity verification | |
CN113240418B (en) | Block chain-based intelligent access control method and equipment for private data |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |