It is known, that UTXOs stored in chainstate database.

But how to get them in simple txt view? Not ballances, but each UTXO.


With vanilla Bitcoin Core, there is no efficient way to do this.

I see two options:

a) Slow and very inefficient RPC loop (not recommended)

  1. Get the genesis block hash (RPC getblockhash 0)
  2. Get the block with all transaction (RPC getblock <hash> 2, 2 stands for verbosity with transaction)
  3. Loop through all transactions and all its outputs, call gettxout <txid> <n> (where n is the outputs index)
  4. If gettxout returns an object, the output is unspent (UTXO), dump it to a text file

This may take a couple of hours or days (depending on your machine).

b) Fast way by patching Core (0.17.1)

  1. Change the code of the function call GetUTXOStats(), apply a text file dump in the utxo set loop (while (pcursor->Valid()) {)
  2. Compile
  3. Call RPC gettxoutsetinfo and let your added code dump data per UTXO to a file (or similar)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.