Using Cryptography to Run Quiz Contests on Steem

in #crypto6 years ago (edited)

Contests are gaining popularity on Steem. Some contests are based on participants generating creative content. Others are based on Quiz questions. For the second type, the contest holder typically poses a question to which the participants have to find the correct answer. This type of contest poses two problems. Today I want to outline the two problems and present a solution to the first of these problems. Tomorrow I will give a solution to the second problem.

john-salvino-417565-unsplash.jpg

The Problems

  1. For Quiz based contests the first problem on Steem is due to the fact that there are no private messages. All communication is public. Thus, when one participant answers the question correctly all other participants can see the answer. Any subsequent entry into the competition simply needs to copy and paste the correct answer.

  2. The second problem has to do with randomly choosing a winner. This is not a problem if the first correct entry wins the contest. But many contest holders want to give everyone a fair chance. This is especially important if we expect entries from many different time zones around the world. So the winner must be chosen randomly from all correct entries during a given time period. How can it be ensured that the contest holder is honest and doesn’t prefer some contestants over others?

Some Approaches to Problem 1

Ignore the problem

The simplest approach to the problem is to simply ignore that it exists. The contest holder might appeal to the honesty of the participants. But there is no way anybody can enforce contestants to be honest. There will always be a number of entries that simply have copied and pasted the answer. This is unsatisfactory for the other contestants who genuinely attempted to solve the question themselves.

Receive the answers through different channels

One option is, for the contest holder to receive the answers through other channels. These might be emails or direct messages in Discord. This approach effectively prevents copy and paste solutions. But it creates other problems. The answers are given outside of the Steem blockchain. The process is not transparent and the contest holder might claim that answers given were incorrect or a participant might claim to have given the correct answer when, in fact, their answer was wrong. There is no way of checking because the answers are not on the blockchain.

Don’t ask quiz questions

Thanks @bunnypuncher

The downside is there can only be a limited number of competitions of this sort. There is no challenge to the contestants.

The Solution to Problem 1

The solution to this problem is based on public key / private key cryptography. The contest holder asks the question in the usual manner. But together with the questions the holder also presents a Public Encryption Key. The contestants use the public key to encrypt their answer and post the encrypted characters in the comments. Only the owner of the corresponding Private Encryption Key can decipher the answer. None of the other contestants knows what anybody else has answered.

At the end of the contest, the holder publishes the Private Encryption Key. Now everybody can decipher the answers of all the other contestants. Everybody can check which answers were correct and which answers were incorrect.

The effect of padding

The pure RSA public/private key encryption is deterministic. This means that answers which are identical to the letter will produce identical encrypted strings. A dishonest contestant could simply copy and paste the encrypted character string and claim that they found the same answer.

The solution to this problem is called padding and is already built into the standard RSA algorithms. Each message is padded with a random set of characters during encryption. This means if you repeatedly encrypt the same message, again and again, you will get a different encrypted output every time. The decryption process removed the padding again and leaves only the original message.

Example

Here is an example public/private key pair.

Public Key

-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCbZidx6GgK5cDeesC+ODSGlBL3
rgb56kIPSUp5ZFzejfvhxCu7g3Ju23MOL/L9GHeut4tH/oCcKlD15GjloXk3/jqv
MAVFcSFoYY7CGTMXDE8bqiIKYQ1OdRqXayDrah7DEpXWU8BOy68AOzIW2Y10dISy
qexMMPxSb3TRhp6xdwIDAQAB
-----END PUBLIC KEY-----

Private Key

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

Instructions

Encryption

  1. Follow this link.
  2. Type in any message into the field at the top.
  3. Copy the public key from above into the box below.
  4. The encrypted message will appear in the box below.
  5. Copy and paste it into the comments.

Decryption

  1. Go to the decryption section on the same link. as above.
  2. Copy the private key from this page above.
  3. Copy the encrypted message from the comments.
  4. You will see the decrypted message in the box at the bottom of the page.
  5. Try decrypting someone else’s message and post it as a reply.

Conclusions

I hope this solution to holding quiz contests on the Steem blockchain is helpful. It should allow interesting and fair competitions to be held.

Tomorrow I will be presenting a solution on randomly but transparently choosing a winner.

Happy Quizzing!

Photo by John Salvino

Sort:  

You have a minor misspelling in the following sentence:

### Recieve the answers through different channels.
It should be receive instead of recieve.

In the fight of Humans vs Bots, @megabot defended you with 28.57% upvote courtesy of @plasticmars!

Support @Megabot by delegating SP to the bot and get a part of 98% of @Megabot's profit.

Direct delegation links : 10 SP || 50 SP || 100 SP || 500 SP || 1000 SP || Any other amount of SP

Join our discord group here.

Thank You !

Coin Marketplace

STEEM 0.29
TRX 0.12
JST 0.032
BTC 60844.65
ETH 2995.69
USDT 1.00
SBD 3.88