Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: old c coder on July 03, 2013, 03:45:21 AM



Title: You can have wallet.dat anywhere and with any name, now!
Post by: old c coder on July 03, 2013, 03:45:21 AM
Hello all,

I have been fighting GitHub and my ignorance, long and hard, but have finally won!

See
https://github.com/old-c-coder/bitcoin-git/commit/929019012dc7d93fd3ba59d8eb553e390211a713

If you can compile bitcoind &/or bitcoin-qt, you can have a wallet with any name, on any drive, in any directory. The wallet is not restricted to the name wallet.dat, nor is it tethered to the [data] directory.

Bitcoin-qt allows one to "backup" ones wallet to anywhere, with any name (not really! It doesn't allow names with no extension, at least on windows!). Now one can run from that back up wallet, or anywhere. The idea is that there is a new argument for bitcoin.conf or the command line, that names and locates what used to be wallet.dat only in the data directory.

For example, after exiting bitcoin, d or qt, one can copy ones wallet.dat to another location say drive x, path y and name z. One only has to add a line to bitcoin.conf, if you are using one, or an argument to the bitcoin program of -walletpath=x:/y/z, or in bitcoin.conf walletpath=x:/y/z

That's it. It can be a partial path, e.g. walletpath=y/z or a filename walletpath=z

If there is no walletpath argument, bitcoin behaves as before. Also if the argument is walletpath=wallet.dat it also behaves as before. This just makes explicit what was implicit before! This change then, if one doesn't use it doesn't 'disturb the force' :)

I have tested it successfully with all kinds of names, even with no extension, on various drives, in various directories. There is one proviso: the wallet file, whatever its name now, still has some "genetic" connection to a 1MB file called [data] directory/database/log.0000000001

I don't know their relationship, but I could probably move it with the wallet file if needed. This means that it would be prudent keep log.0000000001 in "sync" with one\'s wallet.

The advantage of separating the wallet from the now ~9.75GB block chain is that they can be on different drives or even computers!? Or one can have various, possibly test versions, of bitcoind or bitcoin-qt, and they can all share the same block chain, or can share the same wallet.

I have added the change to the 0.8.3 release source and it works there too.

All these changes have been on a windows unit, so I am curious about the other two platforms.

I haven't tried with coins in the wallet, but I see no problems:) Let me know if you like it, or have any questions.

Ron


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: b!z on July 03, 2013, 03:56:42 AM
Cool! Now we can have backups with different names, which makes sorting easier too.


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: ArpFlush on July 17, 2015, 09:01:21 AM
I tested this in a Testnet wallet, but without succes. Or will it only work on the mainnet?


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: InceptionCoin on July 17, 2015, 09:57:15 AM
Will you make pull request to bitcoin-core repository?


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: ArpFlush on July 17, 2015, 10:11:39 AM
Will you make pull request to bitcoin-core repository?
I would, if I could  ??? I'm a noob on github  :o


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: d4n13 on July 17, 2015, 06:13:10 PM
If you can compile bitcoind &/or bitcoin-qt, you can have a wallet with any name, on any drive, in any directory. The wallet is not restricted to the name wallet.dat, nor is it tethered to the [data] directory.

I had always thought that '-wallet' did that, but I guess not... Glad to hear it, and a damn good thing to protect against malicious code.

Renaming my wallet to 'KittyPicsToShareWithFriends.zip'.  
That'll teach 'em


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: unamis76 on July 17, 2015, 09:37:53 PM
This is very useful! I hope it will eventually get merged with the main code. Thank you :)


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: Amitabh S on July 19, 2015, 11:05:49 PM
I tested this in a Testnet wallet, but without succes. Or will it only work on the mainnet?

Can you answer this question? Great feature but does it work on testnet? I would not test a new wallet on mainnet.


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: 888coin on July 20, 2015, 07:17:16 AM
If you can compile bitcoind &/or bitcoin-qt, you can have a wallet with any name, on any drive, in any directory. The wallet is not restricted to the name wallet.dat, nor is it tethered to the [data] directory.

I had always thought that '-wallet' did that, but I guess not... Glad to hear it, and a damn good thing to protect against malicious code.

Renaming my wallet to 'KittyPicsToShareWithFriends.zip'.  
That'll teach 'em


Interesting and I gonna to try it out later today. This will make file management easier and it seems I won't need to manually change filenames by renaming anymore.   ;)


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: arnuschky on July 20, 2015, 03:42:32 PM

Reasons why not to do this are given in this issue: https://github.com/bitcoin/bitcoin/issues/68
The concerns regard corruption of the wallet due to improper locking.

Don't really understand what you mean with "married to LOG... file", though.


Title: Re: You can have wallet.dat anywhere and with any name, now!
Post by: gmaxwell on July 20, 2015, 09:12:16 PM
This is an inconsiderate bump of a very old thread.

Interesting and I gonna to try it out later today. This will make file management easier and it seems I won't need to manually change filenames by renaming anymore.   ;)

Bitcoin Core has had the ability to set the wallet file name with -wallet= for years. There is no need to rename files, and hasn't been a reason to do so for longer than your account here has existed.  You cannot change the path because if you split the BDB recovery logs and wallet file itself onto seperate media you will end up with irreparabile data corruption if there is an unclean power off with (un)reasonable probablity.