@derin-n/provablyfair

1.0.1 • Public • Published

provablyfair

sample provably fair algorithm for gambling

read about it here: [soon]

all hashes are SHA-512

you can use seededprovablyfair.js for generating hashes and results

there is also a sample provablyfairhost.js and provablyfairclient.js included here

client would run in the browser and host would run on the server

functions:

generateRandomSeed(callback);

generate a random hash to be used as the host hash or the first game hash for a chain of games

callback is the hash

generateChainSeeds(firstGameSeed, amountOfGames, callback);

generate a chain of game hashes

callback is a json object, you can access the hashes with callbackData[numberOfGame]['gameSeed']

also callbackData['total'] gives you the amount of games so you can loop through them easily

generateResult(hostSeed, gameSeed, callback);

generate the result of a game, combining the host seed and the game seed

callback is a double digit number

Package Sidebar

Install

npm i @derin-n/provablyfair

Weekly Downloads

0

Version

1.0.1

License

SEE LICENSE IN license.txt

Unpacked Size

9.97 kB

Total Files

7

Last publish

Collaborators

  • derin-n