Post
Topic
Board Trading Discussion
Re: PHP martingale bot for satoshiDICE
by
KJTetc
on 06/02/2013, 01:58:27 UTC
Okay so I'm still confused.

This is what I currently have in my bitcoin.conf:
rpcuser=KJTetc
rpcpassword=(my pass lol)
rpcallowip=*
server=1

And this is my bot which is in htdocs which also has JSONrpcClient in it.

 
Code:
require_once('jsonRPCClient.php');
$b = new jsonRPCClient('http://KJTetc:MyRpcpass@localhost:8332/');

define('MIN_BET'0.01);
define('MAX_BET'6);
define('ADDRESS''1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp');

$bet MIN_BET;
$total_fees 0;
$count 0;
$count_won 0;

while ((
$bet <= MAX_BET) && ($count_won 100))
{
        
$count++;

        
$balance_a $b->getbalance('*'0);
        if (!isset(
$starting_balance)) $starting_balance $balance_a;
        
$b->sendtoaddress(ADDRESS, (float) $bet);
        
$balance_b $b->getbalance('*'0);

        
$fee $balance_a $balance_b $bet;
        
$total_fees += $fee;
        
$total_fees number_format($total_fees,8,'.','')+0;

        echo 
'Game #'.$count."\n";
        echo 
'Balance: ' $balance_a."       ";
        echo 
'Bet: '$bet."       ";
        echo 
'Fee: '. (number_format($fee8'.''') +0) . "       ";
        echo 
'Total Fees: '$total_fees"\n";
        echo 
'Balance: ' $balance_b "       ".'Waiting';

        
$balance_c 0;

        while (
$balance_b >= $balance_c)
        {
        sleep(4);
$balance_c $b -> getbalance('*'0);
echo '.';
        }

        echo 
"\nBalance: $balance_c       ";

        
$diff $balance_c $balance_b;

        if (
$diff $bet)
        {
                
$bet MIN_BET;
                
$count_won++;
                echo 
"Win! ($count_won out of $count)\n";
        }
        else
        {
                
$bet *= 2;
                echo 
'Lose!'."\n";
        }

        echo 
"\n";
}

echo 
'Starting Balance: '.$starting_balance."\n";
echo 
'Ending Balance  : '$balance_c."\n";
echo 
'Total Fees: '$total_fees."\n";
$amt_won $balance_c $starting_balance;
echo 
'Net Profit: '. (number_format($amt_won,8,'.','') + 0). "\n\n";

I get this error:


Code:
Warning: fopen(http://...@localhost:8332/): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\xampp\htdocs\jsonRPCClient.php on line 132

Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://KJTetc:*****@localhost:8332/' in C:\xampp\htdocs\jsonRPCClient.php:140 Stack trace: #0 C:\xampp\htdocs\bot2.php(20): jsonRPCClient->__call('sendtoaddress', Array) #1 C:\xampp\htdocs\bot2.php(20): jsonRPCClient->sendtoaddress('1dice8EMZmqKvrG...', 0.01) #2 {main} thrown in C:\xampp\htdocs\jsonRPCClient.php on line 140





BTC2 received, thanks.  Good luck! (you'll need it if you plan to use martingale betting for very long...)