<p>The chainstate gets updated every time a new block gets added to (or deleted from) the chain, so you should be seeing it changing for every new block. However, updates are only seen on disk when a flush happens, which may not be after every block (added this last borrowing from @PieterWuille's comment)</p>
<p>If you're not, it may be the case that either:</p>
<ul>
<li>Your node is not running, or</li>
<li>You are grabbing data from a copy of the chainstate that does not match the one being used by your node</li>
</ul>
<p>I'd check either or both by checking the logs (<code>debug.log</code>). The folder that is being used should be reported in one of the first lines logged when running the node.</p>

CC BY-SA 4.0
2023-05-18T20:43:41.107Z
Updates to the chainstate are not immediately written to disk, though; only when a flush happens, which is not necessarily after every block (but I do believe it's at least once per day).
Pieter Wuille
CC BY-SA 4.0
2023-05-18T21:19:59.313Z
@PieterWuille a minor follow-up: Would it be possible to force a flush? I know some RPCs trigger it, like `gettxoutsetinfo`. But there's a way to make it directly? Or perhaps change how often it happens.
Davidson Souza
CC BY-SA 4.0
2023-05-18T19:38:44.173Z
2023-05-19T02:43:36.633Z
2023-05-19T02:43:36.633Z
sr_gi
<p>What i'm trying to do now is reading LevelDB at chainstate folder to save all utxos at my own DB, and keep tracking the changes of utxos by looking at chainstate folder frequently.</p>
<p>However, what i found is that it seem like chainstate folder didn't get any update for a week and utxo set stays the same.</p>
<p>Does chainstate folder get update? If so, when?</p>

CC BY-SA 4.0
2023-05-22T12:57:09.857Z
Hi Jin, I’m wondering whether this is an x-y-problem. It seems to me that the topic you are actually interested in might be “How can I keep an up-to-date database of the UTXO set”? If so, it might be useful to ask that question directly in another topic.
Murch
CC BY-SA 4.0
2023-05-24T01:28:44.320Z
That's correct! Thanks for your consideration.
Jin
<utxo><leveldb>
When does chainstate get updated?
Jin
# When does chainstate get updated?

(Asked by: username_0 on 2023-05-18)

What i'm trying to do now is reading LevelDB at chainstate folder to save all utxos at my own DB, and keep tracking the changes of utxos by looking at chainstate folder frequently.

However, what i found is that it seem like chainstate folder didn't get any update for a week and utxo set stays the same.

Does chainstate folder get update? If so, when?

**Tags:** utxo, leveldb

> **Comments:**
> **username_1**: Hi Jin, I’m wondering whether this is an x-y-problem. It seems to me that the topic you are actually interested in might be “How can I keep an up-to-date database of the UTXO set”? If so, it might be useful to ask that question directly in another topic.  
> **username_0**: That's correct! Thanks for your consideration.  

---

## 1 answers

### Answer by username_2 on 2023-05-18. Score: 2

The chainstate gets updated every time a new block gets added to (or deleted from) the chain, so you should be seeing it changing for every new block. However, updates are only seen on disk when a flush happens, which may not be after every block (added this last borrowing from @username_3's comment)

If you're not, it may be the case that either:

* Your node is not running, or
* You are grabbing data from a copy of the chainstate that does not match the one being used by your node

I'd check either or both by checking the logs (`debug.log`). The folder that is being used should be reported in one of the first lines logged when running the node.

> **Comments:**
> **username_3**: Updates to the chainstate are not immediately written to disk, though; only when a flush happens, which is not necessarily after every block (but I do believe it's at least once per day).  
> **username_4**: @username_3 a minor follow-up: Would it be possible to force a flush? I know some RPCs trigger it, like `gettxoutsetinfo`. But there's a way to make it directly? Or perhaps change how often it happens.  

---

