raiden-network / grants

Repo for tracking universal Gitcoin grants
2 stars 3 forks source link

Provably fair verification tool #3

Open Devilla opened 4 years ago

Devilla commented 4 years ago

Proposal

So we're building a Provably fair verification tool (app / browser extension) for users of online casinos that enables the player to verify each bet result and make sure they are not being cheated! We'll integrate the UI with the Raiden network for micro-payments for say every recent 50 bets (approx.)

Description

What is "provably fair"?

Players always fear to be cheated on an online casino. This is understandable because it is technically very easy for an online casino to just make you lose. In the Bitcoin gambling community we have a solution for this called "provably fair". Provably fair is a tool that enables you (the player) to verify each roll result and make sure you are not being cheated!

How does provably fair work?

Although there are several implementations of the provably fair method, we will describe the most common one (Roll Dice from PrimeDice). With this method each roll-result is calculated by the following variables:

Serverseed - provided by the gambling site
Clientseed - provided by your browser and adjusted by you
Nonce - A number that increases with each bet you make
You will get an encrypted hash of the serverseed before you start gambling. Since you get it in advance, the site cannot change it later. However it is encrypted, so you cannot calculate your own roll results in advance (only afterwards if you get the unhashed serverseed.)

Your browser will generate a random clientseed. However, you could and should adjust this clientseed before you start. This way you can make sure the site does not know your clientseed in advance.

Now if you make a bet the nonce starts with 0 or 1 depending on the website. After each bet you make, the nonce number will go up by 1.

Calculating the roll result

A dice site uses 3 variables (server- & clientseed and nonce) to calculate the roll result. I will illustrate this with an example, let's say we have these values:

So this is:

Clientseed: ClientSeedForDiceSites.com

Serverseed unhashed: 293d5d2ddd365f54759283a8097ab2640cbe6f8864adc2b1b31e65c14c999f04

Serverseed hashed: 5ac59780d512265230d5efb3cc238886dc1b457a80b54fbf1f920b99c6505801

Nonce: for the first bet it is 0 on this dice site (PrimeDice)

PrimeDice first calculates a HMAC hash with these variables, like this:

hmac-sha512(server_seed, client_seed-nonce) So in our case this becomes:

hmac-sha512(293d5d2ddd365f54759283a8097ab2640cbe6f8864adc2b1b31e65c14c999f04, ClientSeedForDiceSites.com-0)

Calculated outcome:

aa671aad5e4565ebffb8dc5c185e4df1ae6d9aca2578b5c03ec9c7750f881922276d8044e5e3d84f158ce411f667e224e9b0c1ac50fc94e9c5eb883a678f6ca2

Now the first 5 characters are being used (aa671) and converted from hexadecimal to a decimal. You can do this also with an online tool like statman.info/conversions/hexadecimal.html

If this number is over 999,999 than the next 5 characters (aad5e) would be used. But in our case it's 697,969 so this will be used. Now you only have to apply a modulus of 10^4 and divide it by 100. You can do this just on Google by typing:

697969%(10000)/100
The final result is:

79.69

Use cases (Why Raiden)

  1. Raiden Network provides micro-payments as a feature which will help multiple verification with single token.

  2. The Raiden Network is an off-chain scaling solution for performing ERC20-compliant token transfers on the Ethereum blockchain.

  3. It is Ethereum's version of Bitcoin's Lightning Network, enabling near-instant, low-fee, scalable, and privacy-preserving payments.

Useful on sites:

  1. PrimeDice
  2. Stake
  3. BCGame
  4. Bitvest
  5. CryptoGames
czepluch commented 4 years ago

Hi, thanks for your applications.

Could you please provide some more information on how Raiden is needed for this use case and how it will work in this specific case to show that things are provably fair? We have a hard time understanding the relevance of Raiden in your application.

Devilla commented 4 years ago

Hi @czepluch, since we're charging some minimum amount of crypto currencies for say every 50-100 recent bets made by the player on a particular casino. We will use Raiden network for fast micro-payments to our tool. So, the transaction are lightening fast. Also, for provable fair verification we have algorithms for every casino and every game and we'll mainly use the Raiden protocol to reduce transaction fee for every small payment on the network by the player to verify bets.

czepluch commented 4 years ago

Okay, so you want to use Raiden for micro transactions between the casinos and the players?

Devilla commented 4 years ago

Well actually no, our probably fair verification tool is independent of any casino verification and we want to use Raiden network for micro transactions between the user and our tool only.

czepluch commented 4 years ago

Okay. I am not entirely sure if that makes sense. Could you explain a bit more in depth how you imagine using Raiden?