Bitcoin Core Multi-wallet limit to 333 wallets

by kobik   Last Updated February 13, 2018 15:27 PM

Bitcoin Core 0.15.1 has Multi wallets support:

In the bitcoin.conf we can add multiple entries of:


When Bitcoin Core starts, if the wallet file does not exists it will create it. which is great for our needs.

However, it always crashes on the 333 wallet. with db.log error:

Lock table is out of available locker entries

And debug.log:

2018-02-13 14:47:05 init message: Loading wallet...
2018-02-13 14:47:05 nFileVersion = 160000
2018-02-13 14:47:05 Keys: 21 plaintext, 0 encrypted, 21 w/ metadata, 21 total
2018-02-13 14:47:05  wallet                   36ms
2018-02-13 14:47:05 setKeyPool.size() = 20
2018-02-13 14:47:05 mapWallet.size() = 0
2018-02-13 14:47:05 mapAddressBook.size() = 0
2018-02-13 14:47:05 init message: Loading wallet...
2018-02-13 14:47:05 

EXCEPTION: St13runtime_error       
CDB: Error 12, can't open database wallet-333.dat       
D:\BitcoinCore\bitcoin-0.16.0\bin\bitcoin-qt.exe in Runaway exception     

I also tried to minimize the -keypool=20 so that the wallets size will be much smaller in size, and the process of loading them is much faster.

I was suggested that this error is because each wallet.dat file is opened in the same BDB environment. The entire environment has a limited number of database locks, and it seems like 333 wallets hits that number of database locks.

The solution (which did not work) is to create a file named DB_CONFIG in the data dir, and put the following lines in that file:

set_lk_max_locks 400000
set_lk_max_objects 400000

By default it is 40000 and now 400000 (ten times more locks available)

But this gave the same results.

I tried also:

set_lg_dir database

With no luck.

I verified this on two different machines with 0.15.1 and 0.16.0. Same result. It always crashes when loading the 333 wallet.

Anyone have a solution to this?

I have put the list of wallets if anyone care to reproduce:

Related Questions

Is it possible to perform split payment in bitpay

Updated June 26, 2017 01:27 AM

how to create web wallet for bitcoin

Updated May 15, 2018 09:27 AM

Generate new address on button click HTML

Updated August 19, 2017 17:27 PM