How to find all UTXOs? 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)


Get the genesis block hash (RPC getblockhash 0)
Get the block with all transaction (RPC getblock &lt;hash&gt; 2, 2 stands for verbosity with transaction)
Loop through all transactions and all its outputs, call gettxout &lt;txid&gt; &lt;n&gt; (where n is the outputs index)
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)


Change the code of the function call GetUTXOStats(), apply a text file dump in the utxo set loop (while (pcursor-&gt;Valid()) {)
Compile
Call RPC gettxoutsetinfo and let your added code dump data per UTXO to a file (or similar)