Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: BoyFromDubai on December 11, 2022, 03:39:14 PM



Title: Are UTXOs stored in a file?
Post by: BoyFromDubai on December 11, 2022, 03:39:14 PM
Are UTXOs stored in memory or RAM? Or how they are stored? And if so, what kind of a file it is?


Title: Re: Are UTXOs stored in a file?
Post by: Charles-Tim on December 11, 2022, 04:01:14 PM
UTXOs are bitcoin which can be spent and transferred to another address using the corresponding private key that generates the address. Bitcoin is stored on blockchain.


Title: Re: Are UTXOs stored in a file?
Post by: BoyFromDubai on December 11, 2022, 04:19:12 PM
I know that, but the question is "Are utxos stored in hard disk and after any transaction Bitcoin Core reads information from the file? Or after every single launch of Bitcoin Core it collects all UTXOs for the private key and stores in in RAM?"


Title: Re: Are UTXOs stored in a file?
Post by: j2002ba2 on December 11, 2022, 04:38:49 PM
UTXO are stored in chainstate subdirectory, which is a LevelDB database, currently ~4.8GB.

One could control how much of it is cached by the command line parameter "-dbcache". It might be useful to make it high enough during IBD (initial block download). Note that high dbcache leads to slow shutdown of Bitcoin Core. Other than during IBD, AFAIK, high dbcache is useless.

There are no private keys in UTXO. Or if there ever were, it's all gone.



Title: Re: Are UTXOs stored in a file?
Post by: BoyFromDubai on December 11, 2022, 04:57:03 PM
I know about chainstate and leveldb in it. There are all UTXOs of all members of Bitcoin network. But if I would like to get my own UTXOs, the request goes to the same leveldb for checking all of the UTXOs in there to get my own or are my own UTXOs somewhere else in a file maybe or second leveldb or smth like this?


Title: Re: Are UTXOs stored in a file?
Post by: achow101 on December 11, 2022, 05:42:17 PM
If you are using Bitcoin Core's wallet, your own UTXOs are stored in your own wallet file, next to your keys.


Title: Re: Are UTXOs stored in a file?
Post by: BoyFromDubai on December 11, 2022, 05:54:49 PM
Okey, thank you  a lot!