Separate wallets sharing the same blockchain?

6

3

Since the blockchain is such a large file, I'd like to have more than 1 account on the same computer share it. Is that possible?

RentFree

Posted 2013-05-09T12:17:31.410

Reputation: 2 391

1Not a duplicate: sharing it among different users will present more problems than just moving the directory.o0'. 2013-05-10T15:10:34.113

Answers

5

The most straightforward way to do this with Bitcoin-Qt/bitcoind (at this moment) is to swap the wallet.dat in your bitcoin data directory when the client is not running.

Another method (if you're on a UNIX-ish OS) is to create multiple data directories, then symbolic link (ln -s) the blocks and chainstate directories (not database) inside your datadirs to a common data dir.

mkdir ~/.bitcoin-alt  # new wallet directory
cd ~/.bitcoin-alt
ln -s ~/.bitcoin/blocks ~/.bitcoin/chainstate .
# launch new wallet
bitcoin-qt -datadir=$HOME/.bitcoin-alt

Then you can leave the wallet.dat alone. When launching you can specify a -datadir based on the wallet that you want to use, and it will share the blockchain dirs.

However even with this solution cannot run two bitcoind/bitcoin-qt instances at the same time sharing the block chain! This is currently not possible and will result in corruption if you try.

wumpus

Posted 2013-05-09T12:17:31.410

Reputation: 311

3You can also create hard links on Windows if you're using NTFS. I used one to put my Bitcoin directory on a separate drive.julian-goldsmith 2013-05-09T14:58:54.520

2You cannot use hardlinks to span drives. You probably meant junctions (symlinks) which will span local drives via reparse points.adam 2014-05-06T21:58:29.790

These days, won't that trigger a lengthy rescan every time you switch between wallets? Does the automatic rescan only go through new blocks created since the last one the wallet witnessed?

rkagerer 2016-10-15T20:08:21.770

It will have to scan the span of blocks between when the wallet was last used and now. There's only a problem in case the block chain is pruned and doesn't have those blocks anymore, in which case it currently has to redownload from the beginning (this is not a protocol limitation, but re-downloading other ranges of blocks is not implemented as of now).wumpus 2016-10-17T07:50:38.213