Jump to content
Lucas Holder

fair: an Open Source CLI Bet Verifier

Featured Comment

Posted (edited)

Hey all,

I'm happy to announce fair, an open source CLI tool and library for verifying provably fair bets. It's written in Rust so it's very fast, stable and lightweight (binary is <1 MB). I wrote it as a way to learn Rust and it was surprisingly straightforward. It supports verification of all games on Stake.com.

GitHub Repository: https://github.com/lucasholder/fair
Downloads: https://github.com/lucasholder/fair/releases 

Currently implemented games:

  • Blackjack
  • Hilo
  • Baccarat
  • Diamond Poker
  • Dice Roll
  • Limbo
  • Plinko
  • Roulette Roll
  • Keno
  • Mines
  • Video Poker
  • Wheel
  • Slots
  • Crash

Example usage for Baccarat verification:

$ fair baccarat "client seed" "server seed" 1
Player won

Player (9): ♠J - ♥10 - ♥9
Banker (5): ♥5 - ♣K

Help:
 

$ fair help
fair 0.0.10
Lucas Holder <lucasholderx@gmail.com>
CLI tool and library for verifying provably fair games (baccarat, etc.).

USAGE:
    fair [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    baccarat         Baccarat game
    blackjack        Blackjack
    crash            Crash game (uses Stake.com's parameters). Does not use client/server seed and nonce arguments.
    diamond_poker    Diamond poker
    dice             Dice game
    help             Prints this message or the help of the given subcommand(s)
    hilo             Hilo game
    keno             Keno
    limbo            Limbo game
    mines            Mines game
    plinko           Plinko game
    roulette         Roulette
    slots            Slots game(s)
    video_poker      Video Poker
    wheel            Wheel game


I'm also currently working on a browser extension that will use this library (in the form of a WebAssembly module) to provide a graphical UI. Sneak peek (announcement thread: https://forum.stake.com/topic/33246-bet-verification-extension-work-in-progress/😞

demo2.thumb.gif.0d484dfa96a01093ec051785ef1f666a.gif

 

I also posted this on BitcoinTalk: https://bitcointalk.org/index.php?topic=5237222.0

Feature requests and feedback are more than welcome!

Enjoy :)

 

Edited by Lucas Holder

Share this post


Link to post
Share on other sites
Posted (edited)
7 hours ago, toohoola said:

I was curious enough to check my favorite numbers:
cmdline.thumb.png.5c1c783facff7a1d77178b6953d1977d.png

site.thumb.png.59f7a839956961e7ba3dcd7f0e232568.png


Client seed: 83e27f682128eb1852b048203dfd6931
Server seed: e8df2cc3b9ccb583ce5ea92336842387
Nonce: 1942124

I asked the support about this 6 weeks ago and they said "Seems like the issue is with [the 3rd party] verifier."

Interesting... I just tried with another verifier (https://www.provablyfair.me/casino/stake-verifier/) which gives the same output as my verifier (3940702.15). I will investigate and report what I find out. If a Stake admin could have a look at the result and confirm it's not a bug on their end it would be helpful as well.

 I ended up reverse engineering the minified JavaScript verification code for limbo. It turns out that the algorithm described at https://stake.com/provably-fair/game-events for limbo is slightly incorrect. It says the formula is:

const floatPoint = 1e8 / (float * 1e8) * houseEdge;

But it really should be:

const floatPoint = 1e8 / (Math.floor(float * 1e8) + 1) * houseEdge;

Thanks for uncovering this bug @toohoola! This should now be fixed in fair v0.0.13.

Edited by Lucas Holder

Share this post


Link to post
Share on other sites

I play gambling last 2 years but as a such I don't know about this.i not know how this thing work and how I check this is fair or not fair I not think about this. I just play game win or lose I not check my bets.

Share this post


Link to post
Share on other sites

I never stopped to check bet until today lol ...
but it is good to know a little of this through you friend ...

 

 

#CampaignStakeStayInHomePlayingAtStake#

00000.png

Share this post


Link to post
Share on other sites

nice work guys!

3 hours ago, toohoola said:

Thanks for reversing their code @Lucas Holder!

 

8 hours ago, Lucas Holder said:

Interesting... I just tried with another verifier (https://www.provablyfair.me/casino/stake-verifier/) which gives the same output as my verifier (3940702.15). I will investigate and report what I find out. If a Stake admin could have a look at the result and confirm it's not a bug on their end it would be helpful as well.

 I ended up reverse engineering the minified JavaScript verification code for limbo. It turns out that the algorithm described at https://stake.com/provably-fair/game-events for limbo is slightly incorrect. It says the formula is:


const floatPoint = 1e8 / (float * 1e8) * houseEdge;

But it really should be:


const floatPoint = 1e8 / (Math.floor(float * 1e8) + 1) * houseEdge;

Thanks for uncovering this bug @toohoola! This should now be fixed in fair v0.0.13.

 

Share this post


Link to post
Share on other sites

great work man you really did a hard work and your work show this, i hope now everyone can check their bet more easily and the browser extension would be more cool, i am waiting for that now :) i hope you will get more success in your work.

Share this post


Link to post
Share on other sites
1 hour ago, sahil777 said:

great work man you really did a hard work and your work show this, i hope now everyone can check their bet more easily and the browser extension would be more cool, i am waiting for that now :) i hope you will get more success in your work.

Thanks, it was indeed a lot of work! Browser extension (beta) is coming in a few days, stay tuned!

Share this post


Link to post
Share on other sites

with those google extensions, can  you pull data live from a game  as you play, run it through a function and return a result to the player.

Share this post


Link to post
Share on other sites
1 hour ago, Seoulmate said:

with those google extensions, can  you pull data live from a game  as you play, run it through a function and return a result to the player.

Yes indeed, the long term goal is to automate the process as much as possible. It would be nice if all bets were automatically verified without any user interaction at all but that's not implemented yet. It's very basic right now but it reads the active tab's URL to pre-populate the fields when you are on the Stake.com's bet verification page: 

preopulate.thumb.gif.f3cebdeff0304a199d97614f5e66cec8.gif

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×