Bitcoin Forum
May 22, 2024, 03:18:30 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Core (Qt) JSON - RPC listtransactions method problem  (Read 3379 times)
TheVault (OP)
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile WWW
March 25, 2014, 01:57:04 PM
 #1

Hi,
I want to poll the Bitcoin Core wallet for new transactions. These transactions can belong to various accounts, ie the addresses have labels. How do I pass appropriate JSON in to select all transactions from all accounts. The spec says that the "listtransactions" call takes [account] as an optional parameter. However, when I pass "", I get the base wallet address and none of the transactions for the labeled addresses. I cannot seem to omit this parameter and just set the [count] or [skip] parameters as I am constantly getting an error.

I'm doing this in c++ although I'm not sure that language makes any difference. What is the required string format for the command omitting the account parameter.

{ "method": "listtransactions", "params" : [ "", 10, 0 ] }

gives transactions for the base account only. I want all accounts.


{ "method": "listtransactions", "params" : [ 10, 0 ] }

omitting the first parameter causes a server error with a HTTP status code of 500 and an error message of...

{"result":null,"error":{"code":-1,"message":"value is type int, expected str"},"id":null}


So if listtransactions expects a string as the first parameter, and "" specifies the unnamed wallet account, how do I specify all accounts including the named ones.

Rgds
The Vault
syslog
Member
**
Offline Offline

Activity: 70
Merit: 10


View Profile WWW
March 25, 2014, 01:59:46 PM
 #2

Code:
{ "method": "listtransactions", "params" : [ "*", 10, 0 ] }

TheVault (OP)
Newbie
*
Offline Offline

Activity: 43
Merit: 0


View Profile WWW
March 25, 2014, 03:53:01 PM
 #3

Thank you very much sir,

I wasted a lot of time mucking with the syntax as I'm a JSON newbie and thought the error with my syntax. Would help to document that tidbit Smiley

There are lots of 'optional' parameters in the API, how would I omit a numeric value? What about other string values or would they all be covered by the *?

Thx Smiley
The Vault
syslog
Member
**
Offline Offline

Activity: 70
Merit: 10


View Profile WWW
March 25, 2014, 05:02:11 PM
 #4

Thank you very much sir,

I wasted a lot of time mucking with the syntax as I'm a JSON newbie and thought the error with my syntax. Would help to document that tidbit Smiley

There are lots of 'optional' parameters in the API, how would I omit a numeric value? What about other string values or would they all be covered by the *?

Thx Smiley
The Vault

well it depends on rpc call.

you have to use brute force, here is the a good numbers for brute force.

..,-1000,-100,-10,-1, 0, 1, 10, 100, 1000, 10000, ...

for string values
"", "*"

Also if a parameter is optional and you don't want to use it. dont pass any variable(string, integer, float, ...). just let it blank. Let  rpc server handle that parameters.






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!