<p>There is already a pool with the information that you are willing to build: <code>the UTXO set</code>. You can access it by querying the LevelDB located in <code>.bitcoin/chainstate</code> of a full node.</p>

<p>However, there is no easy way of doing so by using RPC commands, you should extract the information by yourself. </p>

<p>I can provide a way to do so if you needed, and an extensive explanation of what are you going to find in each entry of the LevelDB.</p>

CC BY-SA 3.0
2017-04-14T01:38:28.300Z
`chainstate` is only the index of full chain
Denis Leonov
CC BY-SA 3.0
2017-04-14T13:36:12.450Z
In the chainstate you can find all the data you may need to know about the UTXOs, such as the id, out index, amount, scriptPubKey, block in which it has been included,  and whether it is coinbase or not.
sr_gi
CC BY-SA 3.0
2017-04-14T13:49:57.453Z
So could you tell about '*.ldb' file format?
Denis Leonov
CC BY-SA 3.0
2017-04-14T16:05:12.090Z
Sure, you can check this answer: https://bitcoin.stackexchange.com/a/52167/30668
sr_gi
CC BY-SA 3.0
2017-03-12T19:13:03.697Z
2017-03-12T19:13:03.697Z
sr_gi
<p>You can directly get UTXO set from bitcoind using <code>listunspent</code> RPC call.</p>

CC BY-SA 3.0
2018-01-09T09:00:26.967Z
Only for UTXOs that are yours (or otherwise contribute to your own wallet's balance).
Pieter Wuille
CC BY-SA 3.0
2017-07-02T21:14:03.027Z
2018-01-09T07:29:25.737Z
2018-01-09T07:29:25.737Z
Vivek Teega
<p>There is no simple way to get what you want except that way you try to describe.</p>

<p>RPC did not support any command of what you want.</p>

<p>If you need UTXOs, you must disassemble every <code>*.dat</code> binary file in series from the first and keep each output for checking on spending in future.</p>

CC BY-SA 3.0
2017-04-12T09:26:34.283Z
Sorry but not true, what @Matt is willing to build is already part of the Bitcoin core client, he just need to check the UTXO set. It is indeed no easy to access, since there is no RPC command available, so he would need to access the LevelDB stores in /chainstate and most likely code his own parser. However, it is way easier than disassembling every .dat file and checking when every UTXO has been spend over the years.
sr_gi
CC BY-SA 4.0
2018-06-02T03:34:40.023Z
@sr-gi I made it without of any client. UTXO database from raw dat files.
Denis Leonov
CC BY-SA 3.0
2017-02-06T08:49:59.510Z
2017-04-12T02:26:20.083Z
2017-04-12T02:26:20.083Z
Denis Leonov
<p>The following worked for me on a Bash command window:</p>

<p>curl <a href="https://blockchain.info/unspent?active=place_bitcoin_address_here" rel="nofollow noreferrer">https://blockchain.info/unspent?active=place_bitcoin_address_here</a></p>

CC BY-SA 3.0
2018-03-11T18:50:23.473Z
2018-03-11T18:50:23.473Z
user78644
<p>I have already built the utxo set parser but I need to know when the leveldb records is updated. I need something like cursor that will let me be aware if anything has changed on the network.</p>

CC BY-SA 4.0
2023-10-21T07:04:23.923Z
If you have a new question, please ask it by clicking the [Ask Question](https://bitcoin.stackexchange.com/questions/ask) button. Include a link to this question if it helps provide context. - [From Review](/review/late-answers/90762)
Saxtheowl
CC BY-SA 4.0
2023-10-22T12:58:14.497Z
If you have a new question, please ask it by clicking the [Ask Question](https://bitcoin.stackexchange.com/questions/ask) button. Include a link to this question if it helps provide context.
Hannah Vernon
CC BY-SA 4.0
2023-10-21T01:20:50.733Z
2023-10-21T01:20:50.733Z
Topman
<p>I might be over thinking this, but I'm trying to figure out the best way to build an unspent output pool. Should I just naively parse every block? Every input gets removed from the hash set, and every output gets added back in? Seems terribly inefficient. The thing is it doesn't seem like there is anyway to accurately build this utxo pool without traversing the block chain at least once and constructing it. Is there a well defined short-cut I should be aware of? Pointers welcome.</p>

<p>I guess I can iterate through the on-disk blocks first, and then update as blocks come in.</p>

CC BY-SA 3.0
2014-06-03T05:15:08.473Z
That doesn't sound inefficient at all. What seems inefficient about it to you?
David Schwartz
CC BY-SA 3.0
2014-06-03T14:42:52.147Z
I think I was just thinking that there might be a more efficient way. I thought the official client stored the  utxo pool in some kind of tree structure, just trying to get more insight into this.
Matt
CC BY-SA 3.0
2014-06-03T21:06:55.990Z
You can just use RPC to get the unspent outputs pool straight from bitcoind.
user13413
CC BY-SA 3.0
2014-07-21T22:20:47.027Z
@goatse Which command?
T9b
CC BY-SA 4.0
2022-01-01T16:24:03.173Z
GREAT question.  This is exactly the kind of details the BITS don't think are important and most do not understand themselves. bitcoin.org labelled bitcoin core as experimental. If the UTXO pool ever got out of sync with with the ledger even if just one SAT there is no central authority to initiate a recovery.
Richard
<transactions><blockchain><utxo>
How to find utxo?
Matt
# How to find utxo?

(Asked by: username_0 on 2014-06-02)

I might be over thinking this, but I'm trying to figure out the best way to build an unspent output pool. Should I just naively parse every block? Every input gets removed from the hash set, and every output gets added back in? Seems terribly inefficient. The thing is it doesn't seem like there is anyway to accurately build this utxo pool without traversing the block chain at least once and constructing it. Is there a well defined short-cut I should be aware of? Pointers welcome.

I guess I can iterate through the on-disk blocks first, and then update as blocks come in.

**Tags:** transactions, blockchain, utxo

> **Comments:**
> **username_1**: That doesn't sound inefficient at all. What seems inefficient about it to you?  
> **username_0**: I think I was just thinking that there might be a more efficient way. I thought the official client stored the  utxo pool in some kind of tree structure, just trying to get more insight into this.  
> **username_2**: You can just use RPC to get the unspent outputs pool straight from bitcoind.  
> **username_3**: @goatse Which command?  
> **username_4**: GREAT question.  This is exactly the kind of details the BITS don't think are important and most do not understand themselves. bitcoin.org labelled bitcoin core as experimental. If the UTXO pool ever got out of sync with with the ledger even if just one SAT there is no central authority to initiate a recovery.  

---

## 5 answers

### Answer by username_5 on 2017-03-12. Score: 4

There is already a pool with the information that you are willing to build: `the UTXO set`. You can access it by querying the LevelDB located in `.bitcoin/chainstate` of a full node.

However, there is no easy way of doing so by using RPC commands, you should extract the information by yourself.

I can provide a way to do so if you needed, and an extensive explanation of what are you going to find in each entry of the LevelDB.

> **Comments:**
> **username_6**: `chainstate` is only the index of full chain  
> **username_5**: In the chainstate you can find all the data you may need to know about the UTXOs, such as the id, out index, amount, scriptPubKey, block in which it has been included,  and whether it is coinbase or not.  
> **username_6**: So could you tell about '*.ldb' file format?  
> **username_5**: Sure, you can check this answer: https://bitcoin.stackexchange.com/a/52167/30668  

---

### Answer by username_7 on 2017-07-02. Score: 3

You can directly get UTXO set from bitcoind using `listunspent` RPC call.

> **Comments:**
> **username_8**: Only for UTXOs that are yours (or otherwise contribute to your own wallet's balance).  

---

### Answer by username_6 on 2017-02-06. Score: 0

There is no simple way to get what you want except that way you try to describe.

RPC did not support any command of what you want.

If you need UTXOs, you must disassemble every `*.dat` binary file in series from the first and keep each output for checking on spending in future.

> **Comments:**
> **username_5**: Sorry but not true, what @username_0 is willing to build is already part of the Bitcoin core client, he just need to check the UTXO set. It is indeed no easy to access, since there is no RPC command available, so he would need to access the LevelDB stores in /chainstate and most likely code his own parser. However, it is way easier than disassembling every .dat file and checking when every UTXO has been spend over the years.  
> **username_6**: @username_5 I made it without of any client. UTXO database from raw dat files.  

---

### Answer by username_9 on 2018-03-11. Score: 0

The following worked for me on a Bash command window:

curl <https://blockchain.info/unspent?active=place_bitcoin_address_here>


---

### Answer by username_10 on 2023-10-21. Score: 0

I have already built the utxo set parser but I need to know when the leveldb records is updated. I need something like cursor that will let me be aware if anything has changed on the network.

> **Comments:**
> **username_11**: If you have a new question, please ask it by clicking the [Ask Question](https://bitcoin.stackexchange.com/questions/ask) button. Include a link to this question if it helps provide context. - [From Review](/review/late-answers/90762)  
> **username_12**: If you have a new question, please ask it by clicking the [Ask Question](https://bitcoin.stackexchange.com/questions/ask) button. Include a link to this question if it helps provide context.  

---

