Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Steve on May 07, 2012, 04:33:53 PM



Title: sharing block chain
Post by: Steve on May 07, 2012, 04:33:53 PM
Is there any way with the current Bitcoin-Qt client to share the block chain with multiple wallets?  Ideally I'd like to be able to do that when the multiple wallets are running concurrently.  From looking at the directory structures, about the only way I can see is if you swap out wallet.dat with the desired wallet when you start it up.  I now have about 5 copies of the block chain on my computer…I'm looking for options to consolidate around a single copy of the block chain.

I'd love it if the wallet functions and the client functions could be separated into two different processes.  Another way of solving it would be to enhance the Bitcoin-Qt such that it could manage multiple wallets (even just a feature to open a different wallet.dat file from the file system).


Title: Re: sharing block chain
Post by: deepceleron on May 07, 2012, 05:38:21 PM
Is there any way with the current Bitcoin-Qt client to share the block chain with multiple wallets?  Ideally I'd like to be able to do that when the multiple wallets are running concurrently.  From looking at the directory structures, about the only way I can see is if you swap out wallet.dat with the desired wallet when you start it up.  I now have about 5 copies of the block chain on my computer…I'm looking for options to consolidate around a single copy of the block chain.

I'd love it if the wallet functions and the client functions could be separated into two different processes.  Another way of solving it would be to enhance the Bitcoin-Qt such that it could manage multiple wallets (even just a feature to open a different wallet.dat file from the file system).

In multiple --datadirs you can make a symbolic link to a central blockchain dat and idx file, as long as you don't attempt to run multiple instances of Bitcoin. This may result in transactions being missed, but I believe that one of the recent features added to Bitcoin for wallets to store a "last block seen" pointer so it can rescan from that point if a fully updated blockchain is used will mitigate this (this feature is also useful when restoring wallet backups, etc).

Each copy of Bitcoin would try to open the blockchain file and write to it and update blocks; running multiple Bitcoins accessing the same database file at the same time is not going to work. It is possible to have multiple users access one Berkeley database, but Bitcoin is not going to be aware of other Bitcoin client's write activities, and for the scale of rewrite to support this you might as well just write a multiple-wallet-supporting Bitcoin.


Title: Re: sharing block chain
Post by: MoonShadow on May 07, 2012, 05:47:12 PM
The actual blockchain can be shared in a number of different ways, but the database cannot be shared among multiple instances of bitcoind.  On way to make this work on a unix machine is to create read-only symlinks for user level bitcoin daemons that have their own database inside their own shell account, but this would result in massive duplication of work.  Windoze can do it using similar methods over network drives.  I don't think that a multi-user version of bitcoind has been created, but if it has I would doubt that it was safe.


Title: Re: sharing block chain
Post by: etotheipi on May 07, 2012, 08:24:22 PM
Is there any way with the current Bitcoin-Qt client to share the block chain with multiple wallets?  Ideally I'd like to be able to do that when the multiple wallets are running concurrently.  From looking at the directory structures, about the only way I can see is if you swap out wallet.dat with the desired wallet when you start it up.  I now have about 5 copies of the block chain on my computer…I'm looking for options to consolidate around a single copy of the block chain.

I'd love it if the wallet functions and the client functions could be separated into two different processes.  Another way of solving it would be to enhance the Bitcoin-Qt such that it could manage multiple wallets (even just a feature to open a different wallet.dat file from the file system).

This is one reason why alternative clients have come about ...  (http://bitcoinarmory.com/) :)


Title: Re: sharing block chain
Post by: lazyranma on May 08, 2012, 07:52:59 PM
On btrfs filesystem you can copy data directory with 'cp --reflink'. It will create shared copy-on-write snapshot of data, which can be safely used simultaneously by multiple clients. But new block will be stored separately by each client, so you need to overwrite other copies again with 'cp --reflink' from time to time.


Title: Re: sharing block chain
Post by: Steve on May 09, 2012, 04:24:23 AM
On btrfs filesystem you can copy data directory with 'cp --reflink'. It will create shared copy-on-write snapshot of data, which can be safely used simultaneously by multiple clients. But new block will be stored separately by each client, so you need to overwrite other copies again with 'cp --reflink' from time to time.
Excellent…I hadn't heard of btrfs until now, but see that it offers similar capabilities to zfs.  I'll have to check it out.