Skip to content

Instantly share code, notes, and snippets.

@cklosowski
Last active September 4, 2017 18:59
Show Gist options
  • Save cklosowski/c98506b2abb3d19490aba9fa52fc5c10 to your computer and use it in GitHub Desktop.
Save cklosowski/c98506b2abb3d19490aba9fa52fc5c10 to your computer and use it in GitHub Desktop.
earn.gg rollbot: http://earn.gg?ref=ember81
<?php
/**
* This is a rollbot for earn.gg written in PHP
*
* It will use the parameters below to run bets. If a bet wins it resets to the $starting value.
* If a bet loses, it doubles your bet amount and continues to do so until you win, or hit the $max_bet.
*
* Once you win, it kicks back down to the $starting bet.
*
* This code comes As-Is. The author not responsible for your gambling habits on earn.gg. Losses are your responsibility.
*
* Donations Welcome:
* https://earn.gg/donate/112485290338746605618?ref=ember81
*/
$key = '<your api key>';
$secret = '<your api secret>';
$api = 'http://earn.gg/';
$min_bal = 1000; // If your balance ever gets at or below this, betting will not start, or stop the current bet run
$starting = 25; // The amount to start betting at
$bet_amount = $starting; // The initial bet amount (this will change as the loop persists
$multiplyer = 2; // The multiplyer you want to bet against (2=49%, 3=32%, 4=24%, 5=19%, 6=15%, 7=13%, 8=11%, 9=10%)
$max_bets = 25; // Number of bets to make in this loop
// Get current balance
$response = json_decode( file_get_contents( $api . 'account/get?key=' . $key . '&secret=' . $secret ) );
$current_balance = $response->result->balance;
$total_balance = $current_balance;
$starting_balance = $current_balance;
$i = 1;
$wins = 0;
$losses = 0;
echo '--- Stating bets with ' . (string) $starting_balance . '---' . "\n";
while ( $i <= $max_bets ) {
if ( $current_balance <= $min_bal ) {
echo '--- Balance threshold crossed ---' . "\n";
exit;
}
$bet_response = json_decode( file_get_contents( $api . 'gamble/roll?amount=' . $bet_amount . '&payout=' . $multiplyer . '&key=' . $key . '&secret=' . $secret ) );
if ( $bet_response->won ) {
$wins++;
$won = $bet_amount * ( $multiplyer - 1 );
$bet_amount = $starting;
$current_balance = $current_balance + ( $won ) + $bet_amount;
echo $i . ' - Won: ' . $won . "\n";
} else {
$losses++;
$lost = $bet_amount;
$bet_amount = $bet_amount * 2;
// Never end on a loss, helps total RIP
if ( $i === $max_bets ) {
$max_bets++;
}
$current_balance = $current_balance - $lost;
echo $i . ' - Lost: ' . $lost . "\n";
}
sleep(1);
$i++;
}
echo 'Starting Balance: ' . $starting_balance . "\n";
$response = json_decode( file_get_contents( $api . 'account/get?key=' . $key . '&secret=' . $secret ) );
echo 'Ending Balance: ' . $response->result->balance . "\n";
echo 'Bet Performance: ' . (string) ( $response->result->balance - $starting_balance ) . "\n";
echo $wins . ' Wins & ' . $losses . ' Losses' . "\n";
echo 'Win Pct: ' . round( ( $wins/$i ) * 100 ) . '%' . "\n";
echo '--- Betting Closed ---' . "\n";
@Joe8000
Copy link

Joe8000 commented Sep 2, 2017

I stole ur script kek

@cklosowski
Copy link
Author

cklosowski commented Sep 2, 2017

I run this on a cron on a web server with the following:
*/1 * * * * /usr/bin/php /home/username/scripts/earn.gg.php >> /var/log/earn.gg.log

This way it runs every 1 minutes, and stores the results (appended after the previous results in a log file).

Just be sure to clear the log from time to time in order to stop it from getting toooooo large :)

@cklosowski
Copy link
Author

@NoobCoder807, you can't steal what I made public ;) isn't that the point of GitHub?! Enjoy!

👍

@cklosowski
Copy link
Author

Sample of the log output:

--- Stating bets with 31249---
1 - Lost: 10
2 - Lost: 20
3 - Won: 80
4 - Lost: 10
5 - Lost: 20
6 - Lost: 40
7 - Lost: 80
8 - Lost: 160
9 - Lost: 320
10 - Won: 1280
11 - Lost: 10
12 - Lost: 20
13 - Lost: 40
14 - Won: 160
15 - Won: 20
16 - Won: 20
17 - Won: 20
18 - Lost: 10
19 - Lost: 20
20 - Lost: 40
21 - Lost: 80
22 - Lost: 160
23 - Lost: 320
24 - Lost: 640
25 - Lost: 740
Starting Balance: 31249
Ending Balance: 30089
Bet Performance: -1160
--- Betting Closed ---

@cklosowski
Copy link
Author

Latest updates, removes the max bet (it can cause issues with doubling and making up for losses) and also makes it so this never ends on a loss. If your last bet is a loss, it simply adds one more to the max bet, so that it can try and make up for the loss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment