CN108831002B - Fair welfare lottery drawing method based on block chain - Google Patents
Fair welfare lottery drawing method based on block chain Download PDFInfo
- Publication number
- CN108831002B CN108831002B CN201810735389.2A CN201810735389A CN108831002B CN 108831002 B CN108831002 B CN 108831002B CN 201810735389 A CN201810735389 A CN 201810735389A CN 108831002 B CN108831002 B CN 108831002B
- Authority
- CN
- China
- Prior art keywords
- lottery
- openchal
- hash
- value
- red ball
- 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
Classifications
-
- G—PHYSICS
- G07—CHECKING-DEVICES
- G07C—TIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
- G07C15/00—Generating random numbers; Lottery apparatus
- G07C15/006—Generating random numbers; Lottery apparatus electronically
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Credit Cards Or The Like (AREA)
Abstract
The invention discloses a welfare lottery fair lottery drawing method based on a block chain, and belongs to the technical field of block chains. The method mainly comprises the following steps: preparation work: setting the time for drawing out the prize and stopping selling the prize; the method comprises the following steps that a lottery initiator deploys an intelligent contract of the lottery, wherein the intelligent contract comprises a betting module and a lottery drawing module; the betting module calculates a challenge value for drawing a prize by using betting information of a better and the hash values of the plurality of blocks which are determined latest; the lottery drawing module performs six times of Hash calculation by using the challenge value of the lottery drawing to obtain six red ball numbers, and performs one time of Hash calculation to obtain a blue ball number. The method of the invention utilizes the intelligent contract technology of the Ethenhouse, has the functions of betting, drawing prizes and the like of the lottery on the block chain, saves all operation information, ensures that the lottery drawing information is open and transparent, can not be falsified and forged, and ensures that the lottery drawing result can be verified by all participants.
Description
Technical Field
The invention belongs to the technical field of block chains, and particularly relates to a welfare lottery fair lottery drawing method based on a block chain.
Background
Lottery tickets, also called lottery tickets, are raised in a lottery and award manner. The lottery tickets are classified according to the participation mode of players, and are mainly divided into lottery-shaking tickets, lottery-touching tickets, guessing tickets and lottery-betting tickets. The lottery ticket with the lottery drawing is an instant lottery ticket, namely, the lottery drawing is carried out immediately, and the prize content is printed in the lottery ticket without open lottery drawing; the guess lottery and the bet lottery are predicted by a specific object, the result generated by the predicted object is used as the standard, and the lottery drawing is also not needed. At present, because the lottery drawing process is managed and maintained by a lottery issuer, a lottery drawing number is determined by a lottery drawing device under the supervision of a notary staff, and a drawing result is published by the lottery issuer. There may be instances where a notary colludes with the lottery issuer to cheat the bettor.
The block chain is composed of a group of nodes based on a point-to-point network, and each node maintains the consistency of data by executing a consensus mechanism. The block chain connects the data blocks by using the hash values of the blocks to form a block chain structure, so that the data in the blocks has the characteristics of non-falsification, order preservation, traceability and the like. The block chain generates, updates and stores data through a distributed node consensus algorithm, and the function of decentralization can be achieved. The block chain declares and transfers the digital assets by means of digital signatures to ensure the safety of data transmission and access.
The Ether shop is taken as a typical representative of the block chain 2.0, the image flexibility of the block chain system is realized for the first time, the application program can be uploaded and executed on the block chain, the effective execution of the program can be ensured, and the function of the intelligent contract is realized for the first time on the basis. The Ether shop in 2013 written the intelligent contracts into the blockchain in a digital form, and executed the codes of the intelligent contracts through the computer network. Due to the characteristics of distribution, public, non-tampering and the like of the blockchain, the content of the intelligent contract and the execution result of the intelligent contract are visible and identical to each party initiating the intelligent contract. The intelligent contract based on the block chain not only has the advantages of cost efficiency and the like of the intelligent contract, but also can avoid the interference of malicious behaviors on the normal execution of the intelligent contract, and ensure the intelligent contract to be transparent, traceable, not to be tampered and the like in the processes of storage, reading, execution and the like. The lottery drawing method and the lottery drawing system have the advantages that the intelligent contract technology of the Etheng is utilized, the functions of betting, drawing and the like of the lottery on the block chain are achieved, all operation information is stored, the fact that the lottery drawing information is transparent in disclosure, cannot be tampered and cannot be forged is guaranteed, and the lottery drawing result can be verified by all participants.
Since the contents of the chunk fill portion are unpredictable, the hash value of the next chunk in the ether house is also unpredictable. The data in the Ethernet workshop is public and transparent, and anyone can access the Ethernet workshop network to inquire the content of the Ethernet workshop block chain. Furthermore, the calculated force of ether mill so far is 262082.88GH/s, i.e. 2.6X 10/s14And (6) secondary hashing. The peak value calculation speed of the super computer with the highest calculation speed in China is 9.3 multiplied by 1016Sub-logical calculation, about 5.5 × 1012And (4) performing secondary hash calculation. It follows that the ether house blockchain has sufficient computing power to ensure the data is not forgeable.
The lottery tickets are classified according to the participation mode of players, and are mainly divided into lottery-shaking tickets, lottery-touching tickets, guessing tickets and lottery-betting tickets. The lottery ticket with the lottery drawing is an instant lottery ticket, namely, the lottery drawing is carried out immediately, and the prize content is printed in the lottery ticket without open lottery drawing; the guess lottery and the bet lottery are predicted by a specific object, the result generated by the predicted object is used as the standard, and the lottery drawing is also not needed. At present, because the lottery drawing process is managed and maintained by a lottery issuer, a lottery drawing number is determined by a lottery drawing device under the supervision of a notary staff, and a drawing result is published by the lottery issuer. There may be instances where a notary colludes with the lottery issuer to cheat the bettor.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a fair lottery drawing method based on a block chain.
The technical problem proposed by the invention is solved as follows:
a fair lottery drawing method based on a block chain comprises the following steps:
step 1, preparation: setting the time for drawing out the prize and stopping selling the prize; the method comprises the following steps that a lottery initiator deploys an intelligent contract of the lottery, wherein the intelligent contract comprises a betting module and a lottery drawing module;
step 2, a betting module: setting an initial variable OpenChal to be 0 in an intelligent contract, and in the process of selling lottery tickets, after a bettor bets, the intelligent contract uses the bettor Ethernet address, betting amount, betting time and the set variable OpenChal as input update variables OpenChal; during the time of lottery selling, any user with the Ether house address can bet any lottery drawing number with any amount; after the lottery is stopped, all users cannot bet the lottery;
step 3, a lottery drawing module: when lottery is played, the intelligent contract acquires the hash values of 12 blocks which are newly confirmed by the time of lottery drawing, and the 12 hash values and the value of OpenChal are used for calculating to obtain a challenge value of lottery drawing;
adding filling data after the challenge value of the lottery drawing, and performing hash calculation for six times; wherein, every time hash calculation is carried out, adding 1 to the filling data; 6 hash values for generating the double-color ball number are obtained; taking the remainder of the 6 hash values modulo 33 and adding 1; 6 red ball numbers are obtained; if two identical numbers exist in the 6 red ball numbers, one of the numbers is abandoned, filling data is changed, the hash value is recalculated to operate to obtain a new red ball number, the new red ball number is compared with other red ball numbers, if the new red ball number is different from the other red ball numbers, the new red ball number is reserved, if the new red ball number is different from the other red ball numbers, the number is abandoned, and the operation is repeated until 6 mutually different red ball numbers are found;
and taking the challenge value of the lottery drawing as input, adding filling data after the challenge value, calculating by using the filling data to obtain a new hash value, and taking the remainder of a module 16 of the hash value and adding 1 to obtain 1 blue ball number.
The invention has the beneficial effects that:
(1) the invention is based on the block chain technology, is completely transparent to the bettors, and any person can calculate the winning result according to the block hash value;
(2) the invention is based on the block chain technology, is decentralized and does not need any investment of lottery drawing equipment;
(3) the lottery drawing result is calculated based on the unknown blocks, and the calculation power of the bit coins is ensured, so that any link participating in the lottery cannot be cheated, the lottery drawing result cannot be predicted or set even by a lottery distributor, the lottery drawing process is completely disclosed, and the lottery drawing process is convenient for user supervision;
(4) the lottery drawing result of the invention is completely randomized, the probability generated by each number is the same, and the defect that the physical equipment cannot be completely the same is avoided.
Detailed Description
The present invention will be further described with reference to the following examples.
The embodiment provides a fair lottery drawing method based on a block chain, which comprises the following steps:
step 1, preparation: setting the time for drawing out the prize and stopping selling the prize; at present, the drawing time of the double-color ball is 21 o ' clock and 15 o ' clock of every Tuesday, Thursday and Sunday, and the sale stop time of the double-color ball is 20 o ' clock of the drawing day; lottery tickets based on the Ethenhouse intelligent contracts are sold at least six minutes before lottery drawing, the lottery drawing and the sale stopping time of the lottery drawing;
the lottery ticket initiator deploys the intelligent contract of the lottery ticket, and the lottery ticket initiator can be a lottery ticket center mechanism and also can be other groups or mechanisms; the intelligent contract comprises a betting module and a lottery drawing module;
the two-color ball lottery rules are as follows: when the lottery is rocked, 6 red ball numbers are rocked out, and then 1 blue ball number is rocked out; the red ball number zone consists of 33 numbers from 1 to 33, and the blue ball number zone consists of 16 numbers from 1 to 16. In this embodiment, the lottery drawing system provides a lottery drawing number according to the requirement of the two-color ball lottery drawing rule.
Step 2, a betting module: setting an initial variable OpenChal to be 0 in the smart contract, and in the process of selling lottery tickets, after a bettor bets, the smart contract calculates an updated variable OpenChal by using an EtherFang address BetAddr of the bettor, a betting amount BetMount, a betting time BetTime and the set variable OpenChal as follows:wherein, | | is a connector,is exclusive-OR operation, H is hash operation, H: {0,1} → {0,1}256This means that a binary value of an arbitrary length is mapped to a binary value of 256.
During the time of lottery selling, any user with the Ether house address can bet any lottery drawing number with any amount; after the lottery is stopped, all users cannot bet the lottery;
step 3, a lottery drawing module:
step 3-1, during lottery drawing, the intelligent contract acquires the hash values of 12 blocks which are newly confirmed by the time of drawing, and the 12 hash values and the OpenChal value are used for calculating to obtain a challenge value for drawing;
when the lottery is played, the hash values HBlock1, HBlock2, HBlock3, HBlock4, HBlock5, HBlock6, HBlock7, HBlock8, HBlock9, HBlock10, HBlock11 and HBlock12 of the 12 blocks which are newly confirmed by the time of the lottery drawing are obtained. Challenge value of drawing a prize
Step 3-2, adding filling data f after the challenge value of the lottery drawing, and performing hash calculation for six times; wherein, the initial value f of the filling data is 0, and 1 is added to the filling data f every time hash calculation is carried out; 6 hash values for generating the double-color ball number are obtained;
six hash calculations: s1=H(OpenChal||f),f=f+1,s2=H(OpenChal||f),f=f+1,s3=H(OpenChal||f),f=f+1,s4=H(OpenChal||f),f=f+1,s5=H(OpenChal||f),f=f+1,s6H (OpenChal | | f), f ═ f +1, resulting in a 256-bit hash value s1,s2,s3,s4,s5,s6。
6 hash values s in binary form1,s2,s3,s4,s5,s6Taking the remainder of the modulus 33 and adding 1; 6 red ball numbers were obtained: r is1=(s1mod33)+1,r2=(s2mod33)+1,r3=(s3mod33)+1,r4=(s4mod33)+1,r5=(s5mod33)+1,r6=(s6mod33) +1, where mod is the modulo operation.
Step 3-3, if there are 6 red ball numbers r1,r2,r3,r4,r5,r6If two identical numbers exist in the red ball, one of the numbers is abandoned, and the hash value is recalculated to obtain a new red ball number s7=H(Bhash||f),f=f+1,r7=(s7mod33)+1,s8=H(Bhash||f),f=f+1,r8=(s8mod33) +1 … …, compare the new red ball number with other red ball numbers, if different, keep it, if same, discard it, repeat the above operations until 6 different red ball numbers are found; it is assumed here that the number of 6 two-color balls satisfying the condition is r1,r2,r3,r4,r5,r6。
And 3-4, taking the challenge value OpenChal of the drawing as input, adding filling data f after the challenge value, calculating a new hash value l-H (OpenChal | | f), taking the remainder of l modulo 16 and adding 1 to obtain a number n with the value range of 1-16, wherein n is (lmod16) +1, and n is the number of the blue ball in the double-color ball.
Claims (2)
1. A fair lottery drawing method based on a block chain is characterized by comprising the following steps:
step 1, preparation: setting the time for drawing out the prize and stopping selling the prize; the method comprises the following steps that a lottery initiator deploys an intelligent contract of the lottery, wherein the intelligent contract comprises a betting module and a lottery drawing module;
step 2, a betting module: setting an initial variable OpenChal to be 0 in an intelligent contract, and in the process of selling lottery tickets, after a bettor bets, the intelligent contract uses the bettor Ethernet address, betting amount, betting time and the set variable OpenChal as input update variables OpenChal; during the time of lottery selling, any user with the Ether house address can bet any lottery drawing number with any amount; after the lottery is stopped, all users cannot bet the lottery;
the specific process of updating the variable OpenChal in the step 2 is as follows:
setting an initial variable OpenChal to be 0 in the smart contract, and in the process of selling lottery tickets, after a bettor bets, the smart contract calculates an updated variable OpenChal by using an EtherFang address BetAddr of the bettor, a betting amount BetMount, a betting time BetTime and the set variable OpenChal as follows:wherein, | | is a connector,is XOR operation, H is Hash operation, H: {0,1}*→{0,1}256Indicating that a binary value of an arbitrary length is mapped to a binary value of length 256;
step 3, a lottery drawing module: when lottery is played, the intelligent contract acquires the hash values of 12 blocks which are newly confirmed by the time of lottery drawing, and the 12 hash values and the value of OpenChal are used for calculating to obtain a challenge value of lottery drawing;
adding filling data after the challenge value of the lottery drawing, and performing hash calculation for six times; wherein, every time hash calculation is carried out, adding 1 to the filling data; 6 hash values for generating the double-color ball number are obtained; taking the remainder of the 6 hash values modulo 33 and adding 1; 6 red ball numbers are obtained; if two identical numbers exist in the 6 red ball numbers, one of the numbers is abandoned, filling data is changed, the hash value is recalculated to operate to obtain a new red ball number, the new red ball number is compared with other red ball numbers, if the new red ball number is different from the other red ball numbers, the new red ball number is reserved, if the new red ball number is different from the other red ball numbers, the number is abandoned, and the operation is repeated until 6 mutually different red ball numbers are found;
taking a challenge value of the lottery drawing as input, adding filling data after the challenge value, calculating by using the filling data to obtain a new hash value, and obtaining 1 blue ball number by taking the remainder of a module 16 and adding 1 to the hash value;
the process of calculating the winning challenge value in the step 3 is as follows:
step 3-1, during lottery drawing, the intelligent contract acquires the hash values of 12 blocks which are newly confirmed by the time of drawing, and the 12 hash values and the OpenChal value are used for calculating to obtain a challenge value for drawing;
when lottery is played, hash values HBlock1, HBlock2, HBlock3, HBlock4, HBlock5, HBlock6, HBlock7, HBlock8, HBlock9, HBlock10, HBlock11 and HBlock12 of 12 blocks which are newly confirmed by the time of lottery drawing are obtained; challenge value of drawing a prize
The calculation process of the red ball is as follows:
step 3-2, adding filling data f after the challenge value of the lottery drawing, and performing hash calculation for six times; wherein, the initial value f of the filling data is 0, and 1 is added to the filling data f every time hash calculation is carried out; 6 hash values for generating the double-color ball number are obtained;
six hash calculations: s1=H(OpenChal||f),f=f+1,s2=H(OpenChal||f),f=f+1,s3=H(OpenChal||f),f=f+1,s4=H(OpenChal||f),f=f+1,s5=H(OpenChal||f),f=f+1,s6H (OpenChal | | f), f ═ f +1, resulting in a 256-bit hash value s1,s2,s3,s4,s5,s6;
6 hash values s in binary form1,s2,s3,s4,s5,s6Taking the remainder of the modulus 33 and adding 1; 6 red ball numbers were obtained: r is1=(s1mod33)+1,r2=(s2mod33)+1,r3=(s3mod33)+1,r4=(s4mod33)+1,r5=(s5mod33)+1,r6=(s6mod33) +1, where mod is the modulo operation;
step 3-3, if there are 6 red ball numbers r1,r2,r3,r4,r5,r6If two identical numbers exist in the red ball, one of the numbers is abandoned, and the hash value is recalculated to obtain a new red ball number s7=H(Bhash||f),f=f+1,r7=(s7mod33)+1,s8=H(Bhash||f),f=f+1,r8=(s8mod33) +1 … …, compare the new red ball number with other red ball numbers, if different, keep it, if same, discard it, repeat the above operations until 6 different red ball numbers are found;
the calculation process of the blue ball is as follows:
and 3-4, taking the challenge value OpenChal of the drawing as input, adding filling data f after the challenge value, calculating a new hash value l-H (OpenChal | | f), taking the remainder of l modulo 16 and adding 1 to obtain a number n with the value range of 1-16, wherein n is (lmod16) +1, and n is the number of the blue ball in the double-color ball.
2. The block chain based welfare lottery fair drawing method of claim 1, wherein the lottery based on the etherhouse intelligent contract stops selling the lottery at least six minutes before drawing the lottery, and drawing and closing time thereof is identical to those of the two-color ball.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810735389.2A CN108831002B (en) | 2018-07-06 | 2018-07-06 | Fair welfare lottery drawing method based on block chain |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810735389.2A CN108831002B (en) | 2018-07-06 | 2018-07-06 | Fair welfare lottery drawing method based on block chain |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108831002A CN108831002A (en) | 2018-11-16 |
CN108831002B true CN108831002B (en) | 2021-06-01 |
Family
ID=64135487
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810735389.2A Active CN108831002B (en) | 2018-07-06 | 2018-07-06 | Fair welfare lottery drawing method based on block chain |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108831002B (en) |
Families Citing this family (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111223227B (en) * | 2018-11-26 | 2022-03-22 | 腾讯科技(深圳)有限公司 | Target user screening method and device |
CN109671206A (en) * | 2018-12-03 | 2019-04-23 | 广东工业大学 | A kind of method, apparatus, equipment and the storage medium of random determining terminal |
CN109741513B (en) * | 2018-12-20 | 2021-06-08 | 太原理工大学 | Lottery drawing method based on block chain technology |
CN109847365B (en) * | 2019-01-24 | 2022-08-12 | 湖南天河国云科技有限公司 | Anti-cheating method and system for block chain application |
CN110223436B (en) * | 2019-06-13 | 2020-12-25 | 北京瑞策科技有限公司 | Lottery random number issuing method and device applying block chain |
CN110570576B (en) * | 2019-09-06 | 2021-05-11 | 杭州复杂美科技有限公司 | Lottery system, construction method, operation method, equipment and storage medium thereof |
US11151838B2 (en) | 2019-09-10 | 2021-10-19 | Igt Global Solutions Corporation | Blockchain-based smart contract instant lottery ticket |
CN110795749B (en) * | 2019-10-25 | 2024-04-05 | 腾讯科技(深圳)有限公司 | Data processing method, device and storage medium |
CN113128850B (en) * | 2021-04-02 | 2024-04-19 | 深圳市易讯天空网络技术有限公司 | Lottery flow management method, system, terminal equipment and storage medium |
CN114726534A (en) * | 2022-03-28 | 2022-07-08 | 海南格子山网络科技有限公司 | Method for realizing intelligent contract drawing based on Solana block chain technology |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150046337A1 (en) * | 2013-08-06 | 2015-02-12 | Chin-hao Hu | Offline virtual currency transaction |
US9818092B2 (en) * | 2014-06-04 | 2017-11-14 | Antti Pennanen | System and method for executing financial transactions |
CN105913174A (en) * | 2016-04-07 | 2016-08-31 | 彭军红 | Lottery issuing method based on block chains |
CN106980488A (en) * | 2017-03-14 | 2017-07-25 | 腾讯科技(深圳)有限公司 | Random digit generation method and device |
CN107103097A (en) * | 2017-05-22 | 2017-08-29 | 中链科技有限公司 | Drawing method and terminal device based on block chain technology |
CN107481145A (en) * | 2017-08-30 | 2017-12-15 | 北京知金链网络技术有限公司 | Block chain multidimensional random number common recognition election method |
-
2018
- 2018-07-06 CN CN201810735389.2A patent/CN108831002B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN108831002A (en) | 2018-11-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108831002B (en) | Fair welfare lottery drawing method based on block chain | |
CN108898729B (en) | Fair lottery drawing method based on block chain | |
US11625988B2 (en) | Systems and methods for providing electronic gaming pieces | |
CN108447014A (en) | A kind of block chain lottery industry method and system | |
CN109985389B (en) | Cheating-preventing method and system for card games based on intelligent block chain contracts | |
US6962530B2 (en) | Authentication in a secure computerized gaming system | |
US6569017B2 (en) | Method for assigning prizes in bingo-type games | |
JP2022523643A (en) | How to generate random numbers in blockchain smart contracts | |
CN110270097A (en) | The distributing video-game transaction platform of safety | |
US7749082B2 (en) | Method for using three cross-interactive playing boards to play game of chance | |
CN105913174A (en) | Lottery issuing method based on block chains | |
CN107103097A (en) | Drawing method and terminal device based on block chain technology | |
CA3019779A1 (en) | System and method for wagering based on the movement of financial markets | |
CN109583892A (en) | A kind of random number selecting method in block chain | |
NO20071869L (en) | Sports lottery games with fixed odds | |
CN109615759A (en) | It is random to take out number number of shaking system | |
CN102044106A (en) | Method and device for gaming system | |
CN109245878A (en) | A kind of new block generation method, equipment and the readable storage medium storing program for executing of block chain | |
CN110025960A (en) | A kind of multiplayer synchronous method, system, medium and equipment based on block chain | |
US20220123947A1 (en) | A Method for Generating Random Numbers in Blockchain Smart Contracts | |
CN110189465B (en) | Random lottery method and equipment by means of block chain | |
CN105763572B (en) | A kind of numeric type lottery ticket sales based on public key signature are announced the winners in a lottery and cashing method | |
CN110784315A (en) | Block chain-based shaking method and device, computer equipment and storage medium | |
CN106552420A (en) | Networking game device | |
JP2004534580A5 (en) |
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 |