One of the biggest upgrades in the recent Chia Blockchain 1.3 beta that was just released is the ability to upgrade the v1 Chia Database to v2. The promise here was pretty extreme with Chia promising “approximately 45%” space reduction. That’s quite the promise, so let’s see if it holds up.
First, don’t do this on your main farming rig. I have no idea what edge cases might cause catastrophic issues. But for those willing to take the risk, the process is pretty simple. Just open up a terminal or command prompt, navigate to your Chia CLI in ~\chia-blockchain\app-1.2.12269\resources\app.asar.unpacked\daemon (Windows) and type out chia db upgrade. That will kick it off.
The process is very IO intensive, but not particularly hard on the CPU or memory. It runs while your farming runs and didn’t seem to cause any issues for me. I am having an unrelated issue due to the upgrade involving my plot NFTs not getting picked up properly, but that was not related to the DB upgrade. It didn’t fix it either though.
The process took about 37 minutes total and when it was done it left both DB images, so you will have to manually clean up. It runs over 5 phases, each copying a specific section of the database. And what are the results? See for yourself.
Its about 45%. The process reduced my DB from just under 50GB to just under 27GB. This is fantastic and makes farming to small single board computers like the Raspberry Pi possible again. I haven’t made any performance measurements so I have no idea if the new database format lives up to the modest improvements yet, but we should see soon if my farm is out of sync constantly. But I doubt it. Great work, Chia Network.
What is the relation of this smaller Chia v2 database and the BlueBox compression project? They both aim at smaller DB files, right?
I got the latest chia version on Ubuntu (1.2.12.dev1+gf2a334efb), but when I try to use command to convert database to new version, I got Error: No such command ‘db’. What can I do?
You need version 1.3 currently in Beta.
What changes need to be made to config.yaml for the wallet after the chia db upgrade? it still points to v1
I’ve changed it to v2 for wallet as well. I’m not sure, if it is necessary though.
My database upgrade took “forever”… Over 24 hours!
I upgrade directly on my farming machine which is a Raspberry Pi 4 with 4GB RAM, an SSD for the Chia database and 4GB swap space on the SSD.
Not sure why it took so much longer than yours but in the end it finished… Farming in parallel went smoothly the whole time (no stale partials), except around 1 hour before the end where my farmer suddenly went offline.
For anyone interessted, here is my upgrade log:
opening file for reading: /mnt/ssd/.chia/mainnet/db/blockchain_v1_mainnet.sqlite
opening file for writing: /mnt/ssd/.chia/mainnet/db/blockchain_v2_mainnet.sqlite
initializing v2 version
initializing v2 block store
peak: ca4351781d8b28e784e4d0dacdd994c505e93602a6d93e3dc6d9dbd7e62ea862 height: 1707861
[1/5] converting full_blocks
5791.56 seconds
[2/5] converting sub_epoch_segments_v3
499.42 seconds
[3/5] converting hint_store
350.51 seconds
[4/5] converting coin_store
77411.60 seconds
[5/5] build indices
block store
coin store
hint store
4854.99 seconds
updating config.yaml
database_path: db/blockchain_v2_CHALLENGE.sqlite
LEAVING PREVIOUS DB FILE UNTOUCHED /mnt/ssd/.chia/mainnet/db/blockchain_v1_mainnet.sqlite
Bless you for posting this in a format that is not a Youtube video. I do not need a bloody video to tell me how to run one command. You have a new fan and follower.
When you say you’ll have to manually clean up, could you elaborate? Is is just deleting the one file (blockchain_v1_mainnet.sqlite)?
You can actually delete two files, one db/blockchain_v1_mainnet.sqlite and second one wallet/db/blockchain_wallet_v1_mainnet_xxxxxx.sqlite.
Could you please advise how to upgrate db on Mac?
How is your new database so small? Mine was about 105 GB probably partially because it was so old it had some garbage in it. So I deleted the database and wallet directory in my installation and then restarted the client, running 1.3.3. It then rebuilt the database in 3 days. Now the database file size is about 65 gb. How is yours so much smaller than mine? Granted this article was written a few weeks ago so obviously yours is larger now but not that big??
I mean your article was written 2 months ago, but still.
because he is using V2 update your database it will be half the size at least