ref: f3aba03fef88fb2c42adfa6788d9ee014004e75e lotte/README.md -rw-r--r-- 2.3 KiB
f3aba03f — shironeko move more stuff to cli 11 months ago

#lotte: The Fair Lottery Program

This is still a proof of concept


lotte needs guile and guile-gcrypt


Create a file like below, let's call it example.txt, bracketed text are comments. No trailing spaces anywhere please. :)

shironeko's 1st Test Lottery (Name needs to be differen each time)
42 (This is the lucky number, don't reveal it until the end, bigger is probably better)

Then run

cat example.txt | ./lotte.scm

the output shows your sealed lucky number, post it along with your announcement to prove you didn't change the lucky number afterwards, you need to save the key somewhere for that.

Your sealed lucky number is: 1617e076355f986242d59e15e51425c7fdee4b1c3227c9bfb0718f137a7af987
The key is: 31d3b2bd349f49c82c273fde55af55ac7ee1d8fbca49fd46857b639eb735a5d3 (reveal this at the end)

Then add users one by one like so

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

and run the same command again

cat example.txt | ./lotte.scm

lotte should output the winner along with their score.

The winner is: myself
Their score is: 001b6c8ebff639c529feea5115754b56c1b2f29e201f35f5c718a1efdff6f4a8

Don't forget to tell everyone the lottery name and the lucky number you used in the file and the key saved from before when you announce the winner. other users can use those to calculate their own score, and they can verifiy that nothing fishy (heh) is going on.

score = min(sha256(1 <lottery name> <username>),...,sha256(<lucky number> <lottery name> <username>))


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/>.