SRoulette (OP)
|
|
February 10, 2013, 01:47:26 PM Last edit: February 18, 2013, 01:24:03 PM by SRoulette |
|
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:Linuxinstall php. create bot.php in your home directory. WindowsDownload and install the latest PHP windows installer: http://windows.php.net/downloads/releases/php-5.3.21-nts-Win32-VC9-x86.msiInstall 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. Configure:You must have the following in your bitcoin.conf, set your own password and username. server=1 rpcpassword=password rpcuser=user
then edit bot.php and adjust this section to match: # ----------------------------------------------------------------------------- # Begin user defined settings # -----------------------------------------------------------------------------
# SNIP All user settings go here :) see main code block below.
# -----------------------------------------------------------------------------
Bot:<?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($games, 2); $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($games, 2); $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 = 0 + 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'; }
?>
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
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: $address = '';
Maybe it should be in the user defined settings section.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
SRoulette (OP)
|
|
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: $address = '';
Maybe it should be in the user defined settings section. no you do not , the game address is loaded from our JSON api eg: http://satoshiroulette.com/api.php?game=jdice-050As are the min and maximum bets etc
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
February 11, 2013, 03:08:00 AM |
|
I see. Sorry, I misunderstood.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
SRoulette (OP)
|
|
February 11, 2013, 03:37:04 AM |
|
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.
|
|
|
|
payb.tc
|
|
February 11, 2013, 03:43:33 AM |
|
how does one get out of this loop? perhaps some expansion on that while condition would be a good idea
|
|
|
|
SRoulette (OP)
|
|
February 11, 2013, 03:51:52 AM |
|
how does one get out of this loop? 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.
|
|
|
|
|
SRoulette (OP)
|
|
February 12, 2013, 06:48:02 PM |
|
how does one get out of this loop? 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
|
|
|
|
maomao
Member
Offline
Activity: 117
Merit: 10
Not only FUD :)
|
|
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
|
quarkchain.io
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
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.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
February 12, 2013, 09:01:58 PM |
|
when all has to do is add to the very top of the file... but: $ ls -l /bin/php ls: cannot access /bin/php: No such file or directory
Better to use: so it'll work wherever php is in your path.
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
SRoulette (OP)
|
|
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
|
|
|
|
SRoulette (OP)
|
|
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 when all has to do is add to the very top of the file... 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 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 ?
|
|
|
|
SRoulette (OP)
|
|
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.
|
|
|
|
dooglus
Legendary
Offline
Activity: 2940
Merit: 1333
|
|
February 13, 2013, 04:10:45 AM |
|
those that tried and failed criticize others attempts.
others'
|
Just-Dice | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | Play or Invest | ██ ██████████ ██████████████████ ██████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████████████ ██████████████████████ ██████████████ ██████ | 1% House Edge |
|
|
|
deadweasel
|
|
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.
|
|
|
|
SRoulette (OP)
|
|
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 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.
|
|
|
|
🏰 TradeFortress 🏰
Bitcoin Veteran
VIP
Legendary
Offline
Activity: 1316
Merit: 1043
👻
|
|
February 13, 2013, 05:41:57 AM |
|
who is codemonkey?
|
|
|
|
SRoulette (OP)
|
|
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 RESEARCH2) 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.
|
|
|
|
|