Bitcoin Forum
May 10, 2024, 05:40:08 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: PHP jsonRPPClient sendmany --- trouble it is not working. bitcoind [Solved]  (Read 2058 times)
danystatic (OP)
Full Member
***
Offline Offline

Activity: 235
Merit: 100


View Profile
October 14, 2013, 09:27:11 AM
Last edit: October 15, 2013, 09:43:47 PM by danystatic
 #1

example: print_r($bitcoin->getaddressesbyaccount ('rpcuser')); echo "\n";     Works great

for sendmany I have tried many ways:

1.
$array = array("12w5Ffu8cc8kRwULGBsxAzeo5UCU9QCcqE" => "1000000", "1KpZPdyeXVX8JMGdENhJxqF9g3NG5XxhG3" => "100000");
2.
$array = json_encode($array);
3.
$array["12w5Ffu8cc8kRwULGBsxAzeo5UCU9QCcqE"] = "100000";
$array["1KpZPdyeXVX8JMGdENhJxqF9g3NG5XxhG3"] = "200000";

4. and others... into this function
example:    $bitcoin->sendmany("rpcuser",$array); and also tried with ,0 confirmations and 1,

I am continue looking but 4 hours is a long time for this sendmany() function

I will move on....

thanks
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715362808
Hero Member
*
Offline Offline

Posts: 1715362808

View Profile Personal Message (Offline)

Ignore
1715362808
Reply with quote  #2

1715362808
Report to moderator
Jouke
Sr. Member
****
Offline Offline

Activity: 426
Merit: 250



View Profile WWW
October 14, 2013, 01:32:19 PM
 #2

what RPC-library are you using?

Koop en verkoop snel en veilig bitcoins via iDeal op Bitonic.nl
danystatic (OP)
Full Member
***
Offline Offline

Activity: 235
Merit: 100


View Profile
October 14, 2013, 03:02:27 PM
Last edit: October 14, 2013, 03:18:08 PM by danystatic
 #3

what RPC-library are you using?

The One from http://jsonrpcphp.org/   (full version)

bitcoind and source running on linux

This is the code:
$bitcoin = new jsonRPCClient('http://bitcoinrpc:7sXyVsD7YWPKEp91jH9T73YucZutALnLp4AjwmS5n3xz@localhost:8332/');
      
$amount = floatval("0.00100000");


 Log::info("*******Paymentbook Bitcoind ***************");
$array = json_encode(array("12w5Ffu8cc8kRwULGBsxAzeo5UCU9QCcqE" => "$amount", "1KpZPdyeXVX8JMGdENhJxqF9g3NG5XxhG3"=> "$amount"));

$bitcoin->sendmany("rpcuser" , $array, 1);

And I am getting this in the Logs: (when using an Array)

[2013-10-14 15:12:14] log.INFO: *******Paymentbook Bitcoind *************** [] []
[2013-10-14 15:12:14] log.ERROR: exception 'ErrorException' with message 'fopen(http://...@localhost:8332/): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
' in /var/www/sites/laevolucionsocialvip/app/libraries/jsonRPCClient.php:138
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'fopen(http://.....', '/var/www/sites/...', 138, Array)
#1 /var/www/sites/laevolucionsocialvip/app/libraries/jsonRPCClient.php(138): fopen('http://bitcoinr...', 'r', false, Resource id #126)
#2 /var/www/sites/laevolucionsocialvip/app/routes.php(583): jsonRPCClient->__call('sendmany', Array)
#3 /var/www/sites/laevolucionsocialvip/app/routes.php(583): jsonRPCClient->sendmany('rpcuser', '{"12w5Ffu8cc8kR...', 1)
#4 [internal function]: {closure}()
#5 /var/www/sites/laevolucionsocialvip/vendor/laravel/framework/src/Illuminate/Routing/Route.php(80): call_user_func_array(Object(Closure), Array)
#6 /var/www/sites/laevolucionsocialvip/vendor/laravel/framework/src/Illuminate/Routing/Route.php(47): Illuminate\Routing\Route->callCallable()
#7 /var/www/sites/laevolucionsocialvip/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1016): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#8 /var/www/sites/laevolucionsocialvip/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(530): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#9 /var/www/sites/laevolucionsocialvip/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(506): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#10 /var/www/sites/laevolucionsocialvip/public/index.php(49): Illuminate\Foundation\Application->run()
#11 {main} [] []


gmaxwell
Staff
Legendary
*
Offline Offline

Activity: 4172
Merit: 8419



View Profile WWW
October 14, 2013, 03:16:03 PM
 #4

You are specifying your value as a string.
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 275


View Profile
October 15, 2013, 09:22:36 AM
 #5

Code:
$amount = floatval("0.00100000");
$array = json_encode(array(
   "12w5Ffu8cc8kRwULGBsxAzeo5UCU9QCcqE" => "$amount",
   "1KpZPdyeXVX8JMGdENhJxqF9g3NG5XxhG3"=> "$amount")
);

As gmaxwell pointed out, your casting the amount as a string (second line is the problem). I tend to leave casting the value as a float until the bitcoin library, as otherwise you'll be repeating yourself a lot. This should work:
Code:
$array = json_encode(array(
   "12w5Ffu8cc8kRwULGBsxAzeo5UCU9QCcqE" => (float)$amount,
   "1KpZPdyeXVX8JMGdENhJxqF9g3NG5XxhG3"=> (float)$amount)
);

Bitwasp Developer.
Jouke
Sr. Member
****
Offline Offline

Activity: 426
Merit: 250



View Profile WWW
October 15, 2013, 11:02:37 AM
 #6

You are specifying your value as a string.

This. And don't json-encode your array.

Koop en verkoop snel en veilig bitcoins via iDeal op Bitonic.nl
danystatic (OP)
Full Member
***
Offline Offline

Activity: 235
Merit: 100


View Profile
October 15, 2013, 09:43:17 PM
 #7

Solved

Thanks
Yes, do NOT json_encode and just build the key=> value array, it is working.

Thanks a lot
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!