Title: Bitcoin Core (Qt) JSON - RPC listtransactions method problem Post by: TheVault on March 25, 2014, 01:57:04 PM 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 Title: Re: Bitcoin Core (Qt) JSON - RPC listtransactions method problem Post by: syslog on March 25, 2014, 01:59:46 PM Code: { "method": "listtransactions", "params" : [ "*", 10, 0 ] } Title: Re: Bitcoin Core (Qt) JSON - RPC listtransactions method problem Post by: TheVault on March 25, 2014, 03:53:01 PM 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 :) 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 :) The Vault Title: Re: Bitcoin Core (Qt) JSON - RPC listtransactions method problem Post by: syslog on March 25, 2014, 05:02:11 PM 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 :) 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 :) 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. |