Giter Site home page Giter Site logo

provably_fair's People

Contributors

sau412 avatar

Stargazers

rilian avatar  avatar  avatar Alexandria Mae avatar  avatar  avatar  avatar Startail the 'Coon avatar

Watchers

James Cloos avatar

provably_fair's Issues

Provably unfair

Consider the function:

function get_roll_result($server_seed,$user_seed) {
        $hash=hash("sha256","$server_seed.$user_seed");
        $bytes=substr($hash,0,8);
        $number=hexdec($bytes);
//return $number;
        $roll=round($number/429496.7295);
        $roll=sprintf("%05d",$roll);
        return $roll;
}

There are two issues with this code that make it unfair (ie. not uniform between [0-10000]). First is the use of round. $number/429496.7295 returns a real number between 0 and 10000 inclusive. If we assume is uniformly distributed, then a 0 or 10000 are both half as likely to be rolled than any other number. 0 is only selected if the input falls in [0,0.5), and 1000 only if [9999.5, 10000], where as a number like 1 could result from any input between [0.5, 1.5).

Secondly, $number/429496.7295 is not uniformly distributed. It only consists of values that are a multiple of 1/429496.7295, which can potentially mean an uneven amount of numbers will map to a particular interval if that interval is not also a multiple of 1/429496.7295. For instance, with the current round scheme, 429497 values for $bytes map to 1, while 429496 values map to 2.

May I suggest this alternative algorithm which fixes the above issues, but is slightly more computationally expensive and difficult to validate manually:

function get_roll_result($server_seed,$user_seed) {
    for ($i = 0;;$i++) {
        $hash=hash("sha256","$server_seed.$user_seed.$i");
        $bytes=substr($hash,0,8);
        $roll=hexdec($bytes) % 16384;
//return $roll;
        if ($roll <= 10000) {
            return $roll;
        }
    }
}

Overdrawn balance

By making multiple withdraw requests for the total wallet amount, the wallet balance can be overdrawn.

Faucet no longer functioning properly (phantom rolls)

On https://freegridco.in/#free_roll, the page persistently displays Wait for xx:xx before next roll, even if I haven't been to the page in hours. It seems the system believes rolls were made that weren't, the balance doesn't increment, and clicking "view last roll seeds" shows the last roll was made two days ago.

If I leave the page open until the roll button appears and click it, it's replaced by red error text stating Only one roll in 3600 seconds allowed. Wait xxxx seconds more..

MFA - 2FA

Can someone put MFA on the login please? This would be great to prevent being hacking into.

referal link pls

pls do add referal link.pls ..so i can invite more to your website ..thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.