Zcashd database question

Hello, i have a question regarding the zcashd database files.

Last week i had to resync my zcashd to get lightwalletd functionality, i used a command as the following to do so:

    ./src/zcashd -datadir=/media/oxarbitrage/4eb53770-4e4f-4d80-a830-0914f3f5b89a/chain/zcash -experimentalfeatures -lightwalletd -reindex

This worked for me, i can now query z_getsubtreesbyindex as i wanted.

The problem i am facing now is that i have a blockchain folder twice the blockchain size:

    oxarbitrage@oxarbitrage:/media/oxarbitrage/4eb53770-4e4f-4d80-a830-0914f3f5b89a/chain/zcash/blocks$ du -h
    27G        ./index
    502G        .
    oxarbitrage@oxarbitrage:/media/oxarbitrage/4eb53770-4e4f-4d80-a830-0914f3f5b89a/chain/zcash/blocks$  

I have very old data files in my HD, a lot older than the ones created after the resync files:

    oxarbitrage@oxarbitrage:/media/oxarbitrage/4eb53770-4e4f-4d80-a830-0914f3f5b89a/chain/zcash/blocks$ ls -lh
    total 476G
    -rw------- 1 oxarbitrage oxarbitrage  128M Aug 17  2022 blk00000.dat
    -rw------- 1 oxarbitrage oxarbitrage  128M Aug 17  2022 blk00001.dat
    -rw------- 1 oxarbitrage oxarbitrage  128M Aug 17  2022 blk00002.dat
    ...

Can i just safely delete those files ? I am asking before taking any action as i will not want to be a week more for a new sync after i finally got it working but i also need to make some space.

Any help is appreciated. I posted here in the forum as i think this could also benefit others in a similar situation at some point.

1 Like

I believe this is because the -lightwalletd flag also flags the -txindex option for the ‘getrawtransaction’ call and that historically creates a very large database file. zcash/doc/man/zcashd.1

2 Likes

The large disk space usage with -experimentalfeatures -lightwalletd is expected for the reason @Autotunafish said.

I don’t know, sorry. However, it should be safe to stop zcashd, move them aside and restart (remember to use -experimentalfeatures -lightwalletd but not -reindex). If zcashd needs to access those files, it will crash during LoadBlockIndex. You can tell when LoadBlockIndex has finished because "block index " followed by a time in milliseconds will be logged afterward. At that point it should be ok to delete the files that you moved aside.

2 Likes

Will try @daira suggestion and report soon, thank you both.

2 Likes

An oldy but a goody! You can move the older files as @daira mentioned but be careful to not mix these databases per those conf flags, as it will cause the full node to not function. I dealt with this many times and if possible you should make golden back up now that the chain is so large. Also pay attention to */chainstate that exists on the /blocks dir.

2 Likes

Yea, so i moved just a few of the older files to a backup directory just to try and i unfortunately got the error:

Messages:
- : Error loading block database.
Please restart with -reindex to recover.

So i moved them back and i restarted without problems. Ill better leave that alone and try to get more room instead.

2 Likes

Glad that advice worked as intended! Sympathy for your disk space issue.

2 Likes