UNPKG

@derin-n/provablyfair

Version:
35 lines (18 loc) 961 B
# 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