Bitcoin Forum
May 22, 2024, 09:55:52 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Need help with bitcoind and jsonRPCClient  (Read 755 times)
subcoin (OP)
Member
**
Offline Offline

Activity: 100
Merit: 10


View Profile
July 19, 2013, 01:06:47 AM
 #1

Hi,
I wonder, if somebody could help with with PHP jsonRPCClient.

I am trying to pull 10 last transactions for ALL accounts from bitcoind using jsonRPCClient.

I do something like this:
$account = '';
$count_trns = 10;
$start_from = 0;
$trn_array = $bitcoin->listtransactions($account, $count_trns, $start_from);

This gives me ONLY the transactions for the main account (where account name is empty).
The listtransactions says: "If [account] not provided will return recent transaction from all accounts."
But when I do:
$trn_array = $bitcoin->listtransactions($count_trns, $start_from);

It doesn't work (PHP Warning:  fopen(http://...@xx.xx.xx.xx:8332/): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
 in /../jsonRPCClient.php on line 132)

I've temporary resolved it by calling listtransactions(); - without any parameters
But as the list of transactions grows I would like to call it with limit.

So, the question is how can I pull 10 last transactions for ALL accounts?



subcoin (OP)
Member
**
Offline Offline

Activity: 100
Merit: 10


View Profile
July 19, 2013, 01:10:42 AM
 #2

sorry, for posting, I've searched and found my answer...

need to call the account = '*'

Thanks! Smiley
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1025



View Profile
July 19, 2013, 01:53:24 PM
 #3

Yes, the root problem that you can't omit a leading argument.  All three of the parameters are optional, but if present, they will be interpreted in the order listed.  This may not be obvious to people that don't program much, so I'm pointing it out to future searchers.

The default account is named by an empty string.  If you look at the bitcoind source code, you'll see that the account name defaults to '*', and is overwritten with the first argument.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
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!