Author

Topic: [1 BTC BOUNTY] Did the JSON-RPC commands change? (Read 2894 times)

legendary
Activity: 1498
Merit: 1000
November 19, 2012, 03:33:47 AM
#20
The only thing I can think of is to wrap the amount in the method floatval();
GENIUS!  Ok, not really, but you did think of something to try that I did not!  Wink

Where do I send the 1 BTC?
EDIT:  I'll send to your donation address since it's convenient.

yea donation address is fine, thank god cause I was running low on ideas after that LMAO
legendary
Activity: 1498
Merit: 1000
The only thing I can think of is to wrap the amount in the method floatval();
legendary
Activity: 1498
Merit: 1000
Code:
 Fatal error: Call to undefined function curl_init() in C:\wamp\www\includes\jsonRPCClient.php on line 126

that means curl isn't in your php build, switch back to the fopen version
legendary
Activity: 952
Merit: 1000
Damn... Too late...

I had the same problem.
legendary
Activity: 1400
Merit: 1005
The only thing I can think of is to wrap the amount in the method floatval();
GENIUS!  Ok, not really, but you did think of something to try that I did not!  Wink

Where do I send the 1 BTC?
EDIT:  I'll send to your donation address since it's convenient.
legendary
Activity: 1400
Merit: 1005
Ok, so I figured I'd post the entire code from the php page I am using (sanitized).  Basically, it finds bitcoin sends in the forum of [btcaddress, amount] out of the text pasted in the text area and creates a sendmany array with all of them found.

Following the first code block is the getinfo() output.

Code:
require_once 'includes/jsonRPCClient.php';
$bitcoin = new jsonRPCClient('http://sanitized:[email protected]:8332/');

echo "
\n";
print_r($bitcoin->getinfo());
echo "
";

if ($_SERVER['REQUEST_METHOD']=="POST") {
if ($_POST['password']=="sanitized") {

$fromAccount = "";

$input = $_POST['data'];
$input = explode("[",$input);

$input[0]="";
$sendto="";
for ($i=1; $i $temp = explode("]",$input[$i]);
$input[$i] = $temp[0];
$input[$i] = explode(",",$input[$i]);
$sendto[trim($input[$i][0])] = trim($input[$i][1]);
}



try {
echo 'Trying: Sendmany
';
$returned = $bitcoin->sendmany($fromAccount, $sendto);
} catch (Exception $e) {
echo 'Caught exception: ',  $e->getMessage(), "
";
echo print_r($sendto);
}

}
else {
echo "Incorrect password.";
}
}
else {

?>

   

       
       
   

}
?>

Output of getinfo():
Code:
Array
(
    [version] => 32300
    [balance] => 1
    [blocks] => 208578
    [connections] => 8
    [proxy] =>
    [generate] =>
    [genproclimit] => -1
    [difficulty] => 3368767.1405329
    [hashespersec] => 0
    [testnet] =>
    [keypoololdest] => 1353202101
    [paytxfee] => 0
    [errors] => URGENT: upgrade required, see http://bitcoin.org/dos for details
)
legendary
Activity: 1400
Merit: 1005
Code:
Fatal error: Call to undefined function curl_init() in C:\wamp\www\includes\jsonRPCClient.php on line 126

that means curl isn't in your php build, switch back to the fopen version
Roger that.  :\
legendary
Activity: 1400
Merit: 1005
Code:
Fatal error: Call to undefined function curl_init() in C:\wamp\www\includes\jsonRPCClient.php on line 126
legendary
Activity: 1400
Merit: 1005
All you have to do is replace the file named "jsonRPCClient.php" with mine and use it the same way you been using it.

Are you passing an account?

Code:
$client->sendmany("", array("18TKNbSLTrd3a2W8mtoH5uNzFhWRWNcuHU" => 0.00000800,"1JTZHBdrDnFaVvuV43sd2oiwDmzUPfa3Ws" => 0.00000100));
Ok, I'll give that a try.

Account is blank.  "", as you have written.
legendary
Activity: 1400
Merit: 1005
it sounds like an fopen issue, try this version it is the cURL version I wrote, it works the same exact way as jsonRPCClient just uses curl instead of fopen

http://pastebin.com/UfrgfpAi
Hmmm... I don't really know json, or jsonRPC at all.  I use a bitcoin.php and jsonRPCClient.php file to run my code though.  Json greatly confuses me for some reason.

Can you give an example of how to use your code if I have an array of addresses and amounts?

Here's the array:

Code:
Array ( [18TKNbSLTrd3a2W8mtoH5uNzFhWRWNcuHU] => 0.00000800 [1JTZHBdrDnFaVvuV43sd2oiwDmzUPfa3Ws] => 0.00000100 ) 1

Not sure what the 1 at the end is... didn't notice that before.  Could that potentially be causing problems?  I just did a print_r of the array to get that output.
legendary
Activity: 1400
Merit: 1005
It seems your php can't connect to your bitcoind, make sure you have set the correct allowip in the bitcoin.conf. Also if your using a shared hosting server for the php, fopen could be blocked, at that time I can sell you a curl version of JSONclient that I wrote.
That's what I am gathering.  I can't figure out why though, because the getinfo command I send right before the sendmany command works just fine.  The HTTP server running the PHP code and the bitcoind server run on the same local machine.  Nothing is hosted outside of my house in this situation - it's all local.

I caught this exception as well:
Code:
Caught exception: Unable to connect to http://secret:[email protected]:8332/

So why can it connect with the secret:password combo to utilize the getinfo() command but not use the same connection to do sendmany?

EDIT:  Here's the relevant code for the connection and getinfo (which, again, is working fine).

Code:
$bitcoin = new jsonRPCClient('http://secret:[email protected]:8332/');

echo "
\n";
print_r($bitcoin->getinfo());
echo "
";

I got it you updated to 0.7.1 you probably encrypted your wallet, so you have to unlock it then use the sendmany command then lock it again.
Nope, I'm actually back on 0.3 because I thought it might fix the problem.  Brand new wallet, brand new blockchain downloaded (because 0.7 updated both of those to a later format not compatible with 0.3), and it's still giving me the same trouble.
legendary
Activity: 1400
Merit: 1005
It seems your php can't connect to your bitcoind, make sure you have set the correct allowip in the bitcoin.conf. Also if your using a shared hosting server for the php, fopen could be blocked, at that time I can sell you a curl version of JSONclient that I wrote.
That's what I am gathering.  I can't figure out why though, because the getinfo command I send right before the sendmany command works just fine.  The HTTP server running the PHP code and the bitcoind server run on the same local machine.  Nothing is hosted outside of my house in this situation - it's all local.

I caught this exception as well:
Code:
Caught exception: Unable to connect to http://secret:[email protected]:8332/

So why can it connect with the secret:password combo to utilize the getinfo() command but not use the same connection to do sendmany?

EDIT:  Here's the relevant code for the connection and getinfo (which, again, is working fine).

Code:
$bitcoin = new jsonRPCClient('http://secret:[email protected]:8332/');

echo "
\n";
print_r($bitcoin->getinfo());
echo "
";
legendary
Activity: 1400
Merit: 1005
I found this much...

Code:
...
AddAddress(x.x.x.x:8333)
ThreadRPCServer method=getinfo
keypool reserve 3
keypool return 3
ThreadRPCServer method=sendmany
connection timeout
trying connection x.x.x.x:8333 lastseen=-1.0hrs lasttry=-375918.9hrs

Neither of the x.x.x.x was my local or external IP, and the code I am attempting to run is being executed on the local machine with the bitcoin client on it.

EDIT:  Now offering a 1 BTC bounty for whoever comes up with a solution to my problem.
legendary
Activity: 1400
Merit: 1005
Just curious - did the JSON commands change between version 0.3 and 0.7?  I tried using sendmany with the same code I used on 0.3, but it doesn't work in 0.7.  I haven't rolled back to 0.3 to try it again (is there a legitimate place to download 0.3 from still?), but I haven't changed any of the code since the last time I used it on 0.3 either.

" Warning: fopen(http://[email protected]:8332/) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\wamp\www\includes\jsonRPCClient.php on line 132"

'sendmany' should be unchanged, AFAIK.

Want to post a debug.log snippet?


Sure, but I've had more activity after this attempt... what should I look for in the log to find the relevant section?  Or at the very least, what could I look for to find a receipt and send of coins?
legendary
Activity: 1596
Merit: 1100
Just curious - did the JSON commands change between version 0.3 and 0.7?  I tried using sendmany with the same code I used on 0.3, but it doesn't work in 0.7.  I haven't rolled back to 0.3 to try it again (is there a legitimate place to download 0.3 from still?), but I haven't changed any of the code since the last time I used it on 0.3 either.

" Warning: fopen(http://[email protected]:8332/) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\wamp\www\includes\jsonRPCClient.php on line 132"

'sendmany' should be unchanged, AFAIK.

Want to post a debug.log snippet?

legendary
Activity: 1400
Merit: 1005
Just curious - did the JSON commands change between version 0.3 and 0.7?  I tried using sendmany with the same code I used on 0.3, but it doesn't work in 0.7.  I haven't rolled back to 0.3 to try it again (is there a legitimate place to download 0.3 from still?), but I haven't changed any of the code since the last time I used it on 0.3 either.

" Warning: fopen(http://[email protected]:8332/) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\wamp\www\includes\jsonRPCClient.php on line 132"

Offering 1 BTC bounty to whomever solves my problem here.
Jump to: