1.0.1 • Published 5 years ago

@derin-n/provablyfair v1.0.1

Weekly downloads
-
License
SEE LICENSE IN li...
Repository
github
Last release
5 years ago

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 callbackDatanumberOfGame

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