All the tickets purchased have its own index number,
or ticket number (from 1 to 800), and a unique corresponding hash (bitcoin transaction hash). Anyone can determine the winner by following these steps:
-
Take the transaction hash of the 800th ticket purchased (index number 800).
-
Extract the first three digits following the second digit (meaning you start from the third digit) of that hash.
-
If the resulting number exceeds 799, shift the reference point to the right by one digit until a suitable number is found in the range from 001 to 799.
-
Use this number to select the next index number from the purchased tickets list, take its hash, and repeat the procedure. If it results in a number of an already used hash, shift the reference point one digit to the right.
-
Repeat the procedure 76 times (from step one, when you took the 800th hash and found the number of the second index out of 77 total repetitions you need to make). If the resulting number falls on an already used hash, or the hash lacks a number meeting the criteria (i.e., all combinations of digits exceed 799), use the hash of the next index from the list. If this hash has been used or does not meet the conditions, use the hash of the previous transaction. This sequence of actions is maintained until a transaction hash that meets all the requirements is identified. If it is no longer possible to shift in one direction (you reach the first or the eight hundredth transaction), then shift in the direction where unused hashes are available. Example: if the hash of the ticket number 144 does not meet the given conditions, check the hash of the ticket number 145. If it does not meet the criteria, move to the hash of the ticket number 143, and so on.
-
The number obtained as a result of a valid (not requiring a shift to hashes of adjacent transactions) 77th repetition determines the index number of the winning ticket. We take the corresponding hash, and find the first three digits starting from the eleventh numeric position (so before the first digit of a target index number there are ten digits). This number becomes the winner's index/ticket number.
-
It is important to note that there are no tickets indexed/numbered above 800.
-
Suppose there is a situation where all hashes have been tried and the last one reached has no digits other than 8 and 9, the winning index number is the number consisting of the last two digits of the hash.
Example of finding a winner. The format of target numbers - 001, 009, 099.
We take the hash of a ticket # 800: 5bb3
47daa
501cdf0b.... The next ticket number to use the hash of - 475. Then we repeat this procedure 76 more times. Suppose the 77th hash is: f65f75b66dce9f12c3a8fd9
4a
310e.. Starting from the 11th position in the hash, we see that the first digit is 8, the next is 9, which does not fit, as there are no tickets with numbers higher than 800 or starting with 9. Therefore, we shift further to the right and determine that the winner has the number 431, considering that for small numbers, a leading zero is used (for example, 009 for ticket number 9).