Hosted web wallet based on bitcoin core - approach to handling keys

0

1

I'm building a website for my client, that is essentially a web-based hosted wallet.

I'm going to use bitcoin core and talk to it via its API in order to handle the transactions.

I understand that I can allow users to export their private keys and import them by using

dumpprivkey

and

importprivkey

The question is: after several thousands of users will create their wallets, the server's wallet.dat file is going to be really huge. Would that make the bitcoin server slow?

I'm thinking about queuing all the requests to the bitcoin server and store there only one key at a time. But that would require to restart the server everytime, and would basically make every request time consuming?

What is the correct approach to this?

Thank you

Alexey Shchur

Posted 2017-12-26T15:03:05.657

Reputation: 103

Answers

1

The question is: after several thousands of users will create their wallets, the server's wallet.dat file is going to be really huge. Would that make the bitcoin server slow?

Yes, it is know that when the wallet.dat file is very large it noticeable slows down Bitcoin Core. However this only happens when there are millions of keys stored in the wallet.

Instead of having all of the private keys in one file, you can use Bitcoin Core's multiwallet feature. This feature allows you to have multiple wallet files loaded into Bitcoin Core so this should avoid the issue of having too large of a wallet file. It will also let each use have their own wallet file so only one user's coins are actually moved when spending any money. The only downside to this is that loading and unloading a wallet requires restarting. Once PR 10740 is merged, you will be able to dynamically load and unload wallets. Note that having many wallets loaded at the same time may also be problematic.

Andrew Chow

Posted 2017-12-26T15:03:05.657

Reputation: 40 910

Thank you Andrew for pointing the right direction. I will look into this near timeAlexey Shchur 2017-12-26T21:55:11.080