When it comes to casinos, both physical and online, it is always a player’s concern that the house may be cheating them and changing what would have been a winning bet into a losing one. Confident in their house edge (the advantage they have over players) many online casinos accepting Bitcoin and other cryptocurrencies have decided on proving to players that there is no way they could have manipulated the results of a wager, using the same mathematical concepts well-known in cryptography.
To elaborate, I’ll first explain what a hashing function and a hash is. A hash function maps or represents data of any size to data of fixed size. Hash functions have many applications in different areas of computer science, cryptography among them. For example, the words “Hello World!” being fed to the SHA256 hashing function returns
c0 53 5e 4b e2 b7 9f fd 93 29 13 05 43 6b f8 89 31 4e 4a 3f ae c0 5e cf fc bb 7d f3 1a d9 e5 1a, a 64-character string in hexadecimal. The result of a hashing function is known as the hash value, or simply the hash. A set of data will always produce the same hash, but it’s just enough to change one piece of the original data to change the resulting hash. For example, “Hello World?” produces
8a 0b 7c 66 35 f5 1f 10 71 0d ec aa 6f d5 8f dd 9f a3 a5 aa e4 df 8a 96 f9 49 fe a7 cf 61 49 70, which clearly differs from the original hash. The results are both 64 characters in hexadecimal, but they are much different from each other than their inputs are.
How is this relevant to making bets provably fair? The exact process varies from site to site, but it is expected to involve a server seed, a hashing function, a hash of the server seed, a client seed and a nonce. The client seed, the hash of the server seed and nonce are known by the user at first, and once the server seed is revealed, they can all be used together to prove all bets have been fair.
First, the site generates the seed pair, the initial values which will be used for all of the player’s bets until they want to know the server seed and start the process over. Some sites will give players the option to input their own client seed or simply generate it for them. The server seed is kept secret, but the player is given its hash.
Every time a player makes a bet, the site takes the client seed plus a nonce (an arbitrary value used once, usually the number of bets the player has made with that pair of seeds) and combines it with the server seed to create a hash. This result is used to determine the outcome of the play in some way that is site-dependent.
At any point and before another bet is done, the player may request the site to reveal the secret server seed. The server will generate a new seed for the proceeding set of games. A remarkable property of hashing functions, particularly those used in cryptography, is that they’re one-way; that is, it is trivial to verify a given piece of data (such as the server seed) matches a hash value, but makes it practically impossible to determine the original data given the hash. Now that a player knows the server seed, they can be sure the site never altered it, or else hashing the seed would generate a different value from the one given at the beginning of the process. They can recreate any of the rolls they have made with their client seed plus nonce to verify their outcome is unadulterated.
Of course, even though an online casino may have a provable fairness mechanism, this is just one step in having a measure of their trustworthiness. Players are advised to watch out for any other warning signs such as blatant interface rip-offs from other sites (showing a lack of professionalism) and undue delays in withdrawals or deposits (delays may still occur on large withdrawals, as money is moved from the site’s cold wallet to the hot wallet) before placing considerable bets.
Gamble with your Bitcoins today!