Bitcoin Forum
December 15, 2024, 08:09:27 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bitcoind listtransactions - easy n00b question  (Read 3605 times)
mav (OP)
Full Member
***
Offline Offline

Activity: 169
Merit: 107


View Profile
June 19, 2012, 08:05:14 AM
 #1

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
TehZomB
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250



View Profile
June 19, 2012, 08:40:19 AM
 #2

use "*" instead of just *
sorry for shortness, on ipod
mav (OP)
Full Member
***
Offline Offline

Activity: 169
Merit: 107


View Profile
June 19, 2012, 11:14:33 AM
 #3

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.
John (John K.)
Global Troll-buster and
Legendary
*
Offline Offline

Activity: 1288
Merit: 1227


Away on an extended break


View Profile
June 19, 2012, 11:18:46 AM
 #4

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 (OP)
Full Member
***
Offline Offline

Activity: 169
Merit: 107


View Profile
June 20, 2012, 01:23:58 AM
 #5

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
Andrew Vorobyov
Hero Member
*****
Offline Offline

Activity: 558
Merit: 500



View Profile
July 30, 2012, 06:13:45 PM
 #6

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!
mnemonix
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile
April 21, 2013, 06:54:17 PM
 #7

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



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!