How to get total number of transactions from bitcoin core wallet using rpc

2

I'm trying to implement paginations using :

https://chainquery.com/bitcoin-api/listtransactions

I want to have reverse listing (oldest first), so I need to get total number of transaction returned by listtransactions call.

I know that getwalletinfo returns number of transactions, but listtransactions returns transaction outputs, which are more if sendmany is used.

Is there any method to get listtransactions.length without fetching all transaction in the wallet ?

Pavel Niedoba

Posted 2017-10-03T16:20:20.667

Reputation: 454

Answers

0

You can pass the output of listtransactions through a JSON parser which can get that information for you. You can install a command line tool like jq and pipe the output of your commands to it so you can access the JSON fields that you want.

Andrew Chow

Posted 2017-10-03T16:20:20.667

Reputation: 40 910

This is what I want to avoid to do as I wrote in my question. I want to implement pagination, we have about 100 000 transactions in the wallet, fetching them all is slow. More over I use Java not JavaScript. Parsing JSON is not problemPavel Niedoba 2017-10-04T07:26:39.610