I have two AWS server in which bitcoin core application is running. bitcoin core .It creates .bitcoin folder in home directory and it has a wallet.dat file.


Each AWS server has ubuntu OS.

Is it possible to that share that wallet.dat file only between two server. Assuming SERVER 1 has original dat file and another server has its copy. If the wallet.dat file is updated in SERVER 1 then it should reflect in SERVER 2 also.

Can anybody give some idea to implement this. I have heard about NFS but i think it is used for folder sharing.

  • 3
    No, you can't do this. Each bitcoind expects to write the wallet.dat exclusively, and they will overwrite each other. You will then lose money forever with no way to get it back. – Michael Hampton Dec 15 '17 at 20:39
  • @MichaelHampton Maybe what you say is true, but it sounds like a poor design. It ought to at least be possible to keep an offline copy of the private key in a safe location such that you can still use your coins even if you lost wallet.dat. – kasperd Dec 16 '17 at 13:37
  • @kasperd That's not the issue. He's proposing having two separate bitcoin daemons independently generate wallet keys and then store them in the same wallet. Not going to work and, as it is now, is a recipe for losing a lot of money. – Michael Hampton Dec 16 '17 at 14:46
  • @MichaelHampton I can't tell from the question what the intended updates to the file are. But surely if two servers try to simultaneously update a file shared with NFS, the contents of the file can end up corrupt. You could lose the latest updates, and you'd better have a backup of anything important. A newly generated secret better be securely stored before you start using it. – kasperd Dec 16 '17 at 14:55
  • 1
    @kasperd Here we're talking about the private cryptographic keys to access something that's worth $18,000 each today. Sharing the file in the way proposed, when the daemon doesn't support it at all, is bound to lead to corruption, as you say. Which, in this case, leads to losing a lot of money. – Michael Hampton Dec 16 '17 at 15:00

Some options:

Elastic File System

Create an AWS EFS share and mount it from both servers. EFS is hosted NFS, and NFS supports file locking. This is probably the best option.

NFS Share

One server can host a shared folder the other can access.

S3 + S3fs

Create a bucket on S3 and use S3fs on each server to mount it.

As Michael points out, this is a bad idea due to consistency issues. You could easily experience file corruption. Best go with a proper file system here.

| improve this answer | |
  • 2
    s3fs (or anything similar) is not a safe choice here if the file is being written to. The eventual consistency of S3 on overwrites almost guarantees eventual data loss if concurrent writes occur. If I remember correctly, concurrent access from multiple computers to wallet.dat (bitcoin database) is absolutely unsupported even with a typically more sensible solution like EFS/NFS. This answer would be great in many other contexts. – Michael - sqlbot Dec 15 '17 at 19:13

NFS would do the trick. Create an NFS share on SERVER 1 sharing the /home/ubuntu/.bitcoin directory, then mount it on SERVER 2 at the same location

Make sure to use the NFS security controls to prevent annoymous access and lock down access to the share in iptables..........

Here's a decent enough looking guide https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-16-04

| improve this answer | |
  • I don't want to share entire .bitcoin folder. I want to share wallet.dat file only – Ajit Soman Dec 15 '17 at 17:27
  • I still think NFS is the way to go. How about creating a new directory on server 1, move the files to you want to share to that directory and then symlink them back into .bitcoin. Create an NFS share of the new directory, mount in somewhere on SERVER 2 and symlink the files into .bitcoin on that box - that'd just share the files rather than the whole directory – DanGahan Dec 15 '17 at 19:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.