Share a common wallet.dat file between two servers

0

Note this is not duplicate of Is there a way to change the wallet.dat location without changing the entire data directory?

I want to change wallet.dat file location. From the above link it seems to be impossible. But is there any way i can update wallet file location in bitcoin source code https://github.com/bitcoin/bitcoin and run make command to make it executable. Here is the reason why i want to do this: https://serverfault.com/questions/888293/share-a-file-between-aws-servers

I want to share a common wallet.dat file between two server.

Ajit Soman

Posted 2017-12-15T13:52:15.973

Reputation: 405

2You should not share a wallet.dat file between two servers. It may not even work and may result in wallet corruption and loss of funds. If you are planning on having the two instances open the same wallet file, that is not allowed. BDB (the database system used by Bitcoin Core) does not allow a database to be opened by multiple software simultaneously. If you are somehow able to do so, you can corrupt your wallet.Andrew Chow 2017-12-15T14:20:16.783

1Furthermore, even if the wallet file is not accessed simultaneously, the two nodes will have different sync states which will result in the software being confused and potentially have to rescan every time you start up one of the nodes. It may also have other issues.Andrew Chow 2017-12-15T14:20:50.753

@AndrewChow Thanks for your comment. What about if i run bitcoin core in server 1 and access server 1's bitcore core in server 2 to run get balance and sendToAddress method. will this create any consistency issue. I am using amazon load balancer under this i have these two server. If user make request simultaneously will there is any chance of consistency issue.

Is there is any synchronization mechanism implemented in bitcore core to handle situation like this. – Ajit Soman 2017-12-15T17:22:49.947

If by "access server 1's bitcoin core in server 2" you mean that you want are going to send RPC requests to server 1 from server 2, then no, there will be no problem with that.Andrew Chow 2017-12-15T17:39:50.813

I am creating a application using library specified in this link:https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#Java. libraray class takes parameter RPC host,password,url and port . in server 1 i access these parameter via localhost in server 2 i will access it via ip of server 1. This will not corrupt wallet since i am running bitcoin core in one server.

Ajit Soman 2017-12-15T17:47:14.550

1Yes, that is correct.Andrew Chow 2017-12-15T19:11:52.630

@AndrewChow This will be my last question. If i do load testing on these two server with 1 Million user (using Jmeter) . Will the API calls executed by each user will run in thread safe manner i.e one command at a time. Is there is any affect on move and sendfrom command. Is there is any chance of transaction failureAjit Soman 2017-12-16T05:14:13.417

1It should be able to handle all of that in a thread safe manner as Bitcoind has locking mechanisms to ensure consistency with concurrent operations. However note that with that many RPC calls, bitcoind may not respond to all of them in a timely manner (some may timeout because locks are held by an operation elsewhere).Andrew Chow 2017-12-16T05:37:28.313

Answers

1

Just wait for the next Bitcoin Core release. They've already implemented -walletdir: https://github.com/bitcoin/bitcoin/commit/0530ba0eae147563921b162ed05347234d8b53c0

https://github.com/bitcoin/bitcoin/pull/11466

MCCCS

Posted 2017-12-15T13:52:15.973

Reputation: 5 827

+1 for sharing this information. Could you please provide me suggestion based on the comment i have posted in question.Ajit Soman 2017-12-15T17:24:15.460

@AjitSoman Are you on Windows? You'll need to follow this steps if you're on Windows 10: https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md#installing-windows-subsystem-for-linux and continue with https://github.com/bitcoin/bitcoin/blob/master/doc/build-windows.md#cross-compilation-for-ubuntu-and-windows-subsystem-for-linux or you can just install a Linux VM and do the instructions on the second document.

MCCCS 2017-12-16T06:06:09.293

I have found solution for my problem. You can read comments on questionAjit Soman 2017-12-16T06:16:34.137