Bitcoin Forum
May 24, 2024, 06:22:21 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: listunspent: get count of UTXOs rather than details?  (Read 280 times)
jnano (OP)
Member
**
Offline Offline

Activity: 301
Merit: 74


View Profile
November 17, 2017, 06:31:38 PM
Merited by ABCbits (1)
 #1

Is there a way to get "listunspent" to return just the total number of matching UTXOs, rather than a detailed array of UTXOs?

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6653


Just writing some code


View Profile WWW
November 17, 2017, 06:47:56 PM
Merited by ABCbits (1)
 #2

I don't think that is possible, but you can just pass the output of the listunspent command to a JSON parser and have the JSON parser tell you how many elements are in the array.

jnano (OP)
Member
**
Offline Offline

Activity: 301
Merit: 74


View Profile
November 17, 2017, 06:54:12 PM
 #3

It's easy if you're the one doing it, but I was looking for something simple for the average user.

I got curious about the total number of Bitcoin users, and thought an own UTXO count poll in the forum could give a rough number.
But if it's complex to check, there will be fewer replies and less accurate data.

What's the main reason these commands are available in Core?
Would it make sense to add to listunspent extra parameters that show summarized info?


achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3402
Merit: 6653


Just writing some code


View Profile WWW
November 17, 2017, 07:04:35 PM
 #4

What's the main reason these commands are available in Core?
These commands are really not for the average user. They are for interacting with a bitcoind that's running on a server with a script or from the command line. They're also used for testing.

Would it make sense to add to listunspent extra parameters that show summarized info?
It would not make sense to add that to listunspent. You could add it somewhere else though, like getwalletinfo.

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!