L
L
lexxleon2018-12-20 21:38:54
Cryptography
lexxleon, 2018-12-20 21:38:54

How to implement the ability to check the result of the game using cryptography?

Hey Ya! There is a conditional site of gambling. The player makes a bet, the generator gives out numbers from 1 to 100, if the number is less than the number specified in the rules, the win is counted. Everything would be fine, but the system does not guarantee the players honesty on the part of the organizer. We need a way to check honesty.
3 more points: the player's actions do not affect anything, bets are made anonymously by transferring bitcoins - the player can uniquely identify his transaction by txid, several games can be included in one transaction.
I have the following idea:
1. Generate a large array of numbers from 1 to 100.
2. Find the hash from the array.
3. We write some f(txid, n, h), where txid is the transaction ID, n is the game number, h is the hash of the array. The function uniquely returns us the position in the array, and hence the number at this position.
4. Compare the number with the conditions, etc...
If the player wants to check the honesty, he can take the array himself, find the hash, substitute his txid, n and make sure the result of the game is true.
So, how can you implement this f()? Maybe there are already ready-made solutions for this task?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sim3x, 2018-12-20
@sim3x

The player makes a bet and sends it to the server
The server decides that he won

#
#, 2018-12-21
@mindtester

you need to generate both the encryption key and the number, encrypt the number and inform the players BEFORE betting .
encrypt with a crypto-resistant cipher .. at that, crypto-resistance for millions of years of brute force is not necessary, you can limit the player to a minute per bet (or less) .. even a RAR archive with a terrible password will go in a dumb version.
after the bets - give out the password and winning
ps rar is not bad, because it is a ready-made solution (you can add the accompanying text to the archive, which also changes quite randomly) ..
you can also use any archiver with more or less reliable password protection, or widely known encryption packages. but this is clearly more difficult for the players (and you hardly need to load their brains)
otherwise, you will have to make your decision, in terms of encryption, open source and publish it. otherwise no one will trust .. but it will also be a burden for the brain of the players ..
pps .. the essence is the same - first deal the card , but until the bet is made - do not let it turn over , but the player already has his hand on the card , knows that it is no longer possible to replace it

N
nvdfxx, 2018-12-21
@nvdfxx

You can use random.org. There, like random numbers are generated based on radio frequency interference

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question