Provably fair system in javascript

Alexandru Cambose
3 min readOct 12, 2019

What is and how to build a provably fair system in javascript

The global online gambling & betting market accounted for USD 45.8 billion in 2017 and is expected to reach USD 94.4 billion globally by 2024.

Imagine going to an online gambling site. You put your money in it and start playing. The first number that was generated is 82 and you may wonder: how can I make sure that the numbers that are generated aren’t altered in any way?

What is provably fair?

Provably fair is a way that enables the player to check if a generated number is truly random and hasn’t been manipulated in any way.

Each result is generated using the following parameters:

  1. client-seed — a randomly generated selection of text that you can (and should) modify. This is generated at the client/browser level.
  2. server-seed — a randomly generated selection of text (usually a 64-character hex string). This is generated server-side. You will get a hashed version of this before you start gambling, in this way you can make sure that the outcome has been pre-determined and not changed after the result was generated.
  3. nonce — a sequential bet number

Generating a random…

--

--

Alexandru Cambose

Full Stack Web Developer interested in Blockchain and AI. Currently available for freelance work. https://github.com/alexcambose https://alexcambose.com/