Bitcoin Forum

Other => Beginners & Help => Topic started by: mav on June 19, 2012, 08:05:14 AM



Title: bitcoind listtransactions - easy n00b question
Post by: mav on June 19, 2012, 08:05:14 AM
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


Title: Re: bitcoind listtransactions - easy n00b question
Post by: TehZomB on June 19, 2012, 08:40:19 AM
use "*" instead of just *
sorry for shortness, on ipod


Title: Re: bitcoind listtransactions - easy n00b question
Post by: mav on June 19, 2012, 11:14:33 AM
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.


Title: Re: bitcoind listtransactions - easy n00b question
Post by: John (John K.) on June 19, 2012, 11:18:46 AM
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.


Title: Re: bitcoind listtransactions - easy n00b question
Post by: mav on June 20, 2012, 01:23:58 AM
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


Title: Re: bitcoind listtransactions - easy n00b question
Post by: Andrew Vorobyov on July 30, 2012, 06:13:45 PM
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!


Title: Re: bitcoind listtransactions - easy n00b question
Post by: mnemonix on April 21, 2013, 06:54:17 PM
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..."' }

<increment x> while <new transaction is saved>

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 ...