Bitcoin Forum

Economy => Gambling => Topic started by: SRoulette on February 10, 2013, 01:47:26 PM



Title: Satoshi Roulette Martingale Bot - update 2
Post by: SRoulette on February 10, 2013, 01:47:26 PM
Presenting Codemonkeys php martingale bot:

A working bot and a good demonstration of our JSON API.

it supports blockchain.info, bitcoind, litecoind, ppcoind and terracoind :)
you do need to download the file: jsonRPCClient.php and place it in the same directory as this script for JSON calls to work.
Simply edit the settings in the section marked user defined settings and then run.

I am currently using it myself to test the new terracoin.

Install:

Linux

install php.
create bot.php in your home directory.
Code:
# cd
# php ./bot.php

Windows

Download and install the latest PHP windows installer:
http://windows.php.net/downloads/releases/php-5.3.21-nts-Win32-VC9-x86.msi

Install and follow the prompts, note optional web server component is not required.

create the file bot.api in c:\ (or a directory of your chosing).
open command prompt.
Code:
# cd \
# PHP bot.api


Configure:

You must have the following in your bitcoin.conf, set your own password and username.

Code:
server=1
rpcpassword=password
rpcuser=user

then edit bot.php and adjust this section to match:

Code:
# -----------------------------------------------------------------------------
# Begin user defined settings
# -----------------------------------------------------------------------------

# SNIP All user settings go here :) see main code block below.

# -----------------------------------------------------------------------------



Bot:

Code:
<?php
# *****************************************************************************
# Satoshi Roulette Bot
# *****************************************************************************
#
# references:
# https://bitcointalk.org/index.php?topic=137519.msg1512149#msg1512149
# http://blockchain.info/api/blockchain_wallet_api

include './jsonRPCClient.php';

global 
$address;
global 
$address_old;
global 
$bet;
global 
$min;
global 
$max;
global 
$max_old;
global 
$jackpot;
global 
$sleep;
global 
$user;
global 
$password;
global 
$coind;
global 
$blockchain;
global 
$turbo;

# -----------------------------------------------------------------------------
# Begin user defined settings
# -----------------------------------------------------------------------------

$turbo 0; # enable turbo mode, for fast result checking using the latest recieved bitcoind txid.

# list of games to bet against.

$games = array("roulette-red""roulette-black""roulette-odd""roulette-even""jdice-052""coinflip-heads""coinflip-tails""roulette-1to18""roulette-19to36");

# exit settings
$percent_win = 100; # what % wallet increase to stop at
$percent_lose = 50; # what % wallet decrease to stop at

# bot settings
$mode 'TRC'; # mode: BTC/ LTC/ PPC
$blockchain 0; # 1 for using blockchain.info wallets, set mode to BTC
$min 0.025; # if lower than the games min, the games min is used
$max 100; # if higher than the games max, the games max is used
$goto_max 1; # if the next bet greater than the games max bet, bet max. Used for collecting jackpots.

# bitcoind/ litecoind/ trcoind rpc connection settings
$ip '127.0.0.1'; # coind ip
$user 'user'; # coind rpc user
$password 'password'; # coind rpc password
$port 8866; # coind rpc port

# misc settings
$x 2; # when a bet loses, the next bet = $bet * $x;
$sleep 10; # sleep time: 10 seconds is optimal, 5 or lower for turbo.

# -----------------------------------------------------------------------------
# End user defined settings
# -----------------------------------------------------------------------------

$bet 0;
$json_coind_url = "http://$user:$password@$ip:$port/";
$game_name $games[0]; # start with first game in array
$balance 0;
$jackpot 0;
$address_old = '';
$gweedo 1;
$json_coind_url = "http://$user:$password@$ip:$port/";
$address '';

# *****************************************************************************
# Start
# *****************************************************************************

if(!$blockchain# connect to coind via rpc if not using blockchain.info api
{
$coind = new jsonRPCClient($json_coind_url);
}

$start_balance = $balance sprintf("%.4f"check_balance());
$win_balance = sprintf("%.4f"$start_balance * ((100+$percent_win) / 100));
$lose_balance = sprintf("%.4f"$start_balance * ((100-$percent_lose) / 100));

check_last();

echo 
"===============================================================================
Satoshi Roulette - Martingale Bot - Mode 
$mode
===============================================================================

Target Balance:
$win_balance $mode
Start Balance :
$start_balance $mode
Stop Balance  :
$lose_balance $mode
"
;

if(
$turbo == 1)
{
echo 
"\nTURBO MODE\n";
}

echo 
"
-----------------------------------------------------------------------------

"
;

# load game info
$rand_keys array_rand($games2); $game_name $games[$rand_keys[0]]; 
$s load_game($mode$game_name);
if(!
$bet) { $bet $min; }

while(
1)
{
# send bet
$bet_txid send_bet($bet$address);
echo date("H:i:s: "time())  . "Balance: " sprintf("%.4f"$balance) . $mode, txid: $bet_txid, bet: " sprintf("%.4f"$bet) . $mode on $game_name ";

# wait for result
$result  = get_result($mode$bet_txid$game_name);

# pre select next game
$rand_keys array_rand($games2); $game_name $games[$rand_keys[0]]; $s load_game($mode$game_name);

# check win / lose
if($result) # WIN
{
#echo $win_string;
echo " WIN\n";
$bet $min;
}
else # LOSE
{
echo " LOSE\n";
$bet sprintf("%.8f"$bet $x);
if($bet $max)
{
echo "[Hit Wall - Reseting]\n";
$bet $min;
}
else if($goto_max && $bet $x $max)
{
$bet $max;
}
}

# -----------------------------------------------------------------------------
# check exit :3
# -----------------------------------------------------------------------------

$balance check_balance();

if($balance $start_balance * (100-$percent_lose) / 100) # loss exit
{
echo "Exiting, Balance $balance is $percent_lose % lower than start balance $start_balance\n";
exit;
}
if($balance $start_balance * (100+$percent_win) / 100  # profit exit
{
echo "Exiting, Balance $balance is $percent_win % higher than start balance $start_balance\n";
exit;
}
}
exit;

# *****************************************************************************
# done
# *****************************************************************************

# -----------------------------------------------------------------------------
# Load Game

function load_game($mode$game_name)
{
$GLOBALS['jackpot'] = 0;

while(1)
{
$tmp file_get_contents("http://satoshiroulette.com/api.php?game=$game_name&mode=$mode");
$game json_decode($tmp);

if( isset($game->{'address'}) )
{
break;
}
else
{
print "JSON Reply:\n$tmp\n";
sleep(10);
}

}
$GLOBALS['address']$game->{'address'} ;

if(isset($game->{'jackpot'}))
{
$GLOBALS['jackpot'] = sprintf("%.8f"$game->{'jackpot'});
}
if($GLOBALS['min'] < $game->{'min_bet'} || !$GLOBALS['min'])
{
$GLOBALS['min'] = $game->{'min_bet'} ;
}
if($GLOBALS['min'] > $game->{'max_bet'})
{
$GLOBALS['min'] = $game->{'min_bet'} ;
}
if($GLOBALS['max'] > $game->{'max_bet'} || !$GLOBALS['max'])
{
$GLOBALS['max'] = $game->{'max_bet'};
}
}

# -----------------------------------------------------------------------------
# Get Balance

function check_balance()
{
if($GLOBALS['blockchain'])
{
$jsonurl "https://blockchain.info/merchant/".$GLOBALS['user']."/balance?password=".$GLOBALS['password'];
$json file_get_contents($jsonurl,0,null,null);
$json json_decode($json);
return $json->{'balance'} / 100000000;
}
return $GLOBALS['coind']->getbalance('*'0);
}

# -----------------------------------------------------------------------------
# wait for bet result

function get_result($mode$bet_txid$game_name)
{
$jsonurl "http://satoshiroulette.com/log.api.php?txid=$bet_txid&mode=$mode";
$c 0;

while(! isset($r->{$game_name}))
{
$c++;

# sleep straight away as its unlikely we bitcoin travels the speed of light
sleep($GLOBALS['sleep']);

# check local wallet for latest tx
$w check_last();
if($w == 'WIN')
{
return 1;
}
else if ($w == 'LOSE')
{
return 0;
}

# check satoshiroulette.com API for win / lose
$r json_decode(file_get_contents($jsonurl));
if(isset($r->{$game_name}))
{
return $r->{$game_name};
}
if($c == 6)
{
$c 0;
print "|";
}
else
{
print "-";
}
}
}

# -----------------------------------------------------------------------------
# Bet

function send_bet($bet$address)
{
if($GLOBALS['blockchain'])
{
$b $bet 100000000;
$jsonurl "https://blockchain.info/merchant/".$GLOBALS['user']."/payment?password=".$GLOBALS['password']."&to=$address&amount=$b";
$bet_tx json_decode(file_get_contents($jsonurl,0,null,null));
return $bet_tx->{'tx_hash'};
}
return $GLOBALS['coind']->sendtoaddress($address, (float) $bet );
}

function 
check_last()
{
if($GLOBALS['blockchain'] || !$GLOBALS['turbo'])
{
return 'NULL';
}
$r $GLOBALS['coind']->listtransactions();
$l count($r) - 1;
$cat $r[$l]['category'];
$txid $r[$l]['txid'];
$amount $r[$l]['amount'];

if($cat == 'receive')
{
if($amount $GLOBALS['bet'])
{
return 'LOSE';
}
else
{
return 'WIN';
}
}
return 'NULL';
}

?>


Title: Re: Satoshi Roulette Martingale Bot
Post by: dooglus on February 10, 2013, 08:29:17 PM
Simply edit the settings in the section marked user defined settings and then run.

I think you need to edit this line too:

Quote
$address      = '';

Maybe it should be in the user defined settings section.


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 11, 2013, 01:18:09 AM
Simply edit the settings in the section marked user defined settings and then run.

I think you need to edit this line too:

Quote
$address      = '';

Maybe it should be in the user defined settings section.

no you do not :), the game address is loaded from our JSON api :D
eg: http://satoshiroulette.com/api.php?game=jdice-050

As are the min and maximum bets etc :)


Title: Re: Satoshi Roulette Martingale Bot
Post by: dooglus on February 11, 2013, 03:08:00 AM
no you do not :), the game address is loaded from our JSON api :D
eg: http://satoshiroulette.com/api.php?game=jdice-050

As are the min and maximum bets etc :)

I see.  Sorry, I misunderstood.


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 11, 2013, 03:37:04 AM
no you do not :), the game address is loaded from our JSON api :D
eg: http://satoshiroulette.com/api.php?game=jdice-050

As are the min and maximum bets etc :)

I see.  Sorry, I misunderstood.

No problem at all, as one of the more prominent scripters in this area we are flattered to have you look over the bot and welcome any feedback you can offer.


Title: Re: Satoshi Roulette Martingale Bot
Post by: payb.tc on February 11, 2013, 03:43:33 AM
how does one get out of this loop?

Code:
while(1)
{
...
}

perhaps some expansion on that while condition would be a good idea


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 11, 2013, 03:51:52 AM
how does one get out of this loop?

Code:
while(1)
{
...
}

perhaps some expansion on that while condition would be a good idea


Good question and here is your answer:
CTRL+C
We will be releasing an updated bot shortly that will exit the main loop on user set conditions such as:

* Hit Target Profit
* Hit min balance.
* Jackpot Collected.

But as the current bot is fully functional, we felt releasing in its current state is fine as users can begin modifying it to suite their needs.
The bot also serves a secondary purpose of demonstrating our JSON API, eg finding address, min and max bets for specified game.


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 12, 2013, 06:11:34 AM
https://github.com/satoshiroulette/bot

in case others would like to contribute to the bot :)


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 12, 2013, 06:48:02 PM
how does one get out of this loop?

Code:
while(1)
{
...
}

perhaps some expansion on that while condition would be a good idea


Good question and here is your answer:
CTRL+C
We will be releasing an updated bot shortly that will exit the main loop on user set conditions such as:

* Hit Target Profit
* Hit min balance.
* Jackpot Collected.

But as the current bot is fully functional, we felt releasing in its current state is fine as users can begin modifying it to suite their needs.
The bot also serves a secondary purpose of demonstrating our JSON API, eg finding address, min and max bets for specified game.


You do know you have no breaks, and one exit() that is after the while loop, so this would be an infinite loop

Sorry I thought I made it clear before this is a demonstration bot, it is fully functional but requires manual interruption.
As already said, an updated version is in the works with more features such as the ones you mentioned.

We had some issues with the newly added coin TRC which has now been resolved, this has unfortunately delayed work on the bot :(
But do not worry there will be an updated release on git soon, unless someone else forks it first :)


Title: Re: Satoshi Roulette Martingale Bot
Post by: maomao on February 12, 2013, 07:06:39 PM

 get this warning in my error logs and wanted to know how to correct this issues in my code.

Warning: PHP Notice: Undefined property: stdClass::$balance in script.php on line 33


$balance = $json->{'balance'} / 100000000; // line 33



Title: Re: Satoshi Roulette Martingale Bot
Post by: dooglus on February 12, 2013, 07:54:08 PM
There a difference between features and correct programming, I made that clear sorry

It's not incorrect to write an infinite loop.

The exit; after the infinite loop will never be reached, but that doesn't matter.

The script as it stands will play forever, or until you lose all your coins, or until you interrupt it with a control-C - whichever comes first.


Title: Re: Satoshi Roulette Martingale Bot
Post by: dooglus on February 12, 2013, 09:01:58 PM
when all has to do is add to the very top of the file...
Code:
#!/bin/php

but:

Code:
$ ls -l /bin/php
ls: cannot access /bin/php: No such file or directory

Better to use:

Code:
#!/usr/bin/env php

so it'll work wherever php is in your path.


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 03:40:24 AM
There a difference between features and correct programming, I made that clear sorry

Oh so this is you poorly attempting to be clever ?, cute :3


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 03:59:14 AM
There a difference between features and correct programming, I made that clear sorry

It's not incorrect to write an infinite loop.

The exit; after the infinite loop will never be reached, but that doesn't matter.

The script as it stands will play forever, or until you lose all your coins, or until you interrupt it with a control-C - whichever comes first.

Correct, thank you Dooglus.

No that is a feature that the program never ends. Also with the way it sits you have to do
Code:
php bot.php

when all has to do is add to the very top of the file...
Code:
#!/bin/php
then we can just do chmod +x on that file to make it run as a command line application.

But I guess they don't teach that anymore :(

Honestly if this how they program, then I would be really scared to use there casino site, it must be full of holes and bad coding, that could be exploited to gain access to the bitcoind no one hacks for anything else LMAO

Several points:

1) This was coded in windows as the bulk of our clients are win32 users.
2) PHP is not our language of choice, we chose PHP as several other martingale bots already exists in this language.
3) chmod a+x assumes linux only users, as stated this is not the case. the best cover all execution method is
Code:
# php <your script here>
but I guess they dont teach you about supporting multiple environments anymore.

4) "that could be exploited to gain access to the bitcoind no one hacks for anything else LMAO"
LMAO indeed, what a far far reaching completely unfounded conclusions you jump to.
This statement over reaches so badly I wont waste time addressing it further.

You are ignoring points already made and discussed and using them to attack our casino, why ?


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 04:04:07 AM
There a difference between features and correct programming, I made that clear sorry

Oh so this is you poorly attempting to be clever ?, cute :3

LOL not being clever, just telling you that your programmer has no idea what he is doing...


step up then, show everyone how it is done correctly and I may even hire you.

Those that can, do.
Those that cant, teach,
those that tried and failed criticize others attempts.


Title: Re: Satoshi Roulette Martingale Bot
Post by: dooglus on February 13, 2013, 04:10:45 AM
those that tried and failed criticize others attempts.

others'

;)


Title: Re: Satoshi Roulette Martingale Bot
Post by: deadweasel on February 13, 2013, 04:19:43 AM
those that tried and failed criticize others attempts.

others'

;)

I missed that, he must be talking about Erik... WAIT Erik has the most successful bitcoin gambling site and his site is just the copy of that in different alt coins....
'

burn.


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 05:36:37 AM
Several points:

1) This was coded in windows as the bulk of our clients are win32 users.
2) PHP is not our language of choice, we chose to use PHP for the martingale bot as that is why the others we have seen have also been written in.
3) chmod a+x assumes linux only users, as stated this is not the case. the best cover all execution method is
Code:
# php <your script here>
but I guess they dont teach you about supporting multiple environments anymore.

4) "that could be exploited to gain access to the bitcoind no one hacks for anything else LMAO"
LMAO indeed, what a far far reaching completely unfounded conclusions you jump to.
This statement over reaches so badly I wont waste time addressing it further.

You are ignoring points already made and discussed and using them to attack the casino, why ?

For our more level headed users, an update will be released shortly that adds an exit condition for the main while loop so users do not need to manually interrupt the program.

1) ok so windows users usually don;t have php installed anyway, so that fail on you, should have chosen java cause that supports all environments.

2) I seen more in java then php so not a good idea, but if everyone was jumping off bridge would you follow them. Bad research.

3) Actually not true at all, but ok. Still they would have to install cywin, and php to get this working, both aren't easy to use on windows.

4) You proved my point better get that security audit going...

1) install php win32, Im amazed you got stuck figuring that out.

2) Great, you go about using Java and we will continue to use php for the bot.

3) you really do over reach. no one is going to advise running a php command line script under cygwin so your silly little chmod a+x works, again you really rearch to make any of your points.

4) Still waiting for you to demonstrate this mighty security exploit your talking about...... I reported to codemokey how you claim a non exiting while loop == massive security hole, he said he will type up a reply when he stops convulsing from laughter.


Now enough of your childish trolling and ignorant attacks against our casino, this thread is for discussing our bot.


Title: Re: Satoshi Roulette Martingale Bot
Post by: 🏰 TradeFortress 🏰 on February 13, 2013, 05:41:57 AM
who is codemonkey?


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 05:50:17 AM
1) install php win32, Im amazed you got stuck figuring that out.

2) Great, you go about using Java and we will continue to use php for the bot.

3) you really do over reach. no one is going to advise running a php command line script under cygwin so your silly little chmod a+x works, again you really rearch to make any of your points.

4) Still waiting for you to demonstrate this mighty security exploit your talking about...... I reported to codemokey how you claim a non exiting while loop == massive security hole, he said he will type up a reply when he stops convulsing from laughter.


Now enough of your childish trolling and ignorant attacks against our casino, this thread is for discussing our bot.

1) LOL yea you can do that then you need to setup an apache server, so you can actually access the php function. DO SOME RESEARCH

2) Ok but you still don't get that your focus of supporting all platforms, is flawed with php... and since java is pretty much installed default on windows machines, it be better.

3) Then you would need to setup a server for no reason, and your browser would probably timeout since the php would not end...

4) No bad programming shown in this bot thing probably shows that there is security leak in your casino.

Also how is it copying a Erik's site and failing?

You claim to have knowledge of PHP coding and yet your ignorant of the face you can run php stand alone ?
You must severely exaggerate your abilities on php if your ignorant of that fact.


Title: Re: Satoshi Roulette Martingale Bot
Post by: payb.tc on February 13, 2013, 05:51:18 AM
who is codemonkey?

you mean who is the code monkey?

http://en.wikipedia.org/wiki/Code_monkey


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 05:51:42 AM
who is codemonkey?

Our coder :) he does not come on forums, but does lurk on our sites chat window.
I do the Support, PR work, game design and help with web design while he works on the front end/s and back end.

Its a small team, but we have fun :)


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 05:53:58 AM
who is codemonkey?

you mean who is the code monkey?

http://en.wikipedia.org/wiki/Code_monkey

It is his nick and title ;)

He loves this clip and the anime its from: http://www.youtube.com/watch?v=5W_wd9Qf0IE


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 06:00:56 AM
1) install php win32, Im amazed you got stuck figuring that out.

2) Great, you go about using Java and we will continue to use php for the bot.

3) you really do over reach. no one is going to advise running a php command line script under cygwin so your silly little chmod a+x works, again you really rearch to make any of your points.

4) Still waiting for you to demonstrate this mighty security exploit your talking about...... I reported to codemokey how you claim a non exiting while loop == massive security hole, he said he will type up a reply when he stops convulsing from laughter.


Now enough of your childish trolling and ignorant attacks against our casino, this thread is for discussing our bot.

1) LOL yea you can do that then you need to setup an apache server, so you can actually access the php function. DO SOME RESEARCH

2) Ok but you still don't get that your focus of supporting all platforms, is flawed with php... and since java is pretty much installed default on windows machines, it be better.

3) Then you would need to setup a server for no reason, and your browser would probably timeout since the php would not end...

4) No bad programming shown in this bot thing probably shows that there is security leak in your casino.

Also how is it copying a Erik's site and failing?

You claim to have knowledge of PHP coding and yet your ignorant of the face you can run php stand alone ?
You must severely exaggerate your abilities on php if your ignorant of that fact.

LMAO cause I don't use windows everyday of my life, but I just googled it, and it is very hard to get it work in the cmd prompt so maybe you need to do research and this is from the php.net site, which is the php developer's home page.

Still you keep dodging the bullet, what is it like copying Erik's site and trying to ride his coat tails cause you can't think of an original idea?

Please stop lying, I know you just embarrased yourself but dont dig yourself in any further.

It is literally:
* download a 40mb msi
* click yes ~3 times
* click no to apache
* from any cmd.exe window you can type
Code:
PHP yourscript.php

if thats hard for you, then I suggest you stop advertising yourself a programmer.



In your own misused words.

DO SOME RESEARCH


Title: Re: Satoshi Roulette Martingale Bot
Post by: 🏰 TradeFortress 🏰 on February 13, 2013, 06:18:52 AM
@gweedo:

did you actually read what you linked?

' Getting PHP to run from the command line can be performed without making any changes to Windows. '

'C:\PHP5\php.exe -f "C:\PHP Scripts\script.php" -- -arg1 -arg2 -arg3"

Close page.


Title: Re: Satoshi Roulette Martingale Bot
Post by: 🏰 TradeFortress 🏰 on February 13, 2013, 06:23:08 AM
@gweedo:

did you actually read what you linked?

' Getting PHP to run from the command line can be performed without making any changes to Windows. '

'C:\PHP5\php.exe -f "C:\PHP Scripts\script.php" -- -arg1 -arg2 -arg3"

Close page.

and how many noobies are going to figure it out?

0-1 if they are lucky

and people aren't going to type that everytime

Hmm, how many noobies will figure out..

'C:\PHP5\php.exe -f "C:\Users\someuser\Desktop\marginale.php"' ...



Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 06:27:04 AM
@gweedo:

did you actually read what you linked?

' Getting PHP to run from the command line can be performed without making any changes to Windows. '

'C:\PHP5\php.exe -f "C:\PHP Scripts\script.php" -- -arg1 -arg2 -arg3"

Close page.

and how many noobies are going to figure it out?

0-1 if they are lucky

and people aren't going to type that everytime

Hmm, how many noobies will figure out..

'C:\PHP5\php.exe -f "C:\Users\someuser\Desktop\marginale.php"' ...



actually its even easier than that, php for windows automatically adds php to your path :)

Code:
C:\sr-bot>php bot.php

we could include a .bat file, not a bad idea from gweebo :)


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 07:47:07 AM
CodeMonkey has been busy tweaking the bot, Im testing a new version now, its looking quite nice :)
here is a sample output, note I use TRC for testing due but as noted it works with BTC just the same.

Code:
C:\sr-bot>php bot.php
Game: roulette-red
Address: 1kdd9wNjoYPshiDvzcVXMC7T5rPUWCb3B
Min Bet: 2
Max Bet: 36
Jackpot: 4.15595572

Start Balance: 111.52045118  TRC
Target Balance: 122.672496298 TRC
Stop Balance: 105.944428621 TRC

Balance: 111.52045118 TRC, roulette-red amount: 2 TRC, txid = cf5403fbc818856f6cf8151c19741f11fda601ef93675c95817453710ca26a27
..
 __       __        ______        __    __
|  \  _  |  \      |      \      |  \  |  \
| $$ / \ | $$       \$$$$$$      | $$\ | $$
| $$/  $\| $$        | $$        | $$$\| $$
| $$  $$$\ $$        | $$        | $$$$\ $$
| $$ $$\$$\$$        | $$        | $$\$$ $$
| $$$$  \$$$$       _| $$_       | $$ \$$$$
| $$$    \$$$      |   $$ \      | $$  \$$$
 \$$      \$$       \$$$$$$       \$$   \$$

 Game: roulette-red
Address: 1kdd9wNjoYPshiDvzcVXMC7T5rPUWCb3B
Min Bet: 2
Max Bet: 36
Jackpot: 4.15595572

Balance: 113.51445136 TRC, roulette-red amount: 2 TRC, txid = fd242c0873e693b36d0297bdd5752f78adb5d2f6062362c749b0a71b0a4f9d8c
..
 __       __        ______        __    __
|  \  _  |  \      |      \      |  \  |  \
| $$ / \ | $$       \$$$$$$      | $$\ | $$
| $$/  $\| $$        | $$        | $$$\| $$
| $$  $$$\ $$        | $$        | $$$$\ $$
| $$ $$\$$\$$        | $$        | $$\$$ $$
| $$$$  \$$$$       _| $$_       | $$ \$$$$
| $$$    \$$$      |   $$ \      | $$  \$$$
 \$$      \$$       \$$$$$$       \$$   \$$

 Game: roulette-red
Address: 1kdd9wNjoYPshiDvzcVXMC7T5rPUWCb3B
Min Bet: 2
Max Bet: 36
Jackpot: 4.15595572

Balance: 115.50845159 TRC, roulette-red amount: 2 TRC, txid = 1e3a5284e6c4080ad314073b4c7dbcb98bb8e0189d3995a13f57177f82f35640
..
lost, increasing bet size and rebetting
Balance: 113.50745167 TRC, roulette-odd amount: 4.2 TRC, txid = 13ac10c7e8c726f3d09fa5556a145382219f5cfc2be7393b3aba2cc21a6127f9
..
 __       __        ______        __    __
|  \  _  |  \      |      \      |  \  |  \
| $$ / \ | $$       \$$$$$$      | $$\ | $$
| $$/  $\| $$        | $$        | $$$\| $$
| $$  $$$\ $$        | $$        | $$$$\ $$
| $$ $$\$$\$$        | $$        | $$\$$ $$
| $$$$  \$$$$       _| $$_       | $$ \$$$$
| $$$    \$$$      |   $$ \      | $$  \$$$
 \$$      \$$       \$$$$$$       \$$   \$$

 Exiting, Balance 117.70145184 is 5 % higher than start balance 111.52045118

C:\sr-bot>

First test run worked great :) , will upload shortly after a few more tests.


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 13, 2013, 08:35:58 AM
He doesn't even know how to clear out the cmd prompt so you get live updates but not just states of the bot so sad... Bad programming...
Im unsure what you are referring to, it has live updates. You are welcome to demonstrate your talents by improving upon this bot, that is assuming you have worked out how to run a php script from the command prompt by now :3

So you keep dodging my question how is to be a talentless, non-original, rip off of satoshidice?

Our main game the roulette table is a unique variation on traditional roulette, a concept we created pioneered :). Perhaps you are unable to tell apples from oranges ?
Building on fireducks verifiable results using the blockchain concept was and is an awesome experience, we encourage all *coin casinos to use a similar method to produce user verifiable results. We make no attempts to hide our references and have often cited fireducks original work as our inspiration.

Fortunately we measure our success by own standards and also to be honest profitability, both which are measuring up quite nicely and also the experienced gained has been invaluable.

Sorry for not answering sooner, I assumed it was you ranting rhetorical questions as you seem quite upset for some reason.
If you still need any help running a php script as a cmd prompt script and not a cgi script please let me know, we will be providing updated usage instructions so others are not confused as you were.


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: SRoulette on February 13, 2013, 09:26:08 AM
I have just posted the updated version, see 1st post for details.
added install and configure instructions as well.


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: 🏰 TradeFortress 🏰 on February 13, 2013, 11:29:32 AM
Great! I suggest cutting down on the clutter - remove min bet, max bet, address, etc. Just show the balance after round()ing it to a few decimal places, and WIN or lost :)


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: SRoulette on February 13, 2013, 12:08:03 PM
Great! I suggest cutting down on the clutter - remove min bet, max bet, address, etc. Just show the balance after round()ing it to a few decimal places, and WIN or lost :)

Agreed :)

Codemonkeys scripts are always very verbose, I'll hack at it myself and see if I cant clean it up.


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: SRoulette on February 13, 2013, 02:10:43 PM
this is definitely much nicer output:

Code:
C:\sr-bot>php bot.php
===============================================================================
Satoshi Roulette - Martingale Bot - Mode TRC
===============================================================================

Target Balance: 98.7638 TRC
Start Balance : 74.2585 TRC
Stop Balance  : 37.1292 TRC

-----------------------------------------------------------------------------

Balance: 74.2585 TRC, txid: 02d4548581eb32ac5784abf52edd899e46f7ef4dbbd90e964b6ab3459786e024, bet: 2 TRC on roulette-black - LOSE
Balance: 72.2575 TRC, txid: f3eace9ff35a4708fbd35a5194ae1d62a86ea39bf32062fe831e8d7fdf57a6da, bet: 4.2 TRC on roulette-black - LOSE
Balance: 68.0565 TRC, txid: 6c069ff2a7674f21b870cb423eef515c16798d9032bf0640b8500cd278130584, bet: 8.82 TRC on roulette-red - LOSE
Balance: 59.2355 TRC, txid: c4dc6e8e070de9a84d349cfc46859eb0d95ea1090a39c9158191a3aeb9174186, bet: 36 TRC on roulette-red - WIN
Balance: 95.2345 TRC, txid: 9f74f54c1e39f90580bae76a6d9bf1f4194b714611b9339b586a99af6a8fa3df, bet: 2 TRC on roulette-red - LOSE
Balance: 93.2335 TRC, txid: 6859411a831822eb3b454f878f25617b710faf89e39bbc3a957766b36a1f5fa0, bet: 4.2 TRC on roulette-red - LOSE
Balance: 89.0325 TRC, txid: da57fe1d92f9e2b474a28abfc132c7b86dac837347de76e33472d8f19320490d, bet: 8.82 TRC on roulette-red - WIN
Balance: 97.8465 TRC, txid: bbd47a612de8b9340d5c6db189ead5a180c7830432860f18aac25768e111765e, bet: 2 TRC on roulette-red - WIN
Exiting, Balance 99.84046549 is 33 % higher than start balance 74.2585

C:\sr-bot>


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: armodar on February 14, 2013, 11:43:38 AM
Hey guys,

at the request of SRoulette im writing here my situation

OS: win 7 x64 Pro

1. I downloaded and installed the PHP from the link on the first page disabling web components or what it said in the first post
2. Downloaded jsonrpcclient.php from jsonrpcphp.org - extracted the lite version and took the jsonrpcclient.php from where it was and i placed it in the C:\ directory
3. Created a text file in which I pasted the bot code on the first page called bot.txt in C:\
4. Closed my terracoin client, added my settings in a terracoin.conf file
5. cmd.exe > ran Z:\Terracoin> terracoin-qt.exe -server -datadir=Z:\Terracoin - terracoin started just fine, no errors
6. changed the settings in bot.txt to match user, pw, port fron terracoin conf and saved it as bot.api and bot.php (same file, different extensions) also in C:\
7. cmd.exe > ran cd \
8. cmd.exe > PHP bot.api - enter -> output C:\> (it thinks for a sec or two)
9. then tried cmd.exe> PHP bot.php - same output...

also noteworthy to say is that i do have xampp installed on my pc, but i disabled all services, including apache.

Any ideas?

Thanks,
armodar

EDIT: all done, my mistake, copied the thing poorly and in cmd.exe you dont get errors


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: 🏰 TradeFortress 🏰 on February 14, 2013, 11:49:09 AM
wtf?

you need apache

you need it to be a .php file, not .txt


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: armodar on February 14, 2013, 12:16:29 PM
check step 6, i changed it to php and api....

and i dont see in the instructions where you need apache...

EDIT: all done, my mistake, copied the thing poorly and in cmd.exe you dont get errors


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: dooglus on February 14, 2013, 08:08:01 PM
you need apache

It's a standalone PHP script.  You run in on the command line.  Not in apache.


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: SRoulette on February 15, 2013, 12:10:27 AM
quickly bumping with the WIP script:

Code:
<?php
# *****************************************************************************
# Satoshi Roulette Bot
# *****************************************************************************
#
# references:
# https://bitcointalk.org/index.php?topic=137519.msg1512149#msg1512149
# http://blockchain.info/api/blockchain_wallet_api
# http://patorjk.com/software/taag/#p=display&f=Big%20Money-se&t=W%20I%20N

include './jsonRPCClient.php';

global 
$address;
global 
$address_old;
global 
$min;
global 
$max;
global 
$max_old;
global 
$jackpot;
global 
$sleep;
global 
$sleep_max;
global 
$user;
global 
$password;
global 
$coind;

# -----------------------------------------------------------------------------
# Begin user defined settings
# -----------------------------------------------------------------------------

# list of games to bet against.
$games = array("roulette-red""roulette-black""roulette-odd""roulette-even");

# exit settings
$percent_win = 10; # what % wallet increase to stop at
$percent_lose = 33; # what % wallet decrease to stop at

# bot settings
$mode 'TRC'; # mode: BTC/ LTC/ PPC
$blockchain 0; # 1 for using blockchain.info wallets, set mode to BTC
$min 2; # if lower than the games min, the games min is used
$max 0; # if higher than the games max, the games max is used
$goto_max 1; # if the next bet greater than the games max bet, bet max. Used for collecting jackpots.

# bitcoind/ litecoind/ trcoind rpc connection settings
$ip '127.0.0.1'; # coind ip
$user 'user'; # coind rpc user
$password 'password'; # coind rpc password
$port 8866; # coind rpc port

# misc settings
$x 2.1; # when a bet loses, the next bet = $bet * $x;
$sleep 20; # sleep time: 20 seconds seems optimal
$sleep_max 60; # max random sleep time, set to the same as $sleep to disable random sleep

# -----------------------------------------------------------------------------
# End user defined settings
# -----------------------------------------------------------------------------

$bet 0;
$json_coind_url = "http://$user:$password@$ip:$port/";
$game_name $games[0]; # start with first game in array
$blockchain 0;
$balance 0;
$jackpot 0;
$address_old = '';
$gweedo 1;
$json_coind_url = "http://$user:$password@$ip:$port/";
$address '';

# *****************************************************************************
# Start
# *****************************************************************************

if(!$blockchain# connect to coind via rpc if not using blockchain.info api
{
$coind = new jsonRPCClient($json_coind_url);
}

$start_balance = $balance sprintf("%.4f"check_balance());
$win_balance = sprintf("%.4f"$start_balance * ((100+$percent_win) / 100));
$lose_balance = sprintf("%.4f"$start_balance * ((100-$percent_lose) / 100));

echo 
"===============================================================================
Satoshi Roulette - Martingale Bot - Mode 
$mode
===============================================================================

Target Balance:
$win_balance $mode
Start Balance :
$start_balance $mode
Stop Balance  :
$lose_balance $mode

-----------------------------------------------------------------------------

"
;

# load game info
$rand_keys array_rand($games2); $game_name $games[$rand_keys[0]]; 
$s load_game($mode$game_name);
if(!
$bet) { $bet $min; }

while(
1)
{
# send bet
$bet_txid send_bet($bet$address);
echo "Balance: " sprintf("%.4f"$balance) . $mode, txid: $bet_txid, bet: " sprintf("%.4f"$bet) . "$mode on $game_name ";

# wait for result
$result  = get_result($mode$bet_txid$game_name);

# pre select next game
$rand_keys array_rand($games2); $game_name $games[$rand_keys[0]]; $s load_game($mode$game_name);

# check win / lose
if($result) # WIN
{
#echo $win_string;
echo " WIN\n";
$bet $min;
}
else # LOSE
{
echo " LOSE\n";
$bet sprintf("%.8f"$bet $x);
if($bet $max)
{
echo "[Hit Wall - Reseting]\n";
$bet $min;
}
else if($goto_max && $bet $x $max)
{
$bet $max;
}
}

# -----------------------------------------------------------------------------
# check exit :3
# -----------------------------------------------------------------------------

$balance check_balance();

if($balance $start_balance * (100-$percent_lose) / 100) # loss exit
{
echo "Exiting, Balance $balance is $percent_lose % lower than start balance $start_balance\n";
exit;
}
if($balance $start_balance * (100+$percent_win) / 100  # profit exit
{
echo "Exiting, Balance $balance is $percent_win % higher than start balance $start_balance\n";
exit;
}
}
exit;

# *****************************************************************************
# done
# *****************************************************************************

# -----------------------------------------------------------------------------
# Load Game

function load_game($mode$game_name)
{
$jsonurl "http://satoshiroulette.com/api.php?game=$game_name&mode=$mode";
$json file_get_contents($jsonurl);
$game json_decode($json);
$GLOBALS['address']$game->{'address'} ;
$GLOBALS['jackpot'] = 0;

if(isset($game->{'jackpot'}))
{
$GLOBALS['jackpot'] = sprintf("%.8f"$game->{'jackpot'});
}
if($GLOBALS['min'] < $game->{'min_bet'} || !$GLOBALS['min'])
{
$GLOBALS['min'] = $game->{'min_bet'} ;
}
if($GLOBALS['min'] > $game->{'max_bet'})
{
$GLOBALS['min'] = $game->{'min_bet'} ;
}
if($GLOBALS['max'] > $game->{'max_bet'} || !$GLOBALS['max'])
{
$GLOBALS['max'] = $game->{'max_bet'};
}
}

# -----------------------------------------------------------------------------
# Get Balance

function check_balance()
{
if($GLOBALS['blockchain'])
{
$jsonurl "https://blockchain.info/merchant/".$GLOBALS['user']."/balance?password=".$GLOBALS['password'];
$json file_get_contents($jsonurl,0,null,null);
$json json_decode($json);
return $json->{'balance'} / 100000000;
}
return $GLOBALS['coind']->getbalance('*'0);
}

# -----------------------------------------------------------------------------
# wait for bet result

function get_result($mode$bet_txid$game_name)
{
$jsonurl "http://satoshiroulette.com/log.api.php?txid=$bet_txid&mode=$mode";

while(! isset($r->{$game_name}) )
{
$r json_decode(file_get_contents($jsonurl));
if(isset($r->{$game_name}))
{
return $r->{$game_name};
}
print "-";
sleep(rand($GLOBALS['sleep'], $GLOBALS['sleep_max']));
}
}

# -----------------------------------------------------------------------------
# Bet

function send_bet($bet$address)
{
if($GLOBALS['blockchain'])
{
$b $bet 100000000;
$jsonurl "https://blockchain.info/merchant/".$GLOBALS['user']."/payment?password=".$GLOBALS['password']."&to=$address&amount=$b";
$bet_tx json_decode(file_get_contents($jsonurl,0,null,null));
return $bet_tx->{'tx_hash'};
}
return $GLOBALS['coind']->sendtoaddress($address, (float) $bet );
}
?>

and its output:

Code:
C:\sr-bot>php bot.php
===============================================================================
Satoshi Roulette - Martingale Bot - Mode TRC
===============================================================================

Target Balance: 150.5158 TRC
Start Balance : 136.8325 TRC
Stop Balance  : 91.6778 TRC

-----------------------------------------------------------------------------

Balance: 136.8325 TRC, txid: 506d664bced62f92e095e9c8f23552a0e94e63bcf196129143046ce0f8537188, bet: 2.0000TRC on roulette-odd - WIN
Balance: 138.8265 TRC, txid: 8ba43bf7770dc1feebc0189bc8a86f6bee627cbcad71f8061ff34b6476d76005, bet: 2.0000TRC on roulette-black - WIN
Balance: 140.8205 TRC, txid: 0bd00e39fe42350eb43623901d03bb2b348aebac118df9149cb70120cff79220, bet: 2.0000TRC on roulette-red - WIN
Balance: 142.8145 TRC, txid: 0ac85257354cce8ffd307f683ff33ea3207c7032ecf15128bdbda30088cb11ad, bet: 2.0000TRC on roulette-black -- WIN
Balance: 144.8085 TRC, txid: 5339fdde1caa52315285f17a934f167085cd784e5dbf28c1bf7456d7ad62037b, bet: 2.0000TRC on roulette-red - LOSE
Balance: 142.8075 TRC, txid: fabd622c60cb6d73bc033e75fc8f9ed1866a9138ea72cc8d9c72818ddcf6404b, bet: 4.2000TRC on roulette-red - LOSE
Balance: 138.6065 TRC, txid: 044d2d6b9ca55c0d67a49fbb95f6671c596871832a63f4034983c4c2c8f695f1, bet: 8.8200TRC on roulette-red - WIN
Balance: 147.4205 TRC, txid: ddf51898890678ee72dc06563eb41b1580246ddc6e9c5a201517c96d6dd02a42, bet: 2.0000TRC on roulette-red - WIN
Balance: 149.4145 TRC, txid: 15a5b8863837b44ef889f66bceb1f50098f27142855fffdd64741a9a07cffce9, bet: 2.0000TRC on roulette-red - WIN
Exiting, Balance 151.40847749 is 10 % higher than start balance 136.8325

C:\sr-bot>


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: RicRock on February 15, 2013, 04:13:37 AM
Playing around with this from one of my wallets and having trouble getting results as evidenced below:

===============================================================================
Satoshi Roulette - Martingale Bot - Mode BTC
===============================================================================

Target Balance:   0.3454 BTC
Start Balance :   0.3140 BTC
Stop Balance  :   0.2104 BTC

-----------------------------------------------------------------------------

Balance: 0.3140 BTC, txid: f2176c5fae37ca3ecb93df399eaac37554d3ca595613016223a5617bac588565, bet: 0.0100BTC on roulette-red -------^C
root@vps:~/roulette# php new.php
===============================================================================
Satoshi Roulette - Martingale Bot - Mode BTC
===============================================================================

Target Balance:   0.3454 BTC
Start Balance :   0.3140 BTC
Stop Balance  :   0.2104 BTC

-----------------------------------------------------------------------------

Balance: 0.3140 BTC, txid: 713a20736dc264aac32dc556bcf8517a4bc51e44754faa4168c08c3fdd671acf, bet: 0.0100BTC on roulette-black -----^C

When I enter those transaction ID's to get results I get:

{
   "error":15,
   "error_msg":"txid '713a20736dc264aac32dc556bcf8517a4bc51e44754faa4168c08c3fdd671acf' not found in DB"
}

From the URL: http://satoshiroulette.com/log.api.php?txid=713a20736dc264aac32dc556bcf8517a4bc51e44754faa4168c08c3fdd671acf&mode=BTC

That URL should show the result of Bet correct?



Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: SRoulette on February 15, 2013, 04:23:18 AM
Hi Rick,

the it may take up to 20 seconds for our log / db to record your bet result.

If you check now, the bet has been processed:

http://satoshiroulette.com/log.api.php?txid=713a20736dc264aac32dc556bcf8517a4bc51e44754faa4168c08c3fdd671acf&mode=BTC

Code:
{
"roulette-black":1
}


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: RicRock on February 15, 2013, 04:28:31 AM
Ahh... I'm just to impatient.

Bot is definitely fun to tinker with.


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: SRoulette on February 15, 2013, 06:54:52 AM
Ahh... I'm just to impatient.

Bot is definitely fun to tinker with.

thanks :)

the more feedback the better, we aim to keep improving our bot, I did not write it myself but I am also having good fun tinkering with it.


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: 🏰 TradeFortress 🏰 on February 18, 2013, 07:41:43 AM
you need apache

It's a standalone PHP script.  You run in on the command line.  Not in apache.

PHP, sorry  :)


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: SRoulette on February 18, 2013, 08:05:19 AM
Update coming tonight, we are hearing feedback on some customized bots, we would love to see any of the mods made :)


Title: Re: Satoshi Roulette Martingale Bot - update 1
Post by: SRoulette on February 18, 2013, 01:18:30 PM
First off, thank you to all our botters.
Your relentless thrashing of our games have helped us tune the engine and front end for much faster responses.

This latest update first checks your local bitcoin wallet's latest transaction, if it is a recieve it assumes it is a result and proceeds with the next bet.
This can have unforeseen results, ie if you have another transaction come in while the bot is running.
To avoid any user heads this "turbo mode" is disabled by default, but can be turned on by setting $turbo = 1; in the user defined settings.

Code:
<?php
# *****************************************************************************
# Satoshi Roulette Bot
# *****************************************************************************
#
# references:
# https://bitcointalk.org/index.php?topic=137519.msg1512149#msg1512149
# http://blockchain.info/api/blockchain_wallet_api

include './jsonRPCClient.php';

global 
$address;
global 
$address_old;
global 
$bet;
global 
$min;
global 
$max;
global 
$max_old;
global 
$jackpot;
global 
$sleep;
global 
$user;
global 
$password;
global 
$coind;
global 
$blockchain;
global 
$turbo;

# -----------------------------------------------------------------------------
# Begin user defined settings
# -----------------------------------------------------------------------------

$turbo 0; # enable turbo mode, for fast result checking using the latest recieved bitcoind txid.

# list of games to bet against.

$games = array("roulette-red""roulette-black""roulette-odd""roulette-even""jdice-052""coinflip-heads""coinflip-tails""roulette-1to18""roulette-19to36");

# exit settings
$percent_win = 100; # what % wallet increase to stop at
$percent_lose = 50; # what % wallet decrease to stop at

# bot settings
$mode 'TRC'; # mode: BTC/ LTC/ PPC
$blockchain 0; # 1 for using blockchain.info wallets, set mode to BTC
$min 0.025; # if lower than the games min, the games min is used
$max 100; # if higher than the games max, the games max is used
$goto_max 1; # if the next bet greater than the games max bet, bet max. Used for collecting jackpots.

# bitcoind/ litecoind/ trcoind rpc connection settings
$ip '127.0.0.1'; # coind ip
$user 'user'; # coind rpc user
$password 'password'; # coind rpc password
$port 8866; # coind rpc port

# misc settings
$x 2; # when a bet loses, the next bet = $bet * $x;
$sleep 10; # sleep time: 10 seconds is optimal, 5 or lower for turbo.

# -----------------------------------------------------------------------------
# End user defined settings
# -----------------------------------------------------------------------------

$bet 0;
$json_coind_url = "http://$user:$password@$ip:$port/";
$game_name $games[0]; # start with first game in array
$balance 0;
$jackpot 0;
$address_old = '';
$gweedo 1;
$json_coind_url = "http://$user:$password@$ip:$port/";
$address '';

# *****************************************************************************
# Start
# *****************************************************************************

if(!$blockchain# connect to coind via rpc if not using blockchain.info api
{
$coind = new jsonRPCClient($json_coind_url);
}

$start_balance = $balance sprintf("%.4f"check_balance());
$win_balance = sprintf("%.4f"$start_balance * ((100+$percent_win) / 100));
$lose_balance = sprintf("%.4f"$start_balance * ((100-$percent_lose) / 100));

check_last();

echo 
"===============================================================================
Satoshi Roulette - Martingale Bot - Mode 
$mode
===============================================================================

Target Balance:
$win_balance $mode
Start Balance :
$start_balance $mode
Stop Balance  :
$lose_balance $mode
"
;

if(
$turbo == 1)
{
echo 
"\nTURBO MODE\n";
}

echo 
"
-----------------------------------------------------------------------------

"
;

# load game info
$rand_keys array_rand($games2); $game_name $games[$rand_keys[0]]; 
$s load_game($mode$game_name);
if(!
$bet) { $bet $min; }

while(
1)
{
# send bet
$bet_txid send_bet($bet$address);
echo date("H:i:s: "time())  . "Balance: " sprintf("%.4f"$balance) . $mode, txid: $bet_txid, bet: " sprintf("%.4f"$bet) . $mode on $game_name ";

# wait for result
$result  = get_result($mode$bet_txid$game_name);

# pre select next game
$rand_keys array_rand($games2); $game_name $games[$rand_keys[0]]; $s load_game($mode$game_name);

# check win / lose
if($result) # WIN
{
#echo $win_string;
echo " WIN\n";
$bet $min;
}
else # LOSE
{
echo " LOSE\n";
$bet sprintf("%.8f"$bet $x);
if($bet $max)
{
echo "[Hit Wall - Reseting]\n";
$bet $min;
}
else if($goto_max && $bet $x $max)
{
$bet $max;
}
}

# -----------------------------------------------------------------------------
# check exit :3
# -----------------------------------------------------------------------------

$balance check_balance();

if($balance $start_balance * (100-$percent_lose) / 100) # loss exit
{
echo "Exiting, Balance $balance is $percent_lose % lower than start balance $start_balance\n";
exit;
}
if($balance $start_balance * (100+$percent_win) / 100  # profit exit
{
echo "Exiting, Balance $balance is $percent_win % higher than start balance $start_balance\n";
exit;
}
}
exit;

# *****************************************************************************
# done
# *****************************************************************************

# -----------------------------------------------------------------------------
# Load Game

function load_game($mode$game_name)
{
$GLOBALS['jackpot'] = 0;

while(1)
{
$tmp file_get_contents("http://satoshiroulette.com/api.php?game=$game_name&mode=$mode");
$game json_decode($tmp);

if( isset($game->{'address'}) )
{
break;
}
else
{
print "JSON Reply:\n$tmp\n";
sleep(10);
}

}
$GLOBALS['address']$game->{'address'} ;

if(isset($game->{'jackpot'}))
{
$GLOBALS['jackpot'] = sprintf("%.8f"$game->{'jackpot'});
}
if($GLOBALS['min'] < $game->{'min_bet'} || !$GLOBALS['min'])
{
$GLOBALS['min'] = $game->{'min_bet'} ;
}
if($GLOBALS['min'] > $game->{'max_bet'})
{
$GLOBALS['min'] = $game->{'min_bet'} ;
}
if($GLOBALS['max'] > $game->{'max_bet'} || !$GLOBALS['max'])
{
$GLOBALS['max'] = $game->{'max_bet'};
}
}

# -----------------------------------------------------------------------------
# Get Balance

function check_balance()
{
if($GLOBALS['blockchain'])
{
$jsonurl "https://blockchain.info/merchant/".$GLOBALS['user']."/balance?password=".$GLOBALS['password'];
$json file_get_contents($jsonurl,0,null,null);
$json json_decode($json);
return $json->{'balance'} / 100000000;
}
return $GLOBALS['coind']->getbalance('*'0);
}

# -----------------------------------------------------------------------------
# wait for bet result

function get_result($mode$bet_txid$game_name)
{
$jsonurl "http://satoshiroulette.com/log.api.php?txid=$bet_txid&mode=$mode";
$c 0;

while(! isset($r->{$game_name}))
{
$c++;

# sleep straight away as its unlikely we bitcoin travels the speed of light
sleep($GLOBALS['sleep']);

# check local wallet for latest tx
$w check_last();
if($w == 'WIN')
{
return 1;
}
else if ($w == 'LOSE')
{
return 0;
}

# check satoshiroulette.com API for win / lose
$r json_decode(file_get_contents($jsonurl));
if(isset($r->{$game_name}))
{
return $r->{$game_name};
}
if($c == 6)
{
$c 0;
print "|";
}
else
{
print "-";
}
}
}

# -----------------------------------------------------------------------------
# Bet

function send_bet($bet$address)
{
if($GLOBALS['blockchain'])
{
$b $bet 100000000;
$jsonurl "https://blockchain.info/merchant/".$GLOBALS['user']."/payment?password=".$GLOBALS['password']."&to=$address&amount=$b";
$bet_tx json_decode(file_get_contents($jsonurl,0,null,null));
return $bet_tx->{'tx_hash'};
}
return $GLOBALS['coind']->sendtoaddress($address, (float) $bet );
}

function 
check_last()
{
if($GLOBALS['blockchain'] || !$GLOBALS['turbo'])
{
return 'NULL';
}
$r $GLOBALS['coind']->listtransactions();
$l count($r) - 1;
$cat $r[$l]['category'];
$txid $r[$l]['txid'];
$amount $r[$l]['amount'];

if($cat == 'receive')
{
if($amount $GLOBALS['bet'])
{
return 'LOSE';
}
else
{
return 'WIN';
}
}
return 'NULL';
}

?>

Sample Output:
Code:
C:\sr-bot>php bot.php
===============================================================================
Satoshi Roulette - Martingale Bot - Mode TRC
===============================================================================

Target Balance: 725.4350 TRC
Start Balance : 362.7175 TRC
Stop Balance  : 181.3587 TRC

-----------------------------------------------------------------------------

21:03:46: Balance: 362.7175 TRC, txid: 5c3dc408e2bd309de48dcbab3e0868fb5011fc8963a6fec8f5283e6e572cd692, bet: 0.5000 TRC on roulette-red  WIN
21:03:57: Balance: 363.2115 TRC, txid: 437978c14bbdecdc83907327b5274727d17b5e7fe18b4eacec7fa8291daae9a3, bet: 0.5000 TRC on roulette-red  LOSE
21:04:08: Balance: 362.7105 TRC, txid: a9e024ffd569236055715b6e908c196a349b95e7c69c244348014795707e2990, bet: 1.0000 TRC on coinflip-heads - LOSE
21:04:32: Balance: 361.7095 TRC, txid: 21a068d5eafaae38cee29c894322562b64b4a8b05141d7b8dcdb2cfb5af6537e, bet: 2.0000 TRC on jdice-052 - LOSE
21:04:55: Balance: 359.7085 TRC, txid: 6313a2eb1a41f5e565e198f68716643085b6360e2007d4fe8ad9c3a34329d713, bet: 4.0000 TRC on jdice-052 - LOSE
21:05:18: Balance: 355.7075 TRC, txid: c010cfb3b22011be3972e52f522f932f2963b26bb1450a330721cd77719a16da, bet: 8.0000 TRC on roulette-black  LOSE
21:05:29: Balance: 347.7065 TRC, txid: 3fe612101867a9d30624c17234fafb92d67ec1cafea14bee52e6f52a6f431441, bet: 16.0000 TRC on roulette-1to18  LOSE
21:05:40: Balance: 331.7055 TRC, txid: c774a19b0a2943d95b0cb95d0a1dbf8070c3901ffc537fd868e670850bcde047, bet: 37.0000 TRC on jdice-052 - LOSE
[Hit Wall - Reseting]
21:06:03: Balance: 294.7045 TRC, txid: f187198677a7f338f61caa4080d8835b3d3bd8219d077233e9f60424e1ffff10, bet: 0.5000 TRC on jdice-052  WIN
21:06:14: Balance: 295.1995 TRC, txid: 7648ea3d1bad8ddfb0b7173a43e5ce79191c136d1ace2dc795d2f57f556060ca, bet: 0.5000 TRC on roulette-even - LOSE
21:06:36: Balance: 294.6985 TRC, txid: 992e3af38bcf6bee00eabec0a2906308d0b3cd5c411fdb55282e2f44a5532167, bet: 1.0000 TRC on roulette-red  WIN
21:06:47: Balance: 295.6925 TRC, txid: 8a7d83076e86f0dcf3f2205ffbd2dede222186525ee74089d44b86e2f46455c5, bet: 0.5000 TRC on roulette-even  LOSE
21:06:58: Balance: 295.1915 TRC, txid: ff565210a53d0c0d2df062c438260d08b1ee6a9ced77b4a18f104faa4ff19c74, bet: 1.0000 TRC on roulette-odd - LOSE
21:07:20: Balance: 294.1905 TRC, txid: e7fac25eaf862a8a89444211a7ece0146c00c941e0d409073693271ec4330325, bet: 2.0000 TRC on roulette-black  LOSE
21:07:31: Balance: 292.1895 TRC, txid: ceaf730d498907d1014f9ef90acfa0c58f83ff413501126c5f088944073acce9, bet: 4.0000 TRC on roulette-odd  LOSE
21:07:42: Balance: 288.1885 TRC, txid: 4eed48cbfddd87ff37c34c9a7e160f2644037be603dc5d8436352003a2d79a00, bet: 8.0000 TRC on roulette-black  WIN
21:07:53: Balance: 296.1825 TRC, txid: 6bd913d91d37ddec7dcc61e44d0cfbbc20b0dd32964152aabc842906f9beeb4d, bet: 0.5000 TRC on roulette-black - LOSE
21:08:15: Balance: 295.6815 TRC, txid: 53bc4d3afb6379eb60dd998985390ad748bc4248db0900c3e29b4955360d97c5, bet: 1.0000 TRC on roulette-black  WIN
21:08:26: Balance: 296.6755 TRC, txid: ed48318fd28c56ff096c09a8820490c591f9303828ac1fbc86d7fed021621dc6, bet: 0.5000 TRC on roulette-black


Title: Re: Satoshi Roulette Martingale Bot
Post by: Richy_T on February 18, 2013, 09:55:13 PM
actually its even easier than that, php for windows automatically adds php to your path :)

Does it not also set up file associations?


Title: Re: Satoshi Roulette Martingale Bot
Post by: SRoulette on February 19, 2013, 01:54:45 AM
actually its even easier than that, php for windows automatically adds php to your path :)

Does it not also set up file associations?

I will have to step through the install again to confirm that, but I dont believe so.


Title: Re: Satoshi Roulette Martingale Bot - update 2
Post by: SRoulette on March 10, 2013, 03:54:01 AM
Update 3 is due shortly, this new update will support multiple casinos and not just our own.

Code Monkey has offered to make a simple cross platform gui app (in perl+tk) if players would be interested :)


Title: Re: Satoshi Roulette Martingale Bot - update 2
Post by: lisenokk on November 23, 2014, 09:32:26 PM
Who can tell the active version of the bot and how to customize the Doge. for windows


Title: Re: Satoshi Roulette Martingale Bot - update 2
Post by: ShetKid on November 24, 2014, 01:33:02 AM
Wow this is nice.
Thanks for this I'll save this, I'll try it sometime :)