CN113157700B - Quick lottery/sequencing method based on block chain technology - Google Patents

Quick lottery/sequencing method based on block chain technology Download PDF

Info

Publication number
CN113157700B
CN113157700B CN202110451727.1A CN202110451727A CN113157700B CN 113157700 B CN113157700 B CN 113157700B CN 202110451727 A CN202110451727 A CN 202110451727A CN 113157700 B CN113157700 B CN 113157700B
Authority
CN
China
Prior art keywords
sorting
block
ordering
lottery
random number
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
CN202110451727.1A
Other languages
Chinese (zh)
Other versions
CN113157700A (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.)
Taiyuan University of Technology
Original Assignee
Taiyuan University of Technology
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 Taiyuan University of Technology filed Critical Taiyuan University of Technology
Priority to CN202110451727.1A priority Critical patent/CN113157700B/en
Publication of CN113157700A publication Critical patent/CN113157700A/en
Application granted granted Critical
Publication of CN113157700B publication Critical patent/CN113157700B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2291User-Defined Types; Storage management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to the technical field of block chains, and provides a quick lottery/sequencing method based on a block chain technology, which comprises the following steps: s1, a drawing/sorting activity participant randomly selects a drawing/sorting block from a historical block of a block chain; s2, the activity sponsor selects a block which is only output at the time T 2 in the future as an initial drawing/sorting block; the invention is suitable for various situations with the number as the lottery/sorting result, thereby technically eliminating the possibility of lottery/sorting cheating, and can rapidly determine all the lottery/sorting results by only acquiring a random number parameter in a new block.

Description

Quick lottery/sequencing method based on block chain technology
Technical Field
The invention relates to the technical field of blockchain, in particular to a rapid lottery/sequencing method based on a blockchain technology.
Background
In modern society, how to orderly, effectively and fairly distribute limited resources is a subject related to the personal benefit. Among them, drawing and ordering (queuing) are two common ways in the process of resource allocation, and exist in a large amount in real life. For example: the system comprises a study area house shake number, a lottery sales promotion of a market, a limited-time second lottery killing activity of a shopping website, sports lottery issued by a national sports headquarter, two-color ball lottery issued by a Chinese welfare lottery issuing management center, group lottery of world cup-participating teams, and a American president bidder lecture rank. Although the activities can publish a plurality of lottery/ordering rules in advance, because the activity sponsor is an operation and maintenance platform with centralized property, huge manpower and material resources are input, on the other hand, fairness is difficult to ensure, and related interests organization or individuals can feather one's nest cheat in the whole activities, and the resources interests, namely cast greedy eyes on are stolen, and hackers of third parties invade the system platform to destroy and modify the lottery/ordering rules.
The block chain (Blockchain) is a decentralised chain data structure, and the data cannot be tampered and counterfeited in a cryptographic way, the modification of the data by a single node or even a plurality of nodes cannot affect the data of other nodes, the random number in the block head of the public chain cannot be controlled or predicted, and the block chain is an ideal random number source, and can be applied to the lottery/ordering activity to realize a quick lottery/ordering method with low supervision cost, disclosure, fairness and fairness.
Disclosure of Invention
The invention overcomes the defects existing in the prior art, and solves the technical problems that: a fast lottery/sequencing method based on a blockchain technology is provided, and the problems of disclosure, fairness and fairness of lottery/sequencing are solved.
In order to solve the technical problems, the invention adopts the following technical scheme: a fast lottery/ordering method based on a blockchain technology comprises the following steps:
S1, a drawing/sorting activity participant randomly selects a drawing/sorting block in a historical block of a blockchain, wherein the blocks selected by the drawing/sorting participants are different;
s2, the activity sponsor selects a block which is only output at the time T 2 in the future as an initial drawing/sorting block;
S3, creating a drawing/sorting table, wherein in the drawing sorting table, all drawing/sorting activity participants respectively set a number;
s4, after the designated initial drawing/sorting block waits for a plurality of block acknowledgements on the chain, extracting a random number N 1 from the block header parameters of the initial drawing/sorting block, calculating an index value according to the random number, determining the next block participating in the index value calculation through the index value, and repeatedly calculating the index value;
S5, sorting the drawing/sorting activity participants according to the index calculation result.
The step S4 specifically includes the following steps:
S401, after a designated initial lottery/sorting block waits for a plurality of block acknowledgements on a chain, extracting a random number N 1 from block header parameters of the initial lottery/sorting block, converting the random number N 1 into decimal, calculating a corresponding value of an index Z 1 according to the random number N 1, and finding a corresponding number from a lottery/sorting table according to the value of the index Z 1; deleting the row information of the currently calculated drawing/sorting activity participants from the drawing/sorting table, and updating the drawing/sorting table;
S402, extracting a random number N 2 from the block head parameters of the drawing/sorting blocks in the deleted row information in the drawing/sorting table, converting the random number N 2 into decimal, calculating a corresponding value of an index Z 2 according to the random number N 2, and finding a corresponding number from the new drawing/sorting table according to the value of the index Z 2; deleting the row information of the currently calculated drawing/sorting number from the drawing/sorting table, and updating the drawing/sorting table;
s403, repeating the step S402 until only one row of the lottery sorting table is left;
Wherein, the calculation formula of the index is: z n= Nn mod Hn, and if Z n =0, Z n =hn; where hn=h-n+1, H denotes the total number of people involved in drawing/sorting, N denotes the nth block involved in calculation, and N n denotes the random number in the nth block involved in calculation.
The blockchain is a public chain with random number parameters and time stamp parameters in the block header.
In the step S3, the number of the selected drawing/sorting block height is selected according to the number of the drawing/sorting activity participant.
The lottery/ordering activity uses the number as the lottery/ordering result.
The drawing/ordering campaign participants are ordered according to the order in which the drawing/ordering campaign participant index was found.
The drawing/ordering campaign participants are ordered with the value of index Z n as the ordering number of the drawing/ordering campaign participant numbered n.
Compared with the prior art, the invention has the following beneficial effects:
1. The invention is based on the block chain technology, the decentralization and the calculation of the lottery/sequencing result is based on the random number of the unknown block, any person cannot cheat, even the lottery/sequencing sponsor cannot predict or set the lottery/sequencing result in advance, and a public, fair and fair lottery/sequencing method can be realized.
2. According to the lottery/sequencing method, random numbers in the blocks are generated through cooperation of all nodes of the whole network, so that the lottery/sequencing results are technically guaranteed to be more random and more fair.
3. The invention belongs to a lottery/ordering method without notarization and hardware, which does not need third party notarization and lottery/ordering device, and can greatly reduce lottery/ordering cost.
4. According to the drawing/sorting method, the drawing/sorting participants can freely and autonomously select the heights of the drawing/sorting blocks.
5. The lottery/sequencing method of the invention has the advantages that the lottery/sequencing rule, the lottery/sequencing block height and the corresponding relation between the lottery/sequencing participants and the selected lottery/sequencing block are published before the lottery/sequencing, any user can check through the blockchain browser, and supervision of all parties is facilitated.
6. According to the lottery/sequencing method, after the block is confirmed, any user can check the random number in the area head through the block chain browser, so that a lottery/sequencing result is calculated, and supervision of all parties is facilitated.
7. The lottery/sorting method can quickly determine all lottery/sorting results by only acquiring the random number parameter in one new output block.
Drawings
FIG. 1 is a flowchart of a lottery/sorting method based on a blockchain technique according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for selecting a drawing/sorting block by a drawing/sorting participant according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for calculating a lottery/sorting number according to an embodiment of the present invention;
FIG. 4 is a diagram showing the initial lottery/sorting block calculating the lottery/sorting numbers and updating the lottery/sorting table;
FIG. 5 is a second calculation of the drawing/ranking number and updating of the drawing/ranking table;
FIG. 6 shows a third calculation of the drawing/sorting number and updating of the drawing/sorting table;
FIG. 7 calculates the drawing/sorting number and updates the drawing/sorting table a fourth time;
FIG. 8 shows the fifth calculation of the drawing/ranking number and the updating of the drawing/ranking table;
FIG. 9 is a block header parameter diagram of a blockchain used in an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments; all other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Because of the variety of blockchain techniques, some important details are described for facilitating understanding of the implementation method of the present invention: in a blockchain network, data is permanently recorded in the form of files, called blocks. The new block cannot be changed or deleted once it is acknowledged. Each block records all events that occur some time before it is created. The parameter information in the block header may include: version number, parent block hash value, merkle root, timestamp, difficulty value, random number, etc., which the present invention does not specifically limit, but must include random number and timestamp. The random number is used to generate a drawing/sorting number and the time stamp can verify the various moments mentioned in the method of the invention. The block has two identifiers, one is the hash value of the block header and the other is the block height. The block identifier of the present invention is selected in consideration of the fact that the block height is a continuously variable positive integer, which may be designated in advance.
The invention provides a fast drawing/sorting method based on a blockchain technology, the basic principle of which is shown in fig. 1, before drawing/sorting is started, a drawing/sorting activity participant randomly selects a drawing/sorting block (height) in a history block of a blockchain, an activity sponsor designates an initial drawing/sorting block (height), and then the activity sponsor writes the designated initial drawing/sorting block (height), all drawing/sorting participant information and the selected corresponding block (height) on a blockchain as a certificate. Then, at the time T 1, the information is published outwards and cannot be changed, and all parties can check the published information in the blockchain browser. The initial draw/sort block specified by the campaign sponsor is a block that will not be generated at time T 2 in the future, as opposed to the block that has not been generated at time T 1. After the initial drawing/ordering block is confirmed by the full network node at time T 3, the data will not be changed in a bifurcation, and the drawing/ordering activity sponsor can start the drawing/ordering operation. The lottery/sort event sponsor extracts the random numbers in all the lottery/sort blocks at time T 4 and then calculates all the lottery/sort numbers. On the time axis, T 1<T2<T3<T4. The specific method adopted comprises a method that a drawing/sorting participant selects a drawing/sorting block, a method that an activity sponsor selects an initial drawing/sorting block and a method for calculating a drawing/sorting number.
Specifically, the fast lottery/sequencing method based on the blockchain technology provided by the embodiment of the invention comprises the following steps:
s1, a drawing/sorting activity participant randomly selects one drawing/sorting block in a historical block of a blockchain, and the blocks selected by all drawing/sorting participants are different.
S2, the activity sponsor selects a block which is only output at the time T 2 in the future as an initial drawing/ordering block.
S3, creating a drawing/sorting table, wherein in the drawing sorting table, all drawing/sorting activity participants respectively set a number; in the step S3, the number of the selected drawing/sorting block height is selected according to the number of the drawing/sorting activity participant.
S4, after the designated initial drawing/sorting block waits for a plurality of block acknowledgements on the chain, extracting a random number N 1 from the block header parameters of the initial drawing/sorting block, calculating an index value according to the random number, determining a corresponding sorting number through the index value, and repeating calculating the index value for the next block participating in the index value calculation.
The step S4 specifically includes the following steps:
S401, after a designated initial lottery/sorting block waits for a plurality of block acknowledgements on a chain, extracting a random number N 1 from block header parameters of the initial lottery/sorting block, converting the random number N 1 into decimal, calculating a corresponding value of an index Z 1 according to the random number N 1, and finding a corresponding number from a lottery/sorting table according to the value of the index Z 1; deleting the row information of the currently calculated drawing/sorting activity participants from the drawing/sorting table, and updating the drawing/sorting table;
S402, extracting a random number N 2 from the block head parameters of the drawing/sorting blocks in the deleted row information in the drawing/sorting table, converting the random number N 2 into decimal, calculating a corresponding value of an index Z 2 according to the random number N 2, and finding a corresponding number from the new drawing/sorting table according to the value of the index Z 2; deleting the row information of the currently calculated drawing/sorting number from the drawing/sorting table, and updating the drawing/sorting table;
s403, repeating the step S402 until only one row of the lottery sorting table is left;
Wherein, the calculation formula of the index is: z n= Nn mod Hn, and if Z n =0, Z n =hn; where hn=h-n+1, H denotes the total number of people involved in drawing/sorting, N denotes the nth block involved in calculation, and N n denotes the random number in the nth block involved in calculation.
S5, sorting the drawing/sorting activity participants according to the index calculation result.
The flow of the method for selecting the drawing/sorting blocks by the drawing/sorting participants is shown in fig. 2, the drawing/sorting participants randomly select one drawing/sorting block (height) in the history blocks of the blockchain, and the only requirement is that the same situation cannot occur among the selected blocks (height), and all the selected blocks must be unique, otherwise, the same participants are again allowed to reselect or re-start any selection of a round of blocks by the activity sponsor. The method of the event sponsor to select the initial drawing/ordering block is relatively simple, and a block (height) of the block is selected only at the time T 2 in the future.
Then, the activity sponsor performs sorting according to the sequence of the selected blocks of the activity participants (i.e. the sequence that the height of the selected drawing/sorting blocks of the drawing/sorting participants is from small to large), and then the drawing/sorting participants are in one-to-one correspondence with the drawing/sorting blocks (wherein the number of the drawing/sorting participants is the same as that of the drawing/sorting blocks, and one drawing/sorting participant corresponds to one drawing/sorting block), as shown in table 1.
Table 1 lottery/ordering participants and their selected lottery/ordering blocks
Here, block_1, block_2, block_3 in table 1. Then, the information of all participants and the selected block is written on the block public chain and then published in the format that:
Participant_1 Block_1—Participant_2 Block_2—……—Participant_H Block_H—Block_initialization
Of which the last one is the initial drawing/ordering block (height) selected for the event sponsor.
In the following, the drawing/sorting based on the ethernet public chain technology is described as an example, where the ethernet block-out speed is 1 block per 15 seconds on average, i.e. 4 blocks per minute on average, 240 blocks per hour on average. Assuming that the time is 13 pm integer at 11/20/2018, the current ethernet block height is 6737645, assuming that the lottery/ordering event sponsor statistically takes 6 people involved in the lottery/ordering event, the sponsor preparation plan generates an initial lottery/ordering block around 15 pm at 11/20/2018, the initial lottery/ordering block height can be approximately calculated as: 6737645+240x2= 6738125, the sponsor can select the initial drawing/ordering block height to be 6738125, or can select it nearby, for example, the sponsor can select the final initial drawing/ordering block height to be 6738120, and the drawing/ordering block heights selected by the remaining 6 drawing/ordering participants are: 123456, 880880, 66666, 5840, 1037627, 1000. Then the activity sponsor orders the blocks from small to large as follows: 1000. 5840, 66666, 123456, 880880, 1037627, and then associate the drawing/ordering participant with the drawing/ordering tile one-to-one, as shown in table 2.
Table 2 lottery/ordering participants and their selected lottery/ordering blocks
Wherein, the name example is only schematically illustrated, and then the lottery/ordering event sponsor writes all the specified/selected information on the block public chain, and the text information format is as follows:
zhang San1000-Lifour 5840-Wang Wu 66666-Zhao Liu 123456-Li Gang 880880-Zhang Feng 1037627-6738120
When writing the block public chain, firstly converting the text information into UTF-8 code, then converting the UTF-8 code into 16 system code, copying and pasting the code into the transmission option of the Ethernet wallet, wherein the transmitted wallet address can be random, and the limit exists in gas transferred by the Ethernet, so that the transmittable data can only transmit data not exceeding 44KB, and the block writing mode can be adopted under the condition of excessive information. After the transaction confirmation is completed, UTF-8 codes can be selected below the transaction page of the Ethernet browser block, and the text information of the block which is just written in can be queried.
Once the lottery/ordering event sponsor has the information uploaded, it may be published at time T 1, for example 30 minutes at 13 pm at 11/20 2018.
Note that: block 6738125 is the block height estimated from the average speed of the block, which may be actually taken at any time around 15 pm on 11/20/2018, for example: the actual block-out time of the block with the height 6738125 is 52 minutes and 32 seconds at 14 pm on the day of 2018, 11 and 20.
The flow of the method for calculating the drawing/sorting number is shown in fig. 3, and the drawing/sorting based on the ethernet public chain technology is described below as an example, and the initial drawing/sorting block published by the drawing/sorting sponsor will be output at time T 2, as shown in table 3.
Table 3 initial lottery/sort block out time
Each block of the ethernet is acknowledged by default by 120 blocks by the full network node, and the data will not be changed in a bifurcation, so that the block acknowledgement time T 3 =time T 2 +ts, where Ts is the time when 120 blocks are acknowledged by the full network node, and the lottery/ordering sponsor may start the lottery/ordering operation at time T 4 after time T 3, i.e. T 3<T4. For example: the initial drawing/sorting block of height 6738120 is 21 minutes 25 seconds after 120 block acknowledgements, at 15 pm on 11 months 20 in 2018, after which time the drawing/sorting number can be calculated for the initial drawing/sorting block of height 6738120.
The method for calculating the lottery/sequencing number specifically comprises the following steps:
1. A drawing/sorting table is created as shown in table 4. After the designated initial lottery/sorting block waits for a plurality of block acknowledgements on the chain, extracting a random number N 1 from the block header parameters of the initial lottery/sorting block, converting the random number N 1 into decimal, calculating a corresponding value of an index Z 1 according to the random number N 1, and obtaining a corresponding lottery/sorting number from a lottery/sorting table according to the value of the index Z 1; deleting the row information of the currently calculated drawing/sorting number from the drawing/sorting table, and updating the drawing/sorting table;
Table 4 lottery/ranking table
2. Extracting a random number N 2 from the block head parameters of the deleted lottery/sorting blocks in the lottery/sorting table, converting the random number N 2 into decimal, calculating a corresponding value of an index Z 2 according to the random number N 2, and finding a corresponding sorting number from the new lottery/sorting table according to the value of the index Z 2; deleting the row information of the currently calculated drawing/sorting number from the drawing/sorting table, and updating the drawing/sorting table;
The subsequent drawing/sorting blocks are sequentially calculated according to the algorithm until all drawing/sorting numbers are found, i.e. only one row of the drawing/sorting table remains. The calculation formula of the index corresponding to each block is as follows: z n= Nn mod Hn, and if Z n =0, Z n =hn; where hn=h-n+1, H denotes the total number of people involved in drawing/sorting, N denotes the nth block involved in calculation, and N n denotes the random number in the nth block involved in calculation.
In this embodiment, it is assumed that the number of drawing/sorting participants is h=6, and also that the possible drawing/sorting numbers are 1-6, as shown in the second column of table 4. If the possible drawing/sorting numbers are more than 6, the calculation process is as such not listed separately. The following describes the calculation of 6 lottery/sort numbers taking block heights 6738120, 1000, 5840, 66666, 123456, 880880, 1037627 as an example.
The initial lottery/sorting block random number of height 6738120 is: 0xb393d84007562d80, into decimal: 12939923923878161792, h1=6, 12939923923878161792 mod 6 =0, i.e. index Z 1 =6, and the drawing/sorting number corresponding to index 6 is 6, the calculation result is: the drawing/ordering participant encoded as 6 orders the first and then deletes the row of drawing/ordering table number 6, updating the drawing/ordering table, as shown in fig. 4.
The height of the drawing/sorting block deleted from the drawing/sorting table is: 1037627, extracting random numbers from the block header parameters of the block is as follows: 0x86fdc0762c5713f9, converted to decimal: 9727142383972717561, index Z 2 = 9727142383972717561 mod 5 =4, consult the drawing/sorting table, know that the drawing/sorting participant coded 4 sorts second, then delete the row of drawing/sorting table number 4, update the drawing/sorting table, as shown in fig. 5.
The height of the drawing/sorting block deleted from the drawing/sorting table is: 123456, extracting the random number from the block header parameter is: 0xf4b883fed83092b2, converted to decimal: 17633989471541170866, index Z 3 = 17633989471541170866 mod 4 =0, i.e. index Z 3 =4, consulting the drawing/ordering table, knowing that the drawing/ordering participant coded 5 orders the third, then deleting the row of drawing/ordering table number 5, updating the drawing/ordering table, as shown in fig. 6.
The height of the drawing/sorting block deleted from the drawing/sorting table is: 880880, extracting random numbers from the block header parameters of the block is as follows: 0x2d1f47977b1ffa b, converted to decimal: 3251396171916114539, index Z 4 = 3251396171916114539mod 3 =0, i.e. index Z 4 =3, consulting the drawing/ordering table, knowing that the drawing/ordering participant coded 3 orders the fourth, then deleting the row of drawing/ordering table number 3, updating the drawing/ordering table, as shown in fig. 7.
The height of the drawing/sorting block deleted from the drawing/sorting table is: 66666, extracting the random number from the block header parameter is: 0xfc631df0c04190b2, converted to decimal: 18186412640107073714, index Z 5 = 18186412640107073714mod 2 =0, i.e. index Z 5 =2, consulting the drawing/ordering table, knowing that the drawing/ordering participant coded 2 orders fifth, then deleting the row of drawing/ordering table number 2, updating the drawing/ordering table, as shown in fig. 8. At this time, only one drawing/ranking code 1 remains, and the drawing/ranking participant whose code is 1 is known to rank sixth.
The final drawing/ranking number is: 6,4,5,3,2,1. Namely, the ranking order is as follows: zhang Feng, zhao Liu, li Gang, king five, li four, zhang three.
In the above embodiment, when the drawing/ordering activity participants are ordered, the drawing/ordering activity participants are ordered according to the order in which the drawing/ordering activity participants are found. In addition, in the embodiment of the present invention, when the drawing/sorting activity participants are sorted, the value of the index Z n may be used as the sorting number of the drawing/sorting activity participant with the number n to sort the drawing/sorting activity participant. In this case, zhang San No. 6, li four No. 4, wang five No. 5, zhao Liu No. 3, li Gang No. 2, zhang Feng No. 1; the final ordering after finishing is as follows: zhang Feng, li Gang, zhao Liu, li four, wang five, zhang three. Although the final ordering is performed by different ordering methods, it should be noted that both methods do not affect the fairness of the embodiment.
Fig. 9 is a schematic diagram of block header parameters of a block chain used in the drawing ordering method according to the embodiment of the present invention, where parameters of different block chain technologies in each block header may be different, but the present invention is not limited thereto, and the present invention is required to include two parameters, namely a random number and a time stamp, where the random number is used to calculate the drawing/ordering number, and the time stamp can verify the time T 1、T2、T3、T4 mentioned in the present invention. After the random number is extracted, if hexadecimal, the random number needs to be converted into decimal.
According to the embodiment of the invention, 6 lottery/sorting numbers are calculated through random numbers in 7 blocks of the Ethernet, so that the possibility of lottery/sorting cheating is technically eliminated, and the problem that the lottery/sorting lacks safety, fairness and openness by a third party mechanism is solved. Moreover, all the drawing/ordering results can be determined quickly by only acquiring the random number parameter in one new output block. The sorting method is simple, the calculation process is quick and convenient, and the sorting speed is improved.
It should be noted that, since the essence of the drawing/ordering activity is that all drawing/ordering participants are randomly assigned a number which may occur and is inconsistent with each other, as to whether the number represents a winning, being ordered, etc. possible situations, it is merely determined according to the specific drawing/ordering activity content, and the essence of the drawing/ordering activity is not affected. Wherein in the drawing event, the number of drawing participants is less than or equal to the total number of possible drawing numbers, and in the sorting event, the number of sorting participants is equal to the total number of possible sorting numbers. Neither of these cases affects the practice of the invention.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention.

Claims (7)

1. The fast lottery/sequencing method based on the blockchain technology is characterized by comprising the following steps of:
S1, a drawing/sorting activity participant randomly selects a drawing/sorting block in a historical block of a blockchain, wherein the blocks selected by the drawing/sorting participants are different;
s2, the activity sponsor selects a block which is only output at the time T 2 in the future as an initial drawing/sorting block;
S3, creating a drawing/sorting table, wherein in the drawing sorting table, all drawing/sorting activity participants respectively set a number;
s4, after the designated initial drawing/sorting block waits for a plurality of block acknowledgements on the chain, extracting a random number N 1 from the block header parameters of the initial drawing/sorting block, calculating an index value according to the random number, determining the next block participating in the index value calculation through the index value, and repeatedly calculating the index value;
S5, sorting the drawing/sorting activity participants according to the index calculation result.
2. The fast lottery/ordering method based on the blockchain technique according to claim 1, wherein the step S4 specifically includes the steps of:
S401, after a designated initial lottery/sorting block waits for a plurality of block acknowledgements on a chain, extracting a random number N 1 from block header parameters of the initial lottery/sorting block, converting the random number N 1 into decimal, calculating a corresponding value of an index Z 1 according to the random number N 1, and finding a corresponding number from a lottery/sorting table according to the value of the index Z 1; deleting the row information of the currently calculated drawing/sorting activity participants from the drawing/sorting table, and updating the drawing/sorting table;
S402, extracting a random number N 2 from the block head parameters of the drawing/sorting blocks in the deleted row information in the drawing/sorting table, converting the random number N 2 into decimal, calculating a corresponding value of an index Z 2 according to the random number N 2, and finding a corresponding number from the new drawing/sorting table according to the value of the index Z 2; deleting the row information of the currently calculated drawing/sorting number from the drawing/sorting table, and updating the drawing/sorting table;
s403, repeating the step S402 until only one row of the lottery sorting table is left;
Wherein, the calculation formula of the index is: z n= Nn mod Hn, and if Z n =0, Z n =hn; where hn=h-n+1, H denotes the total number of people involved in drawing/sorting, N denotes the nth block involved in calculation, and N n denotes the random number in the nth block involved in calculation.
3. The fast lottery/ordering method based on blockchain technology of claim 1, wherein the blockchain is a public chain with random number parameters and timestamp parameters in a block header.
4. The fast drawing/ordering method based on blockchain technology according to claim 1, wherein in the step S3, the number of the drawing/ordering activity participant is the order number of the drawing/ordering block height selected for the drawing/ordering activity participant.
5. The method of claim 1, wherein the drawing/ordering activity uses a number as the drawing/ordering result.
6. The fast drawing/ordering method based on blockchain technology according to claim 1, wherein the drawing/ordering activity participants are ordered according to the order in which the drawing/ordering activity participant indexes are found.
7. The fast drawing/ordering method based on blockchain technology according to claim 1, wherein the drawing/ordering activity participant is ordered by taking the value of index Z n as the ordering number of the drawing/ordering activity participant numbered n.
CN202110451727.1A 2021-04-26 2021-04-26 Quick lottery/sequencing method based on block chain technology Active CN113157700B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110451727.1A CN113157700B (en) 2021-04-26 2021-04-26 Quick lottery/sequencing method based on block chain technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110451727.1A CN113157700B (en) 2021-04-26 2021-04-26 Quick lottery/sequencing method based on block chain technology

Publications (2)

Publication Number Publication Date
CN113157700A CN113157700A (en) 2021-07-23
CN113157700B true CN113157700B (en) 2024-05-14

Family

ID=76870680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110451727.1A Active CN113157700B (en) 2021-04-26 2021-04-26 Quick lottery/sequencing method based on block chain technology

Country Status (1)

Country Link
CN (1) CN113157700B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726534A (en) * 2022-03-28 2022-07-08 海南格子山网络科技有限公司 Method for realizing intelligent contract drawing based on Solana block chain technology

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002352037A (en) * 2001-05-23 2002-12-06 Ntt Data Corp Ranking method, lot drawing server, terminal, and program
CN105740440A (en) * 2016-02-01 2016-07-06 上海凭安网络科技有限公司 Indexing method for quickening block chain query
CN107103097A (en) * 2017-05-22 2017-08-29 中链科技有限公司 Drawing method and terminal device based on block chain technology
CN109918044A (en) * 2019-02-26 2019-06-21 太原理工大学 A kind of lot/sort method based on block chain technology
GB202009798D0 (en) * 2020-06-26 2020-08-12 Nchain Holdings Ltd Methods and devices for validating data in a blockchain network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002352037A (en) * 2001-05-23 2002-12-06 Ntt Data Corp Ranking method, lot drawing server, terminal, and program
CN105740440A (en) * 2016-02-01 2016-07-06 上海凭安网络科技有限公司 Indexing method for quickening block chain query
CN107103097A (en) * 2017-05-22 2017-08-29 中链科技有限公司 Drawing method and terminal device based on block chain technology
CN109918044A (en) * 2019-02-26 2019-06-21 太原理工大学 A kind of lot/sort method based on block chain technology
GB202009798D0 (en) * 2020-06-26 2020-08-12 Nchain Holdings Ltd Methods and devices for validating data in a blockchain network

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
可更改区块链技术研究;李佩丽;徐海霞;马添军;穆永恒;;密码学报(05);全文 *

Also Published As

Publication number Publication date
CN113157700A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
US11232081B2 (en) Methods and apparatus for a distributed database within a network
US11657036B2 (en) Methods and apparatus for a distributed database that enables deletion of events
US10318505B2 (en) Methods and apparatus for a distributed database within a network
KR102012435B1 (en) Method and apparatus for distributed database in a network
CN109985389B (en) Cheating-preventing method and system for card games based on intelligent block chain contracts
CN107103097A (en) Drawing method and terminal device based on block chain technology
CN110602217B (en) Block chain-based alliance management method, device, equipment and storage medium
CN108667717A (en) Block chain processing method, medium, device and computing device based on instant communication message record
CN108365960B (en) Random number providing method and device
CN109918044B (en) Block chain technology-based drawing/sorting method
Braverman et al. Mafia: A theoretical study of players and coalitions in a partial information environment
CN113157700B (en) Quick lottery/sequencing method based on block chain technology
Petrov et al. Online political flashmob: The Case of 632305222316434
CN111047316A (en) Tamper-resistant intelligent block chain system and implementation method
CN111125420A (en) Object recommendation method and device based on artificial intelligence and electronic equipment
CN110310176A (en) A kind of data ciphering method and device based on block chain network
CN113779608A (en) Data protection method based on WOE mask in multi-party longitudinal federal learning LightGBM training
CN111223227B (en) Target user screening method and device
Hsueh et al. EPoW: Solving blockchain problems economically
CN110784315B (en) Block chain-based number shaking method and device, computer equipment and storage medium
CN110189465B (en) Random lottery method and equipment by means of block chain
CN109299388A (en) A kind of system and method for searching high quality social activity user
CN115687526A (en) Seismic data model sharing method based on block chain and federal learning
CN111953546B (en) Internet of things equipment management method based on block chain system and intelligent home system
CN105373539A (en) Method and system for sharing ranking

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