user43221: I know that UTXOs are stored in chainstate database.
But how can I get them in simple txt view? Not balances, but each UTXO.

user21282: https://github.com/in3rsha/bitcoin-utxo-dump seems to work well too, if you don't want to patch Bitcoin Core.
As per README, once you've fully synced the blockchain, quit the Bitcoin server and run:
sudo apt install libleveldb-dev
go get github.com/in3rsha/bitcoin-utxo-dump
bitcoin-utxo-dump -db /path/to/.bitcoin/chainstate/

This produces a large utxodump.csv file with about 8GB size (about 2x the chainstate/ directory size) in 14 minutes when I tried it, with format:
count,txid,vout,amount,type,address
1,033e83e3204b0cc28724e147f6fd140529b2537249f9c61c9de9972750030000,0,65279,p2pkh,1KaPHfvVWNZADup3Yc26SfVdkTDvvHySVX
2,e1c9467a885a156e56a29d9c854e65674d581ad75611b02290454b4862060000,1,9466355,p2pkh,1LpCmEejWLNfZigApMPwUY9nZTS8NTJCNS
3,a1f28c43f1f3d4821d0db42707737ea90616613099234f905dfc6ae2b4060000,1,339500,p2pkh,1FuphZ7xVPGrxthQT1S8X7nNQNByYxAT3V
4,818f5b9e3ede69da765d4c24684e813057c9b1f059e098661369b0a2ee060000,0,300000,p2pkh,18Y9yhjU9g2jjJmvaUy7TmUNZH9iPzQ4dd
5,d2f5e439152d076593a145581f8d76ea2e48ed155285b9a245cd42dd06070000,0,100000,p2pkh,1EKHTvovYWHfUJ6i9vsoidyTPQauCPH1qC
6,ea0c69fbd2389556b01771948ffc0507cf303bdc5a1b91b31acf9ecf6a070000,1,27668,p2pkh,1fkEhLpPKdmKtaxKdp4yDp1c87dF7GDub
7,05eafead65250a24b1592f8a006cbeab16a7b17ed2616507c5e0bd67bd070000,1,32000,p2pkh,15KmfJcGNfL29vpsSJ37uPzTQfr8Qe17Gq
8,2c0c985d384160d8c50c438bc67e639fe6047a7f2bac00a1238ca6a6d3070000,0,41936,p2pkh,17up1oPxBMTfZdehzy4v81KzLRHGDNX8ff
9,8261170b7ae26be70bd9e8f0e4bf19ce3571bb6464cdf9e478c471d372080000,1,4528208,p2pkh,1P6Ae7unrSjtx9J5SjWuwAdZBoWcbcjzBZ
...

Here's a quick script to import that CSV into sqlite3 which is more manageable:
echo | sqlite3 utxodump.sqlite3 \
-cmd 'CREATE TABLE utxo(
  count INT,
  txid CHAR(64),
  vout INT,
  amount INT,
  type CHAR(12),
  address CHAR(34)
)' \
-cmd 'CREATE UNIQUE INDEX utxo_txid_vout
  ON utxo(txid, vout);' \
-cmd '.mode csv' \
-cmd '.import utxodump.csv utxo'

I used that here BTW: https://github.com/cirosantilli/bitcoin-strings-with-txids/tree/7e95546479508e9fe5158dad6bc8601e2b4e02ee#utxo_nonstandard to try and find unspent puzzles that I might be able to solve, but I didn't :-(

user3697: 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 <hash> 2, 2 stands for verbosity with transaction)
Loop through all transactions and all its outputs, call gettxout <txid> <n> (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->Valid()) {)
Compile
Call RPC gettxoutsetinfo and let your added code dump data per UTXO to a file (or similar)


43221: <p>I know that UTXOs are stored in chainstate database.</p>
<p>But how can I get them in simple txt view? Not balances, but each UTXO.</p>
 21282: <p><a href="https://github.com/in3rsha/bitcoin-utxo-dump" rel="nofollow noreferrer">https://github.com/in3rsha/bitcoin-utxo-dump</a> seems to work well too, if you don't want to patch Bitcoin Core.</p>
<p>As per README, once you've fully synced the blockchain, quit the Bitcoin server and run:</p>
<pre><code>sudo apt install libleveldb-dev
go get github.com/in3rsha/bitcoin-utxo-dump
bitcoin-utxo-dump -db /path/to/.bitcoin/chainstate/
</code></pre>
<p>This produces a large <code>utxodump.csv</code> file with about 8GB size (about 2x the chainstate/ directory size) in 14 minutes when I tried it, with format:</p>
<pre><code>count,txid,vout,amount,type,address
1,033e83e3204b0cc28724e147f6fd140529b2537249f9c61c9de9972750030000,0,65279,p2pkh,1KaPHfvVWNZADup3Yc26SfVdkTDvvHySVX
2,e1c9467a885a156e56a29d9c854e65674d581ad75611b02290454b4862060000,1,9466355,p2pkh,1LpCmEejWLNfZigApMPwUY9nZTS8NTJCNS
3,a1f28c43f1f3d4821d0db42707737ea90616613099234f905dfc6ae2b4060000,1,339500,p2pkh,1FuphZ7xVPGrxthQT1S8X7nNQNByYxAT3V
4,818f5b9e3ede69da765d4c24684e813057c9b1f059e098661369b0a2ee060000,0,300000,p2pkh,18Y9yhjU9g2jjJmvaUy7TmUNZH9iPzQ4dd
5,d2f5e439152d076593a145581f8d76ea2e48ed155285b9a245cd42dd06070000,0,100000,p2pkh,1EKHTvovYWHfUJ6i9vsoidyTPQauCPH1qC
6,ea0c69fbd2389556b01771948ffc0507cf303bdc5a1b91b31acf9ecf6a070000,1,27668,p2pkh,1fkEhLpPKdmKtaxKdp4yDp1c87dF7GDub
7,05eafead65250a24b1592f8a006cbeab16a7b17ed2616507c5e0bd67bd070000,1,32000,p2pkh,15KmfJcGNfL29vpsSJ37uPzTQfr8Qe17Gq
8,2c0c985d384160d8c50c438bc67e639fe6047a7f2bac00a1238ca6a6d3070000,0,41936,p2pkh,17up1oPxBMTfZdehzy4v81KzLRHGDNX8ff
9,8261170b7ae26be70bd9e8f0e4bf19ce3571bb6464cdf9e478c471d372080000,1,4528208,p2pkh,1P6Ae7unrSjtx9J5SjWuwAdZBoWcbcjzBZ
...
</code></pre>
<p>Here's a quick script to import that CSV into sqlite3 which is more manageable:</p>
<pre><code>echo | sqlite3 utxodump.sqlite3 \
-cmd 'CREATE TABLE utxo(
  count INT,
  txid CHAR(64),
  vout INT,
  amount INT,
  type CHAR(12),
  address CHAR(34)
)' \
-cmd 'CREATE UNIQUE INDEX utxo_txid_vout
  ON utxo(txid, vout);' \
-cmd '.mode csv' \
-cmd '.import utxodump.csv utxo'
</code></pre>
<p>I used that here BTW: <a href="https://github.com/cirosantilli/bitcoin-strings-with-txids/tree/7e95546479508e9fe5158dad6bc8601e2b4e02ee#utxo_nonstandard" rel="nofollow noreferrer">https://github.com/cirosantilli/bitcoin-strings-with-txids/tree/7e95546479508e9fe5158dad6bc8601e2b4e02ee#utxo_nonstandard</a> to try and find unspent puzzles that I might be able to solve, but I didn't :-(</p>
 3697: <p>With vanilla Bitcoin Core, there is no efficient way to do this.</p>

<p>I see two options:</p>

<h3>a) Slow and very inefficient RPC loop (not recommended)</h3>

<ol>
<li>Get the genesis block hash (RPC <code>getblockhash 0</code>)</li>
<li>Get the block with all transaction (RPC <code>getblock &lt;hash&gt; 2</code>, <em>2 stands for verbosity with transaction</em>)</li>
<li>Loop through all transactions and all its outputs, call <code>gettxout &lt;txid&gt; &lt;n&gt;</code> (<em>where <code>n</code> is the outputs index</em>)</li>
<li>If <code>gettxout</code> returns an object, the output is unspent (UTXO), dump it to a text file</li>
</ol>

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

<h3>b) Fast way by patching Core (0.17.1)</h3>

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