The Fair Lottery Program

788e47d add mock web interface

1 year, 7 months ago

44fa83f use vectors

1 year, 7 months ago

#lotte: The Fair Lottery Program

This is still a proof of concept


lotte needs guile and guile-gcrypt


To start a lottery, run

./lotte-cli.scm some-name

This will create a text file called some-name.txt with the info you are about to provide (if you didn't give it a name, it will create one with a random name). Fill them in like below, and it should tell you want you need to post in your lottery.

Enter the name of your lottery (needs to be unique each time): shironeko's 1st Test Lottery
Enter your lucky number: 42
Enter the number of winners: 2
The info you need to post:
shironeko's 1st Test Lottery
Lucky number's MAC: rYIpZz6lb4OmdGXWAWCpS39cSgCpk5El1ep-b0JGtDs=
Number of Winners: 2

The generated file should look like this

shironeko's 1st Test Lottery

Then add users one by one like so, make sure to not have any trailing spaces

shironeko's 1st Test Lottery
idon't really know this guy

To draw the winners, run

./lotte-cli.scm some-name.txt

lotte should output the winner, their score, and all the other info you need to post.

The winners are:
myself score: 001b6c8ebff639c529feea5115754b56c1b2f29e201f35f5c718a1efdff6f4a8
🐈️🐈️🐈️🐈️🐈️🐈️🐈️🐈️ score: 0502b2bc4e4e79f3cdbe530be27608d2becd2b0d5bc21f166ddc59a40945d835
The lucky number is: 42
The MAC key is: 8KwDCd16chFZUw0YWmSOpEWYNqco3YKb2wXt8-nJdDE=

Participants can use those to calculate their own score, and they can verifiy that nothing fishy (heh) is going on (lowest score wins).

score = min(sha256(1 <lottery name> <username>),...,sha256(<lucky number> <lottery name> <username>))
mac = hmac-sha256(mac-key, lucky-number-str)


lotte: The Fair Lottery Program
Copyright 2020 shironeko

This file is part of lotte.

lotte is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

lotte is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with lotte.  If not, see <https://www.gnu.org/licenses/>.