CN110071811B - Random number generation algorithm method based on block chain - Google Patents

Random number generation algorithm method based on block chain Download PDF

Info

Publication number
CN110071811B
CN110071811B CN201910342968.5A CN201910342968A CN110071811B CN 110071811 B CN110071811 B CN 110071811B CN 201910342968 A CN201910342968 A CN 201910342968A CN 110071811 B CN110071811 B CN 110071811B
Authority
CN
China
Prior art keywords
server
random number
hash
block chain
participants
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
Application number
CN201910342968.5A
Other languages
Chinese (zh)
Other versions
CN110071811A (en
Inventor
马小峰
杜明晓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wutong Chain Digital Technology Research Institute Suzhou Co ltd
Original Assignee
Suzhou Tongji Blockchain Research Institute Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Tongji Blockchain Research Institute Co ltd filed Critical Suzhou Tongji Blockchain Research Institute Co ltd
Priority to CN201910342968.5A priority Critical patent/CN110071811B/en
Publication of CN110071811A publication Critical patent/CN110071811A/en
Application granted granted Critical
Publication of CN110071811B publication Critical patent/CN110071811B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computational Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to a random number generation algorithm method based on a block chain, which comprises the following steps: step 1: a participant selects a server side, the server side generates a random number, and the hash value of the random number is recorded on a block chain; step 2: the server side sends the information on the block chain to other participants and collects random numbers of the other participants; and step 3: the server side sends the random number of the participant, the random number generated by the server and the information of the number of the delay waiting blocks to a block chain together; and 4, step 4: and (3) the server side sends the information on the block chain in the step (3) to other participants, and after all the participants wait for the set blocks, the final random number is calculated. The whole process of the invention is recorded on the chain and disclosed on the chain, thus preventing the chain from being tampered and improving the safety.

Description

Random number generation algorithm method based on block chain
Technical Field
The invention relates to a random number generation algorithm method based on a block chain.
Background
The block chain technology, bt (block chain technology) for short, also called distributed book technology, is an internet database technology, and is characterized by decentralized and transparent disclosure, so that everyone can participate in database recording.
Transaction (Transaction): an operation, resulting in a change of the state of the ledger, such as adding a record;
block (Block): recording the transaction and state results occurring within a period of time, which is a consensus on the current ledger state;
chain (Chain): the system is formed by serially connecting blocks according to the occurrence sequence and is a log record of the whole state change.
If the blockchain is used as a state machine, each transaction is attempted to change state, and each consensus generated block is that the participant confirms the result of all transaction contents in the block that caused the state change.
Block chain technology has advanced rapidly and has found application in several areas. The block chain can solve the problems existing in some traditional fields by unique characteristics. In traditional applications, many scenarios place strong demands on openness, fairness, and random numbers that cannot be manipulated manually. But traditional centralization cannot meet this requirement. The block chain has the characteristics of transparency, openness, autonomy, non-tamper property and the like. By utilizing the characteristics of the block chain, a random number generation algorithm based on the block chain is provided, and a true random number which cannot be manually manipulated under the participation of multiple parties can be provided.
Disclosure of Invention
To solve the above technical problems, an object of the present invention is to provide a method for block chain-based random number generation algorithm.
In order to achieve the purpose, the invention adopts the following technical scheme:
a block chain based random number generation algorithm method comprises the following steps:
step 1: a participant selects a server side, the server side generates a random number, and the hash value of the random number is recorded on a block chain;
step 2: the server side sends the information on the block chain to other participants and collects random numbers of the other participants;
and step 3: the server side sends the random number of the participant, the random number generated by the server and the information of the number of the delay waiting blocks to a block chain together;
and 4, step 4: and (3) the server side sends the information on the block chain in the step (3) to other participants, and after all the participants wait for the set blocks, the final random number is calculated.
Preferably, the step 1 comprises the steps of:
all participants select a server, and the server generates a random number NserverAnd calculates HASH value HASH (N) of the random numberserver) Then, the server side sends the message1{ GameID | | | HASH (N)server) Sending to a block chain;
check the GameID on the blockchain, if it is not repeated with the previously existing flow, the message forwards the transaction to action1{ GameID | | | HASH (N)server) The form of the is recorded in the block chain.
Preferably, the GameID is a custom flow number.
Preferably, said steps 2 and 3 comprise the steps of:
the server side sends the GameID, the hash of transaction 1(transaction1) and the block height H1 of the transaction1 to all other participants, and the participants can use the GameID and the transaction hash to retrieve the flow information on the block chain;
if the process information is correct, the participant needs to randomly send random number information random { GameID | | | Ni } to the server, and Ni is a random number generated by the participant i; the server side uses a reply participant i to return a receipt message receive { random }, and indicates that the random number is received;
after the server collects the random numbers of all participants, the server sends a message
message2{GameID||HASH(Nserver)||Nserver||[Ni]| Hash (transaction1) | | waitingX } to blockchain;
wherein [ Ni ] is the set of random numbers sent by all participants to the server, and Hash (transaction1) is the Hash information of transaction 1; waitingX is a waiting block interval, which is an integer;
smart contracts examine the message2 for GameID, HASH (N)server) If the information matches the information in the transaction1, the calculation checks the message2 for NserverHASH value of (2) and HASH (N)server) Whether the two are consistent; if the checks are passed, a new transaction message is generated
transaction2{GameID||HASH(Nserver)||Nserver||[Ni]||Hash(transaction1)||waitingX}。
Preferably, said step 4 comprises the following steps:
the server side broadcasts the hash information of transaction 2(transaction2) and the height H2 of the block where the transaction is located to all participants;
if the random number of any participant is tampered, any participant can refuse to start the process and send the received receipt message receive { random } to the block chain to instruct and control the server side to cheat;
if the information is correct, all participants wait for the HASH value HASH (block (H2+ waitingX)) for a block of height H2+ waitingX;
then using Nserver、[Ni]And HASH (block (H2+ waitingX)) as input to the function f (x), and obtaining as output a number k, i.e. kIs the random number that is finally generated.
Preferably, the function f (x) may be any predetermined function.
By the scheme, the invention at least has the following advantages:
the invention provides an algorithm for generating random numbers by a server and all participants through a block chain, and the algorithm can ensure that a plurality of participants participate in the generation of the random numbers together, thereby ensuring that the random numbers cannot be manipulated by anyone. Meanwhile, the random number is recorded on the chain in the whole process by means of a block chain technology and is disclosed on the chain, so that the random number is prevented from being tampered, and the safety is improved.
The foregoing description is only an overview of the technical solutions of the present invention, and in order to make the technical solutions of the present invention more clearly understood and to implement them in accordance with the contents of the description, the following detailed description is given with reference to the preferred embodiments of the present invention and the accompanying drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
FIG. 1 is a schematic flow diagram of the present invention;
FIG. 2 is a schematic flow chart of an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Examples
As shown in fig. 1, a method for block chain-based random number generation algorithm includes the following steps:
step 1: a participant selects a server side, the server side generates a random number, and the hash value of the random number is recorded on a block chain;
step 2: the server side sends the information on the block chain to other participants and collects random numbers of the other participants;
and step 3: the server side sends the random number of the participant, the random number generated by the server and the information of the number of the delay waiting blocks to a block chain together;
and 4, step 4: and (3) the server side sends the information on the block chain in the step (3) to other participants, and after all the participants wait for the set blocks, the final random number is calculated.
As shown in figure 2 of the drawings, in which,
all participants select a server, and the server generates a random number NserverAnd calculates HASH value HASH (N) of the random numberserver) Then, the server side sends the message1{ GameID | | | HASH (N)server) Sending to a block chain;
the Smart contracts on the blockchain check for GameID, which if it does not repeat with the previously existing flow, the message forwards the transaction1{ GameID | | HASH (N)server) The format of the GameID is recorded in a block chain, wherein the GameID is a self-defined flow number.
The above-mentioned smart contract is a program executed at one end of the block chain, and is a technology known to those skilled in the art, and will not be described in any detail here.
The server side sends the GameID, the hash of transaction 1(transaction1) and the block height H1 of the transaction1 to all other participants, and the participants can use the GameID and the transaction hash to retrieve the flow information on the block chain;
if the process information is correct, the participant needs to randomly send random number information random { GameID | | | Ni } to the server, and Ni is a random number generated by the participant i; the server side uses a reply participant i to return a receipt message receive { random }, and indicates that the random number is received;
after the server collects the random numbers of all participants, the server sends a message
message2{GameID||HASH(Nserver)||Nserver||[Ni]| Hash (transaction1) | | waitingX } to blockchain;
wherein [ Ni ] is the set of random numbers sent by all participants to the server, and Hash (transaction1) is the Hash information of transaction 1; waitingX is a waiting block interval, which is an integer;
smart contracts examine the message2 for GameID, HASH (N)server) If the information matches the information in the transaction1, the calculation checks the message2 for NserverHASH value of (2) and HASH (N)server) Whether the two are consistent; if the checks are passed, a new transaction message is generated
transaction2{GameID||HASH(Nserver)||Nserver||[Ni]||Hash(transaction1)||waitingX}。
The server side broadcasts the hash information of transaction 2(transaction2) and the height H2 of the block where the transaction is located to all participants;
if the random number of any participant is tampered, any participant can refuse to start the process and send the received receipt message receive { random } to the block chain to instruct and control the server side to cheat;
if the information is correct, all participants wait for the HASH value HASH (block (H2+ waitingX)) for a block of height H2+ waitingX;
then using Nserver、[Ni]And HASH (block (H2+ waitingX)) as input to the function f (x), andand obtaining a number k as an output, wherein the number k is a random number finally generated.
The function f (x) may be any predetermined function, and is known to those skilled in the art, and will not be described in detail here.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, it should be noted that, for those skilled in the art, many modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.

Claims (4)

1. A block chain-based random number generation algorithm method is characterized by comprising the following steps:
step 1: a participant selects a server side, the server side generates a random number, and the hash value of the random number is recorded on a block chain;
step 2: the server side sends the information on the block chain to other participants and collects random numbers of the other participants;
and step 3: the server side sends the random number of the participant, the random number generated by the server and the information of the number of the delay waiting blocks to a block chain together;
and 4, step 4: the server side sends the information on the block chain in the step 3 to other participants, and after all the participants wait for the set blocks, the final random number is calculated;
wherein the steps 2 and 3 comprise the steps of:
the server side sends the GameID, the hash of transaction 1(transaction1) and the block height H1 of the transaction1 to all other participants, and the participants can use the GameID and the transaction hash to retrieve the flow information on the block chain;
if the process information is correct, the participant needs to randomly send random number information random { GameID | | | Ni } to the server, and Ni is a random number generated by the participant i; the server side uses a reply participant i to return a receipt message receive { random }, and indicates that the random number is received;
after the server collects the random numbers of all participants, the server sends a message
message2{GameID||HASH(Nserver)||Nserver||[Ni]| Hash (transaction1) | | waitingX } to blockchain;
wherein [ Ni ] is the set of random numbers sent by all participants to the server, and Hash (transaction1) is the Hash information of transaction 1; waitingX is a waiting block interval, which is an integer;
smart contracts examine the message2 for GameID, HASH (N)server) If the information matches the information in the transaction1, the calculation checks the message2 for NserverHASH value of (2) and HASH (N)server) Whether the two are consistent; if the checks are passed, a new transaction message is generated
transaction2{GameID||HASH(Nserver)||Nserver||[Ni]||Hash(transaction1)||waitingX};
Wherein, the step 4 comprises the following steps:
the server side broadcasts the hash information of transaction 2(transaction2) and the height H2 of the block where the transaction is located to all participants;
if the random number of any participant is tampered, any participant can refuse to start the process and send the received receipt message receive { random } to the block chain to instruct and control the server side to cheat;
if the information is correct, all participants wait for the HASH value HASH (block (H2+ waitingX)) for a block of height H2+ waitingX;
then using Nserver、[Ni]And HASH (block (H2+ waitingX)) as the input of the function f (x), and obtaining a number k as the output, wherein the number k is the random number finally generated.
2. The method of block chain-based random number generation algorithm of claim 1, wherein: the step 1 comprises the following steps:
all participants select a server, and the server generates a random number NserverAnd calculates HASH value HASH (N) of the random numberserver) Then, the server side sends the message1{ GameID | | | HASH (N)server) Sending to a block chain;
the Smart contracts on the blockchain check for GameID, which if it does not repeat with the previously existing flow, the message forwards the transaction1{ GameID | | HASH (N)server) The form of the is recorded in the block chain.
3. The method of block chain-based random number generation algorithm of claim 2, wherein: the GameID is a self-defined flow number.
4. The method of block chain-based random number generation algorithm of claim 1, wherein: the function f (x) may be any predetermined function.
CN201910342968.5A 2019-04-26 2019-04-26 Random number generation algorithm method based on block chain Active CN110071811B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910342968.5A CN110071811B (en) 2019-04-26 2019-04-26 Random number generation algorithm method based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910342968.5A CN110071811B (en) 2019-04-26 2019-04-26 Random number generation algorithm method based on block chain

Publications (2)

Publication Number Publication Date
CN110071811A CN110071811A (en) 2019-07-30
CN110071811B true CN110071811B (en) 2022-02-18

Family

ID=67368960

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910342968.5A Active CN110071811B (en) 2019-04-26 2019-04-26 Random number generation algorithm method based on block chain

Country Status (1)

Country Link
CN (1) CN110071811B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111562902B (en) * 2020-05-07 2023-08-11 成都库珀创新科技有限公司 Block chain-based random number generation method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108388421A (en) * 2017-12-29 2018-08-10 北京欧链科技有限公司 The generation method and device of random number
CN109558112A (en) * 2018-11-14 2019-04-02 杭州复杂美科技有限公司 Random digit generation method, anti-cheating block catenary system, equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108388421A (en) * 2017-12-29 2018-08-10 北京欧链科技有限公司 The generation method and device of random number
CN109558112A (en) * 2018-11-14 2019-04-02 杭州复杂美科技有限公司 Random digit generation method, anti-cheating block catenary system, equipment and storage medium

Also Published As

Publication number Publication date
CN110071811A (en) 2019-07-30

Similar Documents

Publication Publication Date Title
CN109936457B (en) Block chain multi-party witness method, device, equipment and computer readable storage medium
CN111405304B (en) Anchor interaction method and device, computer equipment and storage medium
CN108848056B (en) Block chain consensus method based on verification
CN110399424B (en) Block generation method, block generation device, block chain node and storage medium
CN107171810B (en) Verification method and device of block chain
CN107231239A (en) Create generation block method for anti-counterfeit and device
Pfitzmann et al. Optimal efficiency of optimistic contract signing
CN106530083A (en) Multi-chain management method and system based on block chain
CN105488665A (en) Decentralized transaction method
CN110071811B (en) Random number generation algorithm method based on block chain
CN103490989A (en) Multi-user instant chatting method achieving classified display based on content topics
CN113347164A (en) Block chain-based distributed consensus system, method, device and storage medium
CN109617702B (en) Message signing method, block chain node and device with storage function
CN111144883A (en) Processing performance analysis method and device for block chain network
CN111464633B (en) Consensus method and system for transaction information of block chain
CN110868286A (en) Method for generating random number based on block chain intelligent contract
CN111414420A (en) Improved PBFT block chain consensus method
CN106355471A (en) Bidding data processing method and system
CN113645278A (en) Cross-chain message transmission method, device and storage medium of block chain
KR102150210B1 (en) Blockchain network
CN111046439A (en) Intelligent contract task verifiable method and system based on block chain
CN102664820A (en) Method and system for inviting guests to attend video conference
CN108648076B (en) Method and system for electing common node and generating node information table
CN110025960A (en) A kind of multiplayer synchronous method, system, medium and equipment based on block chain
KR20180017100A (en) Communication tool-based data transmission method and system

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 11-12 / F, Lingyu Business Plaza, 66 qinglonggang Road, high speed rail new town, Xiangcheng District, Suzhou City, Jiangsu Province, 215100

Applicant after: Suzhou Shutong Digital Technology Co.,Ltd.

Address before: 11-12 / F, Lingyu Business Plaza, 66 qinglonggang Road, high speed rail new town, Xiangcheng District, Suzhou City, Jiangsu Province

Applicant before: SUZHOU TONGJI BLOCKCHAIN RESEARCH INSTITUTE Co.,Ltd.

CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 11-12 / F, Lingyu Business Plaza, 66 qinglonggang Road, high speed rail new town, Xiangcheng District, Suzhou City, Jiangsu Province

Patentee after: Wutong Chain Digital Technology Research Institute (Suzhou) Co.,Ltd.

Address before: 11-12 / F, Lingyu Business Plaza, 66 qinglonggang Road, high speed rail new town, Xiangcheng District, Suzhou City, Jiangsu Province, 215100

Patentee before: Suzhou Shutong Digital Technology Co.,Ltd.