Author

Topic: bitcoind listtransactions - easy n00b question (Read 3588 times)

newbie
Activity: 19
Merit: 0
bitcoind listtransactions "*" 1 X
for x starting at 0 and increasing by 1 until the result matches a transaction I've already encountered before

Genius!

Not really ... Not only, he generates lots of RPC calls, but he will also miss transactions if a new transaction comes in while he increments X ...

Example:

bitcoind listtransactions "*" 1 0
{... hash: "fe46e7a8..."' }

while

bitcoind listtransactions "*" 1 1
{... hash: "fe46e7a8..."' }

So, you would break here although, there could be another new transaction after the hash you already know ...

Imho this listtransaction model is crap ... it make things much more difficulty than it has to be. The newest transaction is always at index 0 is stupid ...



hero member
Activity: 558
Merit: 500
bitcoind listtransactions "*" 1 X
for x starting at 0 and increasing by 1 until the result matches a transaction I've already encountered before

Genius!
mav
full member
Activity: 169
Merit: 107
Just to be sure for anyone who reads this thread in the future:

bitcoind listtransactions "*" COUNT FROM will return an array of transactions which is a subset starting at the FROMth transaction (starting from the most recent transaction) and will fetch COUNT entries which are older than that one.

I had mistakenly thought that it fetched entries which are more recent than the FROM point and that the FROM point was measured from the oldest transaction.

The correct solution to my problem is

bitcoind listtransactions "*" 1 X
for x starting at 0 and increasing by 1 until the result matches a transaction I've already encountered before

This will fetch one entry at a time from the newest to the oldest. Therefore it is sensible to stop at some point.

Just wanted to make sure I wasn't passing on my misinterpretation of how listtransactions works
legendary
Activity: 1288
Merit: 1227
Away on an extended break
use "*" instead of just *
sorry for shortness, on ipod

Awesome thanks it worked! But another simple question - what should I do instead of the 9999999 for count? I've noticed that if I put in too many 9s it gives a 'negative count' error.

right now this is what I've got and it's working well enough, but I'd like to tidy the 9999 business

Code:
bitcoind listtransactions '*' 99999 32

Which will get the last 99999 transactions from transaction 32 onward, but if I have more than 99999 + 32 transactions... this won't work as I intend.

If I remember correctly this seems to be an old existing bug where a count too high will cause the return to be bugged. There seems to be no existing command to list ALL transactions, though.
mav
full member
Activity: 169
Merit: 107
use "*" instead of just *
sorry for shortness, on ipod

Awesome thanks it worked! But another simple question - what should I do instead of the 9999999 for count? I've noticed that if I put in too many 9s it gives a 'negative count' error.

right now this is what I've got and it's working well enough, but I'd like to tidy the 9999 business

Code:
bitcoind listtransactions '*' 99999 32

Which will get the last 99999 transactions from transaction 32 onward, but if I have more than 99999 + 32 transactions... this won't work as I intend.
sr. member
Activity: 294
Merit: 250
use "*" instead of just *
sorry for shortness, on ipod
mav
full member
Activity: 169
Merit: 107
I'm trying to get a list of all transactions using the 'from' keyword, regardless of what account they belong to

from the command bitcoind help I can see that listtransaction is specified as such:

Code:
listtransactions [account] [count=10] [from=0]

If I specify no arguments I get all transactions regardless of the account.

How do I use the 'from' parameter without the 'account' parameter?

ie I want to do something like this

Code:
bitcoind listtransactions from=X

which should show me a list of all the transactions after transaction number X regardless of the account they're in.

as an example of what I've tried but has not given what I want:

bitcoind listtransactions "" 9999999999999 32
only lists from transaction 32 onward for account "", I want any account

bitcoind listtransactions * 9999999999 32
* is not valid

bitcoind listtransactions --from=32
--from is not valid, returns an empty array

bitcoind listtransactions from=32
returns an empty array, presumably treats the first keyword as account
Jump to: