<p>Yes, by default bitcoinj downloads full blocks, from the Genesis. Only if you connect a wallet it uses optimizations like checkpoints and filters.</p>

<p>Just downloading the UTXO set (in a trust free way) isn't possible, because the Bitcoin protocol isn't designed for that. You can get UTXOs from block explorers and Electrum servers, but it will be without crypto proof.</p>

CC BY-SA 3.0
2017-05-29T20:56:04.400Z
How much time does it take currently with a i7 k7700 CPU and decent bandwidth?
Jus12
CC BY-SA 3.0
2017-05-29T10:09:47.733Z
2017-05-29T10:09:47.733Z
Andreas
<p>If you put aside the issues of trust, validation of the data, keeping it up to date and so on. If you just want a one-off snapshot for some academic purpose, you could ask a friend who uses Bitcoin Core to give you a copy of their <a href="https://en.bitcoin.it/wiki/Bitcoin_Core_0.11_(ch_2):_Data_Storage" rel="nofollow noreferrer">chainstate folder</a> - but you'd have to extract data from the <a href="https://bitcoin.stackexchange.com/q/28168/13866">LevelDB data structure</a>.</p>
<p>Other wallets such as Electrum might also have some persistent data storage that mainly consists of UTXO data.</p>

CC BY-SA 4.0
2022-11-04T16:59:11.363Z
2022-11-04T16:59:11.363Z
RedGrittyBrick
<p>As Andreas wrote, Just downloading the UTXO set (in a trust free way) isn't possible.  I would like it to be possible, and so I've thought about how to do it...</p>

<p>Each block identifies transactions from previous blocks that were in the UTXO set and are no longer in it and also fully specifies all the transactions that have been added to the UTXO set by the current block.  This means that IF you already have a full and verified UTXO set and someone wants to know if a UTXO set as of N blocks ago is valid, you can provide an answer.  Whether or not they trust you is a different issue.  If your set is valid, then you can undo the additions and subtractions of transactions as indicated by the N blocks, calculate a hash, and then send that hash to the other person.  If they get the same hash on their set, it's safe for them to assume that you used the same UTXO Set to get the hash that they used (ie., they match).</p>

<p>There may be software that can do this already.  I'd like that.  But there's no proof that either of you has the <strong>correct</strong> UTXO set.  I'd like to see that fixed for everyone, but it requires a little bootstrapping.  I have a plan for it:</p>

<ol>
<li>Create software that will render a SHA256 Hash into something that is memorable and unique.  This is a bit more complicated than it sounds.  Whatever the rendering produces (music, art, animation, a combination, ...) must have (at least) 256 distinct binary properties that will be easily remembered.  Anyone could use this software to see if the hash of the UTXO Set at a recent block height produces a memorable rendering.</li>
<li>Make it a thing that sometimes a memorable rendering is produced.  That can serve as a global checkpoint for the blockchain.  If enough people (judgement call) know about the memorable rendering, then new installations of full nodes could get (from anyone who has it) the UTXO set at that height, compute the hash, render it, and compare the result to the one everyone remembers. I imagine that would be readily available from around the Internet, but it's safer to talk to someone in real life to avoid the danger of Sybil attacks.</li>
<li>Update full node software to provide the UTXO Set as of a block the requesting node specifies (to mak.e the previous step possible for fresh installations)</li>
<li>Update the full node software to allow the user to specify a block height known to have produced a UTXO Set with a memorable hash, ask for the UTXO set as of that block from peers, create the rendering from the hash of the answer, and display it to the user.</li>
<li>Allow the user to indicate that the rendering matches and if the user so indicates, then skip downloading the blockchain (except for any parts that aren't included in the canonical UTXO set - if any) to save bandwidth and disk space, and just start with the UTXO set that came in as the answer.</li>
</ol>

<p>For the same reason that mined bitcoin that is less than 100 blocks deep cannot be spent (ie., a reorg of 100 blocks is unlikely - possibly not even supported?), this strategy allows us to proceed with a minimum of 100 blocks of history instead of the entire blockchain.</p>

<p>This places the responsibility of ensuring the integrity of the starting point UTXO set on the human being using the full node software.  It would have to be experimental for a while, until it proves that blocks zero through X are no longer necessary (because the UTXO set at block height X was memorable enough to be recognizable by mere humans using this new feature), thus reducing the blockchain requirement for an always-increasing amount of storage to an amount of storage that will presumably level off.</p>

<p>Part of the appeal to me of this idea is that the random SHA256 hash of a UTXO set can be rendered into something memorable, and the chances of that happening are low but not zero, just like mining itself.  Different rendering algorithms could compete.  I just thought of one...</p>

<p>The 256 bits of the hash plus the 32 bits of the block height could be used to indicate which cells in a 16x18 game of life are on.  Let the game of life run.  Watch it.  Remember how it stabilizes.  Some games will eventually clear the board.  That's memorable.  How it clears the board would also be memorable.</p>

<p>I started looking for a canonical UTXO set (ie., one whose structure is standardized, so that the same set of UTXOs would have the same representation as data).  Converting the SHA256 hash plus 32-bits of the block height into a Game of Life to see how it plays out can be pretty easily done with <a href="https://sourceforge.net/projects/golly/files/latest/download" rel="nofollow noreferrer">Golly</a> or any other software that implements John Conway's "Game of Life."</p>

<p>So I have the same quest as OP, but Andreas has a point. You have to run a full node and create it yourself.  However, once you've done that, you could possibly make it available to others (me!).  He also points out that there's no way to prove it's correct except by running a full node and repeating all the work of updating it for every transaction.  Proving the result is correct without all that work is the goal of the idea I present in this answer.</p>

CC BY-SA 4.0
2018-09-16T01:04:10.610Z
2018-09-16T01:04:10.610Z
Dave Scotese
<p>Take at a look at this program. It will dump the entire current UTXO database to a CSV file that you can crossreference.  <a href="https://github.com/in3rsha/bitcoin-utxo-dump" rel="nofollow noreferrer">https://github.com/in3rsha/bitcoin-utxo-dump</a></p>

CC BY-SA 4.0
2019-06-08T19:09:04.060Z
2019-06-08T19:09:04.060Z
davew
<p>@ Dave Scotese: I agree with your idea of having a generally agreed UTXO set (Not sure why u suggested running the resulting checkpoints hash into a game of life though). Anyway, I think the problem is not that it can't be done rather it comes down to consensus (very similar to the problem solved by blockchain itself). Suppose you did honestly used your algorithm and provided the world with a memorable hash that defines the UTXO set at some block height checkpoint which you place in some repo for download.
Now if Mr. A downloads it and checks using his own database and agrees with you.
You don't expect Mr. B to agree with you simply because Mr. A agrees.
You see, whoever needs to use this UTXO set needs to verify it for himself.
It still comes back to that Byzantine Generals problem which blockchain solved.
I honestly think for it to work, it has to run on its own separate blockchain so that UTXO set miners can mine it for some kind of financial gain.</p>
<p>And yes I completely agree with you that having such a UTXO set will solve the problem of having to download the entire blockchain before you can validate transactions.</p>

CC BY-SA 4.0
2022-01-31T11:43:51.773Z
2022-01-31T11:43:51.773Z
Mustapha Othman
<p>I am using bitcoinj to listen for payments. I need a way to maintain the entire UTXO set in a local database. </p>

<ol>
<li><p>Can bitcoinj be used to download every block (I think it downloads only recent blocks and headers for older blocks)?</p></li>
<li><p>I don't need to use bitcoinj or even Java for creating or maintaining this database if a better solution exists. Is there anything like this? </p></li>
</ol>

<p>Ideally what I want is a wallet that downloads only the UTXO set without downloading the entire blockchain (due to bandwidth limitations) and maintains it from then onward. This needs to be the entire set, not just for the addresses I own. 
Additionally I need an API that allows for following queries:</p>

<ol>
<li>Given a UTXO, check if it is present in the set.</li>
<li>Given an address, get me all the UTXOs for it.</li>
</ol>

<p>I think that it is currently not possible to validate a given UTXO set without downloading the entire blockchain, so some solution in this regard would also be appreciated. </p>

<blockchain><bitcoinj><utxo>
What is the best way to download a "recent" UTXO set snapshot?
Jus12
# What is the best way to download a "recent" UTXO set snapshot?

(Asked by: username_0 on 2017-05-28)

I am using bitcoinj to listen for payments. I need a way to maintain the entire UTXO set in a local database.

1. Can bitcoinj be used to download every block (I think it downloads only recent blocks and headers for older blocks)?
2. I don't need to use bitcoinj or even Java for creating or maintaining this database if a better solution exists. Is there anything like this?

Ideally what I want is a wallet that downloads only the UTXO set without downloading the entire blockchain (due to bandwidth limitations) and maintains it from then onward. This needs to be the entire set, not just for the addresses I own.
Additionally I need an API that allows for following queries:

1. Given a UTXO, check if it is present in the set.
2. Given an address, get me all the UTXOs for it.

I think that it is currently not possible to validate a given UTXO set without downloading the entire blockchain, so some solution in this regard would also be appreciated.

**Tags:** blockchain, bitcoinj, utxo


---

## 5 answers

### Answer by username_1 on 2017-05-29. Score: 2

Yes, by default bitcoinj downloads full blocks, from the Genesis. Only if you connect a wallet it uses optimizations like checkpoints and filters.

Just downloading the UTXO set (in a trust free way) isn't possible, because the Bitcoin protocol isn't designed for that. You can get UTXOs from block explorers and Electrum servers, but it will be without crypto proof.

> **Comments:**
> **username_0**: How much time does it take currently with a i7 k7700 CPU and decent bandwidth?  

---

### Answer by username_2 on 2022-11-04. Score: 1

If you put aside the issues of trust, validation of the data, keeping it up to date and so on. If you just want a one-off snapshot for some academic purpose, you could ask a friend who uses Bitcoin Core to give you a copy of their [chainstate folder](https://en.bitcoin.it/wiki/Bitcoin_Core_0.11_(ch_2):_Data_Storage) - but you'd have to extract data from the [LevelDB data structure](https://bitcoin.stackexchange.com/q/28168/13866).

Other wallets such as Electrum might also have some persistent data storage that mainly consists of UTXO data.


---

### Answer by username_3 on 2018-09-16. Score: 0

As username_1 wrote, Just downloading the UTXO set (in a trust free way) isn't possible. I would like it to be possible, and so I've thought about how to do it...

Each block identifies transactions from previous blocks that were in the UTXO set and are no longer in it and also fully specifies all the transactions that have been added to the UTXO set by the current block. This means that IF you already have a full and verified UTXO set and someone wants to know if a UTXO set as of N blocks ago is valid, you can provide an answer. Whether or not they trust you is a different issue. If your set is valid, then you can undo the additions and subtractions of transactions as indicated by the N blocks, calculate a hash, and then send that hash to the other person. If they get the same hash on their set, it's safe for them to assume that you used the same UTXO Set to get the hash that they used (ie., they match).

There may be software that can do this already. I'd like that. But there's no proof that either of you has the **correct** UTXO set. I'd like to see that fixed for everyone, but it requires a little bootstrapping. I have a plan for it:

1. Create software that will render a SHA256 Hash into something that is memorable and unique. This is a bit more complicated than it sounds. Whatever the rendering produces (music, art, animation, a combination, ...) must have (at least) 256 distinct binary properties that will be easily remembered. Anyone could use this software to see if the hash of the UTXO Set at a recent block height produces a memorable rendering.
2. Make it a thing that sometimes a memorable rendering is produced. That can serve as a global checkpoint for the blockchain. If enough people (judgement call) know about the memorable rendering, then new installations of full nodes could get (from anyone who has it) the UTXO set at that height, compute the hash, render it, and compare the result to the one everyone remembers. I imagine that would be readily available from around the Internet, but it's safer to talk to someone in real life to avoid the danger of Sybil attacks.
3. Update full node software to provide the UTXO Set as of a block the requesting node specifies (to mak.e the previous step possible for fresh installations)
4. Update the full node software to allow the user to specify a block height known to have produced a UTXO Set with a memorable hash, ask for the UTXO set as of that block from peers, create the rendering from the hash of the answer, and display it to the user.
5. Allow the user to indicate that the rendering matches and if the user so indicates, then skip downloading the blockchain (except for any parts that aren't included in the canonical UTXO set - if any) to save bandwidth and disk space, and just start with the UTXO set that came in as the answer.

For the same reason that mined bitcoin that is less than 100 blocks deep cannot be spent (ie., a reorg of 100 blocks is unlikely - possibly not even supported?), this strategy allows us to proceed with a minimum of 100 blocks of history instead of the entire blockchain.

This places the responsibility of ensuring the integrity of the starting point UTXO set on the human being using the full node software. It would have to be experimental for a while, until it proves that blocks zero through X are no longer necessary (because the UTXO set at block height X was memorable enough to be recognizable by mere humans using this new feature), thus reducing the blockchain requirement for an always-increasing amount of storage to an amount of storage that will presumably level off.

Part of the appeal to me of this idea is that the random SHA256 hash of a UTXO set can be rendered into something memorable, and the chances of that happening are low but not zero, just like mining itself. Different rendering algorithms could compete. I just thought of one...

The 256 bits of the hash plus the 32 bits of the block height could be used to indicate which cells in a 16x18 game of life are on. Let the game of life run. Watch it. Remember how it stabilizes. Some games will eventually clear the board. That's memorable. How it clears the board would also be memorable.

I started looking for a canonical UTXO set (ie., one whose structure is standardized, so that the same set of UTXOs would have the same representation as data). Converting the SHA256 hash plus 32-bits of the block height into a Game of Life to see how it plays out can be pretty easily done with [Golly](https://sourceforge.net/projects/golly/files/latest/download) or any other software that implements John Conway's "Game of Life."

So I have the same quest as OP, but username_1 has a point. You have to run a full node and create it yourself. However, once you've done that, you could possibly make it available to others (me!). He also points out that there's no way to prove it's correct except by running a full node and repeating all the work of updating it for every transaction. Proving the result is correct without all that work is the goal of the idea I present in this answer.


---

### Answer by username_4 on 2019-06-08. Score: 0

Take at a look at this program. It will dump the entire current UTXO database to a CSV file that you can crossreference. <https://github.com/in3rsha/bitcoin-utxo-dump>


---

### Answer by username_5 on 2022-01-31. Score: 0

@ username_3: I agree with your idea of having a generally agreed UTXO set (Not sure why u suggested running the resulting checkpoints hash into a game of life though). Anyway, I think the problem is not that it can't be done rather it comes down to consensus (very similar to the problem solved by blockchain itself). Suppose you did honestly used your algorithm and provided the world with a memorable hash that defines the UTXO set at some block height checkpoint which you place in some repo for download.
Now if Mr. A downloads it and checks using his own database and agrees with you.
You don't expect Mr. B to agree with you simply because Mr. A agrees.
You see, whoever needs to use this UTXO set needs to verify it for himself.
It still comes back to that Byzantine Generals problem which blockchain solved.
I honestly think for it to work, it has to run on its own separate blockchain so that UTXO set miners can mine it for some kind of financial gain.

And yes I completely agree with you that having such a UTXO set will solve the problem of having to download the entire blockchain before you can validate transactions.


---

