<p>As the documentation for the <a href="https://bitcoincore.org/en/doc/27.0.0/rpc/wallet/loadwallet/" rel="nofollow noreferrer"><code>loadwallet</code></a> RPC describes, the syntax is:</p>
<pre><code>loadwallet &quot;filename&quot; ( load_on_startup )
</code></pre>
<p>And it further specifies:</p>
<pre><code>Arguments:
1. filename (string, required) The wallet directory or .dat file.
</code></pre>
<p>What’s not clearly specified in the documentation is that you are to provide the filename <em>relative to the wallet directory</em> <code>~/.bitcoin/regtest/wallets</code>. It would be great if the documentation were improved in that regard.</p>
<p><a href="https://bitcoincore.org/en/doc/27.0.0/rpc/wallet/listwallets/" rel="nofollow noreferrer"><code>listwallets</code></a> returns the currently loaded wallets, so that’s why the wallet was not shown before it was loaded.</p>

CC BY-SA 4.0
2024-06-11T18:22:26.057Z
Part of my confusion is the machine that I am running bitcoin-cli is a different machine then the bitcoin node is on.  Am I specifying the wallet path that's on the bitcoin-cli client side or the wallet file location on the bitcoin node side?
yancy
CC BY-SA 4.0
2024-06-11T18:23:06.820Z
`bitcoin-cli` just sends the command to the server. Yes, the filename is the name the wallet file has on the server.
Pieter Wuille
CC BY-SA 4.0
2024-06-11T19:02:13.613Z
From the bitcoin-cli client side, it worked to specify the path on the server side (problem solved).  However, interestingly specifying the filename `wallet.dat` from the client side returns an error "Failed to load database path" followed by the path it tried to load wallet.dat from.  When specifying the filename, the path it tried to load wallet.dat from was `/home/bitcoin/.bitcoin/regtest/wallets/wallet.dat` however the path where wallet.dat exists on the server side is actually `/home/bitcoin/.bitcoin/regtest/wallets/regtest/wallet.dat`.
yancy
CC BY-SA 4.0
2024-06-11T19:09:31.853Z
I am specifying `-regtest` flag with every command bitcoin-cli command
yancy
CC BY-SA 4.0
2024-06-11T17:02:44.730Z
2024-06-11T17:02:44.730Z
Murch
<p>Running Bitcoin Core 27.0.0, how does one load a regtest wallet if the name of the wallet is unknown?</p>
<pre><code>bitcoin-cli -regtest loadwallet &lt;name?&gt;
</code></pre>
<p>Steps I've tried</p>
<ol>
<li><p>listwallets<br />
No wallet is listed in regtest from what I can tell</p>
</li>
<li><p>Read wallet.dat<br />
The wallet.dat file located at ~/.bitcoin/regtest/wallets/regtest can not be easily read since it's binary format</p>
</li>
</ol>

CC BY-SA 4.0
2024-06-11T16:39:50.067Z
The name of the wallet is its filename, relative to the wallet datadir (~/.bitcoin/regtest/wallets).
Pieter Wuille
CC BY-SA 4.0
2024-06-11T17:15:10.010Z
I’m confused by "can not be easily read since it's binary format"? The `loadwallet` RPC would take care of the import when the right path is provided as long as the file is a Bitcoin Core wallet file, so what were you getting at with that sentence?
Murch
<wallet><regtest>
How do you load a regtest wallet?
yancy
# How do you load a regtest wallet?

(Asked by: username_0 on 2024-06-11)

Running Bitcoin Core 27.0.0, how does one load a regtest wallet if the name of the wallet is unknown?

```
bitcoin-cli -regtest loadwallet <name?>

```

Steps I've tried

1. listwallets  
   No wallet is listed in regtest from what I can tell
2. Read wallet.dat  
   The wallet.dat file located at ~/.bitcoin/regtest/wallets/regtest can not be easily read since it's binary format

**Tags:** wallet, regtest

> **Comments:**
> **username_1**: The name of the wallet is its filename, relative to the wallet datadir (~/.bitcoin/regtest/wallets).  
> **username_2**: I’m confused by "can not be easily read since it's binary format"? The `loadwallet` RPC would take care of the import when the right path is provided as long as the file is a Bitcoin Core wallet file, so what were you getting at with that sentence?  

---

## 1 answers

### Answer by username_2 on 2024-06-11. Score: 2 | Accepted answer

As the documentation for the [`loadwallet`](https://bitcoincore.org/en/doc/27.0.0/rpc/wallet/loadwallet/) RPC describes, the syntax is:

```
loadwallet "filename" ( load_on_startup )

```

And it further specifies:

```
Arguments:
1. filename (string, required) The wallet directory or .dat file.

```

What’s not clearly specified in the documentation is that you are to provide the filename *relative to the wallet directory* `~/.bitcoin/regtest/wallets`. It would be great if the documentation were improved in that regard.

[`listwallets`](https://bitcoincore.org/en/doc/27.0.0/rpc/wallet/listwallets/) returns the currently loaded wallets, so that’s why the wallet was not shown before it was loaded.

> **Comments:**
> **username_0**: Part of my confusion is the machine that I am running bitcoin-cli is a different machine then the bitcoin node is on.  Am I specifying the wallet path that's on the bitcoin-cli client side or the wallet file location on the bitcoin node side?  
> **username_1**: `bitcoin-cli` just sends the command to the server. Yes, the filename is the name the wallet file has on the server.  
> **username_0**: From the bitcoin-cli client side, it worked to specify the path on the server side (problem solved).  However, interestingly specifying the filename `wallet.dat` from the client side returns an error "Failed to load database path" followed by the path it tried to load wallet.dat from.  When specifying the filename, the path it tried to load wallet.dat from was `/home/bitcoin/.bitcoin/regtest/wallets/wallet.dat` however the path where wallet.dat exists on the server side is actually `/home/bitcoin/.bitcoin/regtest/wallets/regtest/wallet.dat`.  
> **username_0**: I am specifying `-regtest` flag with every command bitcoin-cli command  

---

