Using Cryptography for Holding Quiz Contests on Steem - Part 2: Choosing the Winner
Yesterday I showed that there were two fundamental problems when holding quiz contests on the Steem blockchain. The first problem is connected to contestants answering the quiz question. When the contest holder asks a question the participants should give the answer in the comments of the contest post. But as the first contestant gives the correct answer he/she reveals it to all the following contestant. All they have to do is to copy and paste the answer and present it as their own. In yesterday's post, I proposed a solution to this problem by using cryptography.
The second problem emerges at the end of the contest. The contest holder has to choose a winner from all the correct answers. This choice should be fair and not subject to manipulation by the contest holder or any of the participants.
Solutions Seen on the Steem Blockchain
I have seen three main approaches on Steem so far.
Choose the first correct answer
This is unsatisfactory. It effectively ends the contest when the first correct answer is given. Contestants from different time zones or working different shifts will have different chances of being the first.
Choose a winner at will
Here the contest holder clearly admits that the contest is not fair. This might be appropriate for creative contests. But it seems inappropriate for quizzes.
Use a random number generator
The contest holder uses a random number generator to choose a winner from all the correct answers. While this may seem fair, it relies on the contestants trusting the contest holder. Screenshots might be provided as proof. But these might have been manipulated.
The solution
This is a variant of the random number generator approach. Computers use so-called pseudo-random numbers. They are number sequences that are almost impossible to predict without further information and they look random. However, they are deterministic wham the seed number is known. One popular pseudo-random number generator is the Mersenne Twister.
Before the contest, the contest holder chooses a large integer number. This number acts as the seed offset. Using the same public key as presented in my last post, the contest holder encrypts the number and publishes it in the contest post.
When the contest is finished another number is calculated from all answers. For example, this could be the total number of characters in all answers added up. This number is added to the seed offset and the result acts as the seed for the random number generator.
The random number generator is then used to choose one or more winners from the correct entries.
Example
The contest holder asks a question:
What colour is the sky?The contest holder secretly chooses a large integer number:
6397571The contest holder encrypts the number using the public encryption key.
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbZidx6GgK5cDeesC+ODSGlBL3
rgb56kIPSUp5ZFzejfvhxCu7g3Ju23MOL/L9GHeut4tH/oCcKlD15GjloXk3/jqv
MAVFcSFoYY7CGTMXDE8bqiIKYQ1OdRqXayDrah7DEpXWU8BOy68AOzIW2Y10dISy
qexMMPxSb3TRhp6xdwIDAQAB
-----END PUBLIC KEY-----
This can be done here.
The result is
AqS/XIDb8vsSy2iLXqsv6RaYk0Eh+BE1IlwRy2yP2mAuVCs9peL+kkOZ83AgJV5eq2tGqmZ2ltGR7bkLET7itDNgFONoh8RpoQiOhTdC37przMEoAkaCsIkjWa4fJkHYxbflib8czu1K/0DguFxaFcooU33BxMiA2e8f9FeE4ik=
The contest holder publishes the question, the public key and the encrypted number in a post.
The contestants post answers in the comments. These answers are encrypted according to my last post. Let's say there are three answers.
1
Z7aeWFhqPC+/xmXmAp7RS909zip6hH9oAc/WH6z7/4dPWfqyPIihF597tAwm5Cl9mu+iLN4FYZrXSjVGh+2pgfGj+I++5SxveHAT+m2FDxq+u98reHfR/vm7VtARWRJP0UaOtjtUNeOWpblvpX3xch603LCKeeDDzVSwCcuzbhc=
2O5CXtTq6DD57qgoP0G7cqmhsIje2/9OmJtmH9hk7LbmO83snQdeHEEMebkDT2jsWcrRqBHkx/QWaGrvBwKEgeBciiD+LDMcFuS2l0kWtQMLABxeqBQoa4YiPMvzuDKYKbZpyWtsBtyaKhok5Kmaq2myhVetV9owJrO71ZgtD5zk=
3c/DXxZ/kSfuukH2IKUnWBgpks7ABOhwLZkGa9nCTVc1FKNjM+MMj6vo2CX0Bb9de7GTyTSdgBY1ftYebxlHqEsXhCt4STxextCPISahR/6Jut1axVyyBX5KZyP7oy5EZGpr/jXkJ93FV9Oukq76A2CtKxbnHwbM66cubqDaCzD0=
At the end of the contest, the private key is revealed.
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCbZidx6GgK5cDeesC+ODSGlBL3rgb56kIPSUp5ZFzejfvhxCu7
g3Ju23MOL/L9GHeut4tH/oCcKlD15GjloXk3/jqvMAVFcSFoYY7CGTMXDE8bqiIK
YQ1OdRqXayDrah7DEpXWU8BOy68AOzIW2Y10dISyqexMMPxSb3TRhp6xdwIDAQAB
AoGASZT9aHpbiY1w3efSDEAg3viOYqkMtJmv3f0ePoy/TMJ+WlDBRHDhZoyS1kzu
CdnkEd7nHJft3gRLgaM96D2lX5dIJk7HsvCJvdJvQ52wzYYCBO8gGHawxCnVCk7d
V0qGw4dY3euboYe65Nx1r2tbV2JZe03RM2UeqlN2KhXBo8ECQQDljRkwjf1nMfci
AoiBPmNlWC0jtifzzsEHkwxV8YsqVUiEL90DeUpQ19LdpcjrkBhlp75vZMwuRxqs
7PgWlSN7AkEArU3YVUcXAGSqXd03+AKZubYZWOiOF+afKNE6I5M+ZOSeijRNF5Le
91bXpDWNm4mUTlgwSod9c1jC7cEWpmM7NQJBAOIJvOI5D2xMoUQWJoDOBGZJG7ns
pw7HawCgZidDAHyhGhVAZGwFRY6x12x20ZBUhhGjyjw6j2yKi9P4TJtAJH0CQCch
oq1uxeTS1h0nrFGV1Lw4P/TxXdRLwLhoteX+g2IotRujv5yJD0tuEncDmJv8Lr6Z
7x2FBnCbJDinFsQvN9kCQDK6DzCHW3wgUzcP0H+xL0TKL493A5BBA55onooT4b0a
364jAqRkZGKjAdezjNr0xSk4mR/FrB6MtwUPoIGioXw=
-----END RSA PRIVATE KEY-----
All answers are decrypted.
"The sky is blue"
"blue"
"Blue"
The number of characters in all answers is added up.
15+4+4 = 23The result is added to the seed base
6397571 + 23 = 6397594A random number is generated using the resulting number as the seed.
This can be done here.
Seed: 6397594
Min: 1
Max: 3 (number of entries)
Number of Values: 1
Result: 2The winner is announced.
Contestant 2 wins the prize
Congratulations! This post has been upvoted from the communal account, @minnowsupport, by plasticmars from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews, and netuoso. The goal is to help Steemit grow by supporting Minnows. Please find us at the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.
If you would like to delegate to the Minnow Support Project you can do so by clicking on the following links: 50SP, 100SP, 250SP, 500SP, 1000SP, 5000SP.
Be sure to leave at least 50SP undelegated on your account.