<p>If you're using a systemd service, here's a way to auto load wallets using ExecStartPost.<br />
This is what I added to my bitcoind.service file:</p>
<pre><code>ExecStartPost=/bin/bash -c &quot;sleep 60 &amp;&amp; ls PATH_TO_YOUR_WALLETS_FOLDER -I database -I wallet.dat -I db.log | xargs -r -L 1 PATH_TO_YOUR_BITCON_CLI/bitcoin-cli loadwallet&quot;
</code></pre>
<p>It waits 60 seconds after bitcoind starts, to give it a chance to load the block index first.
Then looks for wallet directories and loads each one using <code>bitcoin-cli loadwallet WALLET_NAME</code> command.</p>
<hr />
<p>Alternatively, if you just want to load specific wallets on Bitcoin Core restart, add this to <strong>bitcoin.conf</strong> before restarting:</p>
<pre><code>wallet=
wallet=wallet_name
wallet=another_wallet
</code></pre>
<p>Full path isn't required if you created the wallets in the default directory (aka <strong>datadir</strong>).<br />
A wallet name is the name of the directory the corresponding wallet.dat is in.<br />
The <code>wallet=</code> line is needed to also load the default wallet.<br />
Make sure to add the lines in the <strong>[test]</strong> section if you're on testnet.</p>

CC BY-SA 4.0
2020-11-17T16:39:27.967Z
2020-12-04T12:58:29.497Z
2020-12-04T12:58:29.497Z
steve0
<p>You can specify the wallet options multiple times.</p>

<p>I.e. specifying:</p>

<pre><code>wallet=/home/ubuntu/.bitcoin/testnet3/wallets/wallet01
wallet=/home/ubuntu/.bitcoin/testnet3/wallets/wallet02
wallet=/home/ubuntu/.bitcoin/testnet3/wallets/wallet03
</code></pre>

<p>in your bitcoin.conf will load <code>wallet01</code>, <code>wallet02</code>, <code>wallet03</code>.</p>

CC BY-SA 4.0
2019-12-24T04:41:47.807Z
This doesn't works for me.
superrman777
CC BY-SA 4.0
2019-12-24T21:31:09.493Z
Hmm that's weird in this case I think you should post an issue on GIthub as that's the intended behavior (see the manpage).
Antoine Poinsot
CC BY-SA 4.0
2019-12-29T15:38:13.667Z
I just tested out of curiosity and I can't reproduce, did you open an issue. If so could you point me to it ?
Antoine Poinsot
CC BY-SA 4.0
2019-12-23T14:46:55.333Z
2019-12-23T14:46:55.333Z
Antoine Poinsot
<p>If we suppose that the count of wallets are a lot, we can't load them manually. I use a Python script which loads wallets:</p>
<pre><code>import subprocess
import os

def load_wallets():
    wallets = os.listdir(wallets_dir)
    for wallet in wallets:
        try:
            x = subprocess.check_output('bitcoin-cli -testnet loadwallet ' + wallet, shell=True)
        except Exception:
            pass
</code></pre>
<p>Some files may be in the wallets directory which are not wallet dirs and script will pass them inside <code>except</code> block.</p>
<blockquote>
<p>Change <code>-testnet</code> parameter if needed.</p>
</blockquote>

CC BY-SA 4.0
2020-05-08T13:18:51.133Z
2020-08-12T11:52:45.647Z
2020-08-12T11:52:45.647Z
Emad Mamaghani
<p>Every time I restart my <code>bitcoind</code>, all the wallets will need to be reloaded:</p>

<pre><code>$ bitcoin-cli listwallets
[
  ""
]
$ bitcoin-cli loadwallet test01
$ bitcoin-cli listwallets
[
  "",
  "test01"
]
</code></pre>

<p>So I was wondering that is there any ways to auto load all the wallet under path <code>/home/ubuntu/.bitcoin/testnet3/wallets</code> when startup? I have tried adding some config in bitcoin.config, but all didn't work for me:</p>

<pre><code>wallet=/home/ubuntu/.bitcoin/testnet3/wallets
wallet=/home/ubuntu/.bitcoin/testnet3/wallets/test01
wallet=1
</code></pre>

<p>bitcoin core version: v0.18.1</p>

CC BY-SA 4.0
2022-01-23T18:42:08.077Z
bitcoin-cli loadwallets doesn't work, but loadwallet does
buycanna.io
<bitcoin-core><bitcoind><wallet>
Auto load all wallets when start up
superrman777
# Auto load all wallets when start up

(Asked by: username_0 on 2019-12-23)

Every time I restart my `bitcoind`, all the wallets will need to be reloaded:

```
$ bitcoin-cli listwallets
[
  ""
]
$ bitcoin-cli loadwallet test01
$ bitcoin-cli listwallets
[
  "",
  "test01"
]

```

So I was wondering that is there any ways to auto load all the wallet under path `/home/ubuntu/.bitcoin/testnet3/wallets` when startup? I have tried adding some config in bitcoin.config, but all didn't work for me:

```
wallet=/home/ubuntu/.bitcoin/testnet3/wallets
wallet=/home/ubuntu/.bitcoin/testnet3/wallets/test01
wallet=1

```

bitcoin core version: v0.18.1

**Tags:** bitcoin-core, bitcoind, wallet

> **Comments:**
> **username_1**: bitcoin-cli loadwallets doesn't work, but loadwallet does  

---

## 3 answers

### Answer by username_2 on 2020-11-17. Score: 4

If you're using a systemd service, here's a way to auto load wallets using ExecStartPost.  
This is what I added to my bitcoind.service file:

```
ExecStartPost=/bin/bash -c "sleep 60 && ls PATH_TO_YOUR_WALLETS_FOLDER -I database -I wallet.dat -I db.log | xargs -r -L 1 PATH_TO_YOUR_BITCON_CLI/bitcoin-cli loadwallet"

```

It waits 60 seconds after bitcoind starts, to give it a chance to load the block index first.
Then looks for wallet directories and loads each one using `bitcoin-cli loadwallet WALLET_NAME` command.

---

Alternatively, if you just want to load specific wallets on Bitcoin Core restart, add this to **bitcoin.conf** before restarting:

```
wallet=
wallet=wallet_name
wallet=another_wallet

```

Full path isn't required if you created the wallets in the default directory (aka **datadir**).  
A wallet name is the name of the directory the corresponding wallet.dat is in.  
The `wallet=` line is needed to also load the default wallet.  
Make sure to add the lines in the **[test]** section if you're on testnet.


---

### Answer by username_3 on 2019-12-23. Score: 1

You can specify the wallet options multiple times.

I.e. specifying:

```
wallet=/home/ubuntu/.bitcoin/testnet3/wallets/wallet01
wallet=/home/ubuntu/.bitcoin/testnet3/wallets/wallet02
wallet=/home/ubuntu/.bitcoin/testnet3/wallets/wallet03

```

in your bitcoin.conf will load `wallet01`, `wallet02`, `wallet03`.

> **Comments:**
> **username_0**: This doesn't works for me.  
> **username_3**: Hmm that's weird in this case I think you should post an issue on GIthub as that's the intended behavior (see the manpage).  
> **username_3**: I just tested out of curiosity and I can't reproduce, did you open an issue. If so could you point me to it ?  

---

### Answer by username_4 on 2020-05-08. Score: 0

If we suppose that the count of wallets are a lot, we can't load them manually. I use a Python script which loads wallets:

```
import subprocess
import os

def load_wallets():
    wallets = os.listdir(wallets_dir)
    for wallet in wallets:
        try:
            x = subprocess.check_output('bitcoin-cli -testnet loadwallet ' + wallet, shell=True)
        except Exception:
            pass

```

Some files may be in the wallets directory which are not wallet dirs and script will pass them inside `except` block.

> Change `-testnet` parameter if needed.


---

