Re: auto backing up of wallet.dat

So, as many others, I need to backup wallet.dat. And since this one is on a server, I need it to happen unattended. And because this server is being used by the lottery, I must not shutdown bitcoind.

So far I just copy the file over, and do it often so I can outlive one corrupted file. But this is not ideal, as I should backup after every transaction (sent, right? no new addresses are created on receiving a transfer ) or after everytime I create a new address.

For that I thought about instead of copying the file I could use db_dump to dump it’s contents, using the -r flag just in case. Would that work?

The ideal solution would be an rpc call that would either:
– flush and lock updates until a new rpc call (any call, didn’t need to be an unlock command) would come over
– flush and cp wallet.dat to a side file
– flush and dump through jsonrpc. If each key would come separate in an array, we could then call this with ‘lastseen=X’ to just get new keys

Could this work? Which would work best?

I started posting in the other topic but I’ll repeat here, this thread seems more specific to the topic.

The main backup improvement will be a pre-generated pool of keys and a rescan at load to scrape missed transactions from the block history.  Then a backup will last forward for a long time.

I was starting to post the same idea you said nelisky.

How about a json-rpc command that locks the wallet, flushes it, copies wallet.dat to a location you specified, then unlocks it?  That would be a smaller project than the pooled keys, so maybe it could be done first.

What’s the simplest portable way to copy a file?  Is there something in Boost?

What should it be named?  maybe:
backupwallet <destination>

71,093 total views, 56 views today

https://bitcointalk.org/index.php?topic=921.msg11228#msg11228