Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: Zz on October 23, 2016, 08:40:04 PM



Title: howto share .bitcoin/blocks directory
Post by: Zz on October 23, 2016, 08:40:04 PM
Hello,
We use the same computer 3 people
3 shell accounts;
user1@kutaypc : /home/user1/.bitcoin
user2@kutaypc : /home/user2/.bitcoin
user3@kutaypc : /home/user1/.bitcoin

we have jointly directory ~/.bitcoin/blocks

our setup :

add bitcoiners group
users add bitcoiners group
mkdir /home/blocks
chown root:bitcoiners /usr/bin/bitcoind
chown root:bitcoiners /usr/bin/bitcoin-qt
ln -fs /home/blocks /root/.bitcoin/blocks
run bitcoind -daemon
control debug.log bitcoind is fine!

and switch user1
echo "listen=0" > /home/user1/.bitcoin/bitcoin.conf

and run second bitcoind at user1 account. works fine.
stop bitcoind
rm -rf /home/user1/.bitcoin/blocks
ln -fs /home/blocks /home/user1/blocks
newgrp bticoiners (switch to bitcoiners group)
and run second bitcoind at user1 account.

program crashed!

any solutions ?


Title: Re: howto share .bitcoin/blocks directory
Post by: achow101 on October 23, 2016, 08:42:06 PM
Multiple instances of Bitcoin Core on the same computer cannot share the same blocks (or data directory) folder. They will run into simultaneous write issues and corrupt the data on the disk.


Title: Re: howto share .bitcoin/blocks directory
Post by: Zz on October 23, 2016, 08:46:35 PM
Multiple instances of Bitcoin Core on the same computer cannot share the same blocks (or data directory) folder. They will run into simultaneous write issues and corrupt the data on the disk.

Well,
exchanges or web wallets are how it works?


Title: Re: howto share .bitcoin/blocks directory
Post by: achow101 on October 23, 2016, 08:48:18 PM
Multiple instances of Bitcoin Core on the same computer cannot share the same blocks (or data directory) folder. They will run into simultaneous write issues and corrupt the data on the disk.

Well,
exchanges or web wallets are how it works?
They are probably not using Bitcoin Core and are probably using a proprietary system which allows them to have multiple wallets on the same instance of the software. Or they are using Bitcoin Core for purely the P2P part (not the wallet) and using an external wallet software which can interact with Bitcoin Core in order to conduct P2P operations (i.e. sending and receiving transactions).


Title: Re: howto share .bitcoin/blocks directory
Post by: Zz on October 23, 2016, 09:05:50 PM
Multiple instances of Bitcoin Core on the same computer cannot share the same blocks (or data directory) folder. They will run into simultaneous write issues and corrupt the data on the disk.

Well,
exchanges or web wallets are how it works?
They are probably not using Bitcoin Core and are probably using a proprietary system which allows them to have multiple wallets on the same instance of the software. Or they are using Bitcoin Core for purely the P2P part (not the wallet) and using an external wallet software which can interact with Bitcoin Core in order to conduct P2P operations (i.e. sending and receiving transactions).

new setup:
create 3 bitcoin adress on one bitcoind (run as root)
works fine but only one rpc user??
I need 3 rpc user?
if I can create 3 rpc users for 3 bitcoin adresses, users runs bitcoin-cli


Title: Re: howto share .bitcoin/blocks directory
Post by: achow101 on October 23, 2016, 09:09:59 PM
new setup:
create 3 bitcoin adress on one bitcoind (run as root)
works fine but only one rpc user??
I need 3 rpc user?
if I can create 3 rpc users for 3 bitcoin adresses, users runs bitcoin-cli

You only need one rpc user. However, you should not do this. Bitcoin sent from one address will end up in a change address. Bitcoin Core does not know that the three addresses are meant for three separate users. It thinks that they are all part of the same wallet (because they are) and treat them as such. Thus you will end up with one user accidentally spending the Bitcoin of another user. The only way around this is to use raw transactions and that can be a dangerous if you don't know what you are doing.


Title: Re: howto share .bitcoin/blocks directory
Post by: DarkStar_ on October 23, 2016, 09:53:03 PM
Multiple instances of Bitcoin Core on the same computer cannot share the same blocks (or data directory) folder. They will run into simultaneous write issues and corrupt the data on the disk.
Wouldn't that not be a problem in this case because OP said 3 accounts on the same computer, and to switch accounts, you need to log off, closing all running programs. Bitcoin Core would never be writing at the same time with other instances, so nothing would be corrupted.


Title: Re: howto share .bitcoin/blocks directory
Post by: achow101 on October 23, 2016, 09:57:28 PM
Multiple instances of Bitcoin Core on the same computer cannot share the same blocks (or data directory) folder. They will run into simultaneous write issues and corrupt the data on the disk.
Wouldn't that not be a problem in this case because OP said 3 accounts on the same computer, and to switch accounts, you need to log off, closing all running programs. Bitcoin Core would never be writing at the same time with other instances, so nothing would be corrupted.
They're being run simultaneously from 3 shells.
We use the same computer 3 people
3 shell accounts;


Title: Re: howto share .bitcoin/blocks directory
Post by: Zz on October 24, 2016, 05:50:41 AM
Multiple instances of Bitcoin Core on the same computer cannot share the same blocks (or data directory) folder. They will run into simultaneous write issues and corrupt the data on the disk.
Wouldn't that not be a problem in this case because OP said 3 accounts on the same computer, and to switch accounts, you need to log off, closing all running programs. Bitcoin Core would never be writing at the same time with other instances, so nothing would be corrupted.
They're being run simultaneously from 3 shells.
We use the same computer 3 people
3 shell accounts;



yes simultaneously 3 user.
https://www.ncomputing.com/en/products/lseries/overview
this linux Vspace server. (works fine.)
https://i.imgur.com/xRXiAHp.png



Title: Re: howto share .bitcoin/blocks directory
Post by: Zz on October 29, 2016, 01:46:47 AM
Hello All,
I gave up.
I found partial solution
we lost 240GB :(

write this script :

Code:
#!/bin/bash
#
rsync -avzh /root/.bitcoin --exclude=wallet.dat --exclude=bitcoin.conf /home/user1/.bitcoin
chown user1:user1 -R /home/user1/.bitcoin
#
rsync -avzh /root/.bitcoin --exclude=wallet.dat --exclude=bitcoin.conf /home/user2/.bitcoin
chown user2:user2 -R /home/user1/.bitcoin
#
rsync -avzh /root/.bitcoin --exclude=wallet.dat --exclude=bitcoin.conf /home/user3/.bitcoin
chown user3:user3 -R /home/user1/.bitcoin