Game Example

This describes how blockchain is used to prove the legitimacy of the lottery and how winners are chosen and paid out. While the game is in progress, only certain details of the blockchain are made public. When the game ends, the entire blockchain will be made public. This is enough information to prove that the entire game is ran by the rules, and that tickets, winners, and payouts are accounted for.

The first block describes all the parameters of the lottery:

Every block from here on will contain a previous_hash which refers to the SHA-256 of the previous block. There are many free tools online to verify the hash is correct. If you copy the first block text into the tool, the SHA-256 returns d534d9756c71325c0f5f2b3f46da180bc5f7043824022ea7ff31ac95f9d395e3. By changing any part of the text, the entire hash changes. Try it!

The next block is a ticket:

As each block is added, the previous_hash ensures the previous block can not be changed. This ensures that the rules can not be changed while the lottery is in progress, along with the players and picks.

The next 99 blocks are more tickets. The game will continue until both the game_ends_at_index and game_ends_at_timestamp are met.

When the game ends, the "final block" will be added:

The game is closed and no more tickets can be added. This block is unique in that it offers a few security measures. The final_block_salt was determined in the first block, and in conjunction with the previous_hash, we can ensure randomness of the hash of the final block. All the values of this block are pre-determined, so not even the lottery owner can control the resulting hash.

The next block is the winner calculation block:

Winning numbers: Given the formula winner_formula=first_numericals_plus_1, and the previous_hash starts with 56fb3. We take the first numericals (5 and 6) and add 1 to each (because we can't pick 0), resulting in winning_numbers=[6, 7]. This winner-deciding previous_hash is unpredictable and all numbers are equally likely.

Winner percents: Given the rules winner_rules=first_or_both. In this example, 9 people won the lottery. 8 got the first number and 1 got both right. Using "points" to describe how we split up the pot, each player that got the first number right gets 1 point and each player that got both right gets 10 points (because getting the second number is a 1 in 10 chance).

(8 * 1) + (1 * 10) = 18 total points. This means each "small" win is 1 / 18 = 5.5% and each "big" win is 10 / 18 = 55%

If there are no big winners, the small winners still split the total pot with the same system. It is also possible for a single player to win two tickets. In this example, if one player had 2 small wins they would get 11%. It is very unlikely that there are no winners, but in that case, there are no winners.

The next block is the payout block:

As soon as the lottery ends, the winner payouts are sent to the same account which the tickets were purchased from.

This list should correspond with the amounts in the winner calculation block. The 8 small winners won 55 each, the big winner won 550. total payout was 8 * 55 + 550 = 990. * Final payout amounts are rounded down

To double check the payout math, our total_pot was 1000, total_rake was 10. 1000 - 10 = 990.

This is the actual final block. The blockchain is in stone and will not be added to. The results are published for everyone to review and verify.

* This example data was made through a software driven test, so the timestamps are very close together