Provably Fair

# There is no such thing as TRUE randomness!

##### What does Provably Fair mean?

"Provably fair" encryption is a term used to describe a cryptographic system that allows the user to verify that the encryption method used to protect their data is fair and unbiased. This means that the encryption algorithm has been designed in such a way that it is impossible for the provider to manipulate the outcome or cheat the user.

For the average person, this means that they can trust the encryption system they are using to protect their sensitive information from being accessed by unauthorized third parties. By using a provably fair encryption system, the user can be confident that the encryption method is not rigged to favor the provider or anyone else with access to the data.

Provably Fair provides an added layer of security and transparency, which is can especially be important when dealing with sensitive information such as:

financial transactions, medical records, and all types of confidential data.

##### Example Code in PHP

function provablyFair(\$clientSeed, \$serverSeed, \$nonce) {
\$hash = hash('sha512', \$clientSeed . \$serverSeed . \$nonce);
\$luckyNumber = hexdec(substr(\$hash, 0, 8)) % 100; // get first 8 hex characters and convert to a number between 0-99
return \$luckyNumber;
}

\$clientSeed = "my_client_seed";
\$serverSeed = "my_server_seed";
\$nonce = 0;

\$luckyNumber = provablyFair(\$clientSeed, \$serverSeed, \$nonce);

echo "Your lucky number is: " . \$luckyNumber;

This algorithm takes in three parameters: the client seed, the server seed, and a nonce (a number used only once to ensure uniqueness). It then concatenates the three values and hashes them using the SHA-512 algorithm. The first eight hex characters of the resulting hash are extracted and converted to a number between 0-99 using the modulus operator (%). This lucky number is then returned.

##### History

The terminology Provably Fair was made popular during the creation of Blockchain technology, specifically Bitcoin which provided the mechanism.
For the gamer it meant a revolution in such never-before-imagined things such as:

+ fair playing

+ accountability (public ledger)

+ anti-cheating

Crypto Gambling sites allow the public to see how outcomes are, based on the gambler's (a) input and a (b) secret number that is disclosed before playing

This ensures the athenication to online gamblers to verify say the dice roll or card game.

There were many early adopters, such as BitLotto which was one of the first blockchain based provably fair game. It used the transaction ID as the "ticket".

The website blockchain.info created SatoshiDICE which was a traditional dice rolling game. It was a huge part of the early transactions on the then new Bitcoin chain. Blockchain.info integrated this feature prominently, but it was later geo-fenced to US customers. It became a blockbuster blockchain method for online gambling. It used the transaction ID to determine the "lucky number" (between 0 and 65,535). The secret used for determining that lucky number was revealed after the end of the day.

##### On Randomness and Encryption

There is no such thing as TRUE randomness!!!

When provided with enough data, patterns arise in seeming random events, especially in nature.

]